diff options
author | Joe <rrbo@proton.me> | 2023-09-29 10:25:59 +0200 |
---|---|---|
committer | Joe <rrbo@proton.me> | 2023-09-29 10:25:59 +0200 |
commit | 3eb89471c4b46521b069de9acd16d23dba886d81 (patch) | |
tree | 2f6ff0688391f0c696a585152880dfa817027ca6 | |
parent | up (diff) | |
download | dotfiles-bsd-3eb89471c4b46521b069de9acd16d23dba886d81.tar.gz dotfiles-bsd-3eb89471c4b46521b069de9acd16d23dba886d81.tar.bz2 dotfiles-bsd-3eb89471c4b46521b069de9acd16d23dba886d81.tar.xz dotfiles-bsd-3eb89471c4b46521b069de9acd16d23dba886d81.tar.zst dotfiles-bsd-3eb89471c4b46521b069de9acd16d23dba886d81.zip |
good complete
-rw-r--r-- | .config/nvim/after/plugin/lsp.lua | 57 | ||||
-rw-r--r-- | .config/nvim/lua/bindings.lua | 6 |
2 files changed, 57 insertions, 6 deletions
diff --git a/.config/nvim/after/plugin/lsp.lua b/.config/nvim/after/plugin/lsp.lua index 227e2eb..1056274 100644 --- a/.config/nvim/after/plugin/lsp.lua +++ b/.config/nvim/after/plugin/lsp.lua @@ -40,11 +40,60 @@ require('mason-lspconfig').setup({ local cmp = require('cmp') local cmp_select = { behavior = cmp.SelectBehavior.Select } +cmp.setup({ + window = { + -- completion = cmp.config.window.bordered(), + -- documentation = cmp.config.window.bordered(), + }, + mapping = cmp.mapping.preset.insert({ + ['<C-i>'] = cmp.mapping.select_next_item(cmp_select), + ['<C-j>'] = cmp.mapping.select_next_item(cmp_select), + ['<C-k>'] = cmp.mapping.select_prev_item(cmp_select), + ['<C-b>'] = cmp.mapping.scroll_docs(-4), + ['<C-f>'] = cmp.mapping.scroll_docs(4), + ['<C-Space>'] = cmp.mapping.complete(), + ['<C-e>'] = cmp.mapping.abort(), + ['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + }), + sources = cmp.config.sources({ + { name = 'nvim_lsp' }, + { name = 'vsnip' }, -- For vsnip users. + -- { name = 'luasnip' }, -- For luasnip users. + -- { name = 'ultisnips' }, -- For ultisnips users. + -- { name = 'snippy' }, -- For snippy users. + }, { + { name = 'buffer' }, + }) +}) + + -- Set configuration for specific filetype. + cmp.setup.filetype('gitcommit', { + sources = cmp.config.sources({ + { name = 'git' }, -- You can specify the `git` source if [you were installed it](https://github.com/petertriho/cmp-git). + }, { + { name = 'buffer' }, + }) + }) + + -- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore). + cmp.setup.cmdline({ '/', '?' }, { + mapping = cmp.mapping.preset.cmdline(), + sources = { + { name = 'buffer' } + } + }) + + -- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). + cmp.setup.cmdline(':', { + mapping = cmp.mapping.preset.cmdline(), + sources = cmp.config.sources({ + { name = 'path' } + }, { + { name = 'cmdline' } + }) + }) + local cmp_mappings = lsp.defaults.cmp_mappings({ - ['<C-p>'] = cmp.mapping.select_prev_item(cmp_select), - ['<C-n>'] = cmp.mapping.select_next_item(cmp_select), - ['<C-n>'] = cmp.mapping.confirm({ select = true }), - ['<C-Space>'] = cmp.mapping.complete(), }) diff --git a/.config/nvim/lua/bindings.lua b/.config/nvim/lua/bindings.lua index 3db5aa6..53ad03b 100644 --- a/.config/nvim/lua/bindings.lua +++ b/.config/nvim/lua/bindings.lua @@ -1,8 +1,10 @@ vim.keymap.set('n', '<M-;>', ':call nerdcommenter#Comment(0,"toggle")<CR>', { noremap = true, silent = true }) vim.keymap.set('n', '<M-x>', ':', { noremap = true, silent = false }) vim.keymap.set('n', '<M-k>', ':bprevious<CR>', { noremap = true, silent = true }) -vim.keymap.set('n', '<C-u>', '<C-u>zz', { noremap = true, silent = false }) -vim.keymap.set('n', '<C-d>', '<C-d>zz', { noremap = true, silent = false }) +vim.keymap.set('n', '<C-u>', '<C-u>zz', { noremap = true, silent = true }) +vim.keymap.set('n', '<C-d>', '<C-d>zz', { noremap = true, silent = true }) +vim.keymap.set('n', '<C-b>', '<C-b>zz', { noremap = true, silent = true }) +vim.keymap.set('n', '<C-f>', '<C-f>zz', { noremap = true, silent = true }) vim.keymap.set('n', '<M-j>', ':bnext<CR>', { noremap = true, silent = true }) vim.keymap.set('n', '<C-h>', '<C-w>h', { noremap = true, silent = false }) vim.keymap.set('n', '<C-j>', '<C-w>j', { noremap = true, silent = false }) |