diff options
| author | Jean-Pierre Appel <jeanpierre.appel01@gmail.com> | 2023-10-03 12:29:38 -0400 |
|---|---|---|
| committer | Jean-Pierre Appel <jeanpierre.appel01@gmail.com> | 2023-10-03 12:29:38 -0400 |
| commit | aac2ce8f3070711768295ecc7876bb86ca55877a (patch) | |
| tree | 4e9de07c91c6273bfde7d074622eb6c115543e13 /nvim | |
| parent | 2ca0bea095e4f29a7a4673a09fec23c65041877a (diff) | |
changed completion menu apperance, added dynamic find reference bind
Diffstat (limited to 'nvim')
| -rw-r--r-- | nvim/after/plugin/telescope.lua | 9 | ||||
| -rw-r--r-- | nvim/lua/lsp.lua | 2 | ||||
| -rw-r--r-- | nvim/lua/plugins/nvim-cmp.lua | 39 |
3 files changed, 31 insertions, 19 deletions
diff --git a/nvim/after/plugin/telescope.lua b/nvim/after/plugin/telescope.lua index 9f0215d..d164bd9 100644 --- a/nvim/after/plugin/telescope.lua +++ b/nvim/after/plugin/telescope.lua @@ -3,6 +3,7 @@ local builtin = require('telescope.builtin') local nnoremap = Remap.nnoremap -- find file +-- TODO: add netrw open bind within context nnoremap("<Leader>ff", function() builtin.find_files() end) @@ -19,7 +20,13 @@ end) -- lsp find refrences nnoremap("<Leader>fr", function() - builtin.lsp_references() + -- TODO: if lsp supports reference provider and lsp is attached + -- [telescope.builtin.lsp_*]: server does not support referencesProvider + if #vim.lsp.get_active_clients({bufnr = 0}) > 0 then + builtin.lsp_references() + else + builtin.grep_string() + end end) -- -- find git, lists git pickers diff --git a/nvim/lua/lsp.lua b/nvim/lua/lsp.lua index bdc5734..c0848ef 100644 --- a/nvim/lua/lsp.lua +++ b/nvim/lua/lsp.lua @@ -30,5 +30,7 @@ lsp.set_preferences({ -- require('lspconfig').lua_ls.setup(lsp.nvim_lua_ls()) +-- TODO: change bind for lsp.buf.code_actions() + lsp.setup() diff --git a/nvim/lua/plugins/nvim-cmp.lua b/nvim/lua/plugins/nvim-cmp.lua index 907ba2e..32285bf 100644 --- a/nvim/lua/plugins/nvim-cmp.lua +++ b/nvim/lua/plugins/nvim-cmp.lua @@ -2,6 +2,8 @@ local Plugins = {} +-- FIXME: plugin not loading correctly + -- Autocompletion local cmp_plugin = { 'hrsh7th/nvim-cmp', @@ -25,8 +27,8 @@ table.insert(Plugins, cmp_plugin) table.insert(Plugins, { 'aspeddro/cmp-pandoc.nvim', - enabled = false, - event = 'InsertEnter', + enabled = true, + -- event = 'InsertEnter', ft = {'markdown', 'pandoc', 'rmd'}, dependencies = { 'nvim-lua/plenary.nvim', @@ -39,7 +41,7 @@ table.insert(Plugins, { } }) -function cmp_plugin.config() +cmp_plugin.config = function() user.augroup = vim.api.nvim_create_augroup('compe_cmds', {clear = true}) vim.api.nvim_create_user_command('UserCmpEnable', user.enable_cmd, {}) @@ -80,21 +82,22 @@ function cmp_plugin.config() zindex = 50, } }, - -- formatting = { - -- fields = {'menu', 'abbr', 'kind'}, - -- format = function(entry, item) - -- local menu_icon = { - -- nvim_lsp = 'λ', - -- luasnip = '⋗', - -- buffer = 'Ω', - -- path = '🖫', - -- nvim_lua = 'Π', - -- } - -- - -- item.menu = menu_icon[entry.source.name] - -- return item - -- end, - -- }, + formatting = { + fields = {'menu', 'abbr', 'kind'}, + format = function(entry, item) + local menu = { + nvim_lsp = '[LSP]', + luasnip = '[Snip]', + buffer = '[Buffer]', + path = '[Path]', + nvim_lua = '[Lua]', + cmp_pandoc = '[Pandoc]' + } + + item.menu = menu[entry.source.name] + return item + end, + }, mapping = { ['<C-k>'] = cmp.mapping.scroll_docs(-5), ['<C-j>'] = cmp.mapping.scroll_docs(5), |
