From 859fbb0612664cad80ac78dfec2366dd70f7881b Mon Sep 17 00:00:00 2001 From: ksyasuda Date: Wed, 16 Aug 2023 18:17:45 -0700 Subject: [PATCH 1/2] get rid of cursor highlighting --- lua/plugins.lua | 2 +- plugin-confs/nvim-cmp.lua | 39 +-------------------------------------- 2 files changed, 2 insertions(+), 39 deletions(-) diff --git a/lua/plugins.lua b/lua/plugins.lua index 0101c9f..24120f9 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -360,7 +360,7 @@ require('packer').startup(function(use) vim.g.doom_one_plugin_startify = true vim.g.doom_one_plugin_whichkey = true vim.g.doom_one_plugin_indent_blankline = true - vim.g.doom_one_plugin_vim_illuminate = true + vim.g.doom_one_plugin_vim_illuminate = false vim.g.doom_one_plugin_lspsaga = false end, config = function() diff --git a/plugin-confs/nvim-cmp.lua b/plugin-confs/nvim-cmp.lua index 19c2cd6..31bdb38 100644 --- a/plugin-confs/nvim-cmp.lua +++ b/plugin-confs/nvim-cmp.lua @@ -6,39 +6,6 @@ local lspconfig = require('lspconfig') local luasnip = require 'luasnip' local highlight = require('cmp.utils.highlight') -local highlight_symbol_under_cursor = function() - vim.cmd [[ - hi! LspReferenceRead cterm=bold ctermbg=red guibg=LightYellow - hi! LspReferenceText cterm=bold ctermbg=red guibg=LightYellow - hi! LspReferenceWrite cterm=bold ctermbg=red guibg=LightYellow - ]] - vim.api.nvim_create_augroup('lsp_document_highlight', { clear = false }) - vim.api.nvim_clear_autocmds({ - buffer = bufnr, - group = 'lsp_document_highlight' - }) - vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, { - group = 'lsp_document_highlight', - buffer = bufnr, - callback = vim.lsp.buf.document_highlight - }) - vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, { - group = 'lsp_document_highlight', - buffer = bufnr, - callback = vim.lsp.buf.clear_references - }) -end - -local has_words_before = function() - if vim.api.nvim_buf_get_option(0, "buftype") == "prompt" then - return false - end - local line, col = unpack(vim.api.nvim_win_get_cursor(0)) - return col ~= 0 and - vim.api.nvim_buf_get_text(0, line - 1, 0, line - 1, col, {})[1]:match( - "^%s*$") == nil -end - lspkind.init({ symbol_map = { Copilot = "" } }) vim.api.nvim_set_hl(0, "CmpItemKindCopilot", { fg = "#6CC644" }) @@ -244,15 +211,11 @@ for _, lsp in ipairs(servers) do if lsp == 'lua_ls' then lspconfig[lsp].setup { -- on_attach = my_custom_on_attach, - on_attach = highlight_symbol_under_cursor(), capabilities = capabilities, callSnippet = "Replace" } else - lspconfig[lsp].setup { - on_attach = highlight_symbol_under_cursor(), - capabilities = capabilities - } + lspconfig[lsp].setup { capabilities = capabilities } end end From f259ac15a831731aa8bff255b7de78b9a823428e Mon Sep 17 00:00:00 2001 From: ksyasuda Date: Wed, 16 Aug 2023 19:29:40 -0700 Subject: [PATCH 2/2] update --- plugin-confs/nvim-cmp.lua | 13 +++++++++++-- plugin-confs/telescope.lua | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/plugin-confs/nvim-cmp.lua b/plugin-confs/nvim-cmp.lua index 31bdb38..9aebe69 100644 --- a/plugin-confs/nvim-cmp.lua +++ b/plugin-confs/nvim-cmp.lua @@ -5,6 +5,17 @@ local lspconfig = require('lspconfig') -- luasnip setup local luasnip = require 'luasnip' local highlight = require('cmp.utils.highlight') +local capabilities = require('cmp_nvim_lsp').default_capabilities() + +local has_words_before = function() + if vim.api.nvim_buf_get_option(0, "buftype") == "prompt" then + return false + end + local line, col = unpack(vim.api.nvim_win_get_cursor(0)) + return col ~= 0 and + vim.api.nvim_buf_get_text(0, line - 1, 0, line - 1, col, {})[1]:match( + "^%s*$") == nil +end lspkind.init({ symbol_map = { Copilot = "" } }) @@ -201,8 +212,6 @@ cmp.setup.cmdline(':', { }) }) -local capabilities = require('cmp_nvim_lsp').default_capabilities() - local servers = { 'bashls', 'jedi_language_server', 'jsonls', 'yamlls', 'vimls', 'dotls', 'dockerls', 'html', 'cssls', 'lua_ls' diff --git a/plugin-confs/telescope.lua b/plugin-confs/telescope.lua index 5c67b30..8ae9869 100644 --- a/plugin-confs/telescope.lua +++ b/plugin-confs/telescope.lua @@ -20,7 +20,7 @@ ts.setup({ -- map actions.which_key to (default: ) -- actions.which_key shows the mappings for your picker, -- e.g. git_{create, delete, ...}_branch for the git_branches picker - -- [""] = "which_key" + [""] = "which_key" } }, file_ignore_patterns = { "^node_modules/", "^env/", "^__pycache__/" }