diff options
author | Yuqian Yang <crupest@crupest.life> | 2025-03-12 22:50:12 +0800 |
---|---|---|
committer | Yuqian Yang <crupest@crupest.life> | 2025-03-12 22:50:12 +0800 |
commit | 3d9b0c38adf1b2afd89ef33bbe70cd4eb4c1d8e6 (patch) | |
tree | 7d33fca9ba5af14e14cf0982eb7e6d0556ca12b0 /store/home/config/nvim/lua/setup/plugins/cmp.lua | |
parent | 9e635213f5a5145db7b31972050ab75f1aa19c15 (diff) | |
download | crupest-3d9b0c38adf1b2afd89ef33bbe70cd4eb4c1d8e6.tar.gz crupest-3d9b0c38adf1b2afd89ef33bbe70cd4eb4c1d8e6.tar.bz2 crupest-3d9b0c38adf1b2afd89ef33bbe70cd4eb4c1d8e6.zip |
feat(nvim): improve configs a lot.
Diffstat (limited to 'store/home/config/nvim/lua/setup/plugins/cmp.lua')
-rw-r--r-- | store/home/config/nvim/lua/setup/plugins/cmp.lua | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/store/home/config/nvim/lua/setup/plugins/cmp.lua b/store/home/config/nvim/lua/setup/plugins/cmp.lua new file mode 100644 index 0000000..c977943 --- /dev/null +++ b/store/home/config/nvim/lua/setup/plugins/cmp.lua @@ -0,0 +1,33 @@ +local function setup() + local cmp = require("cmp") + + cmp.setup { + snippet = { + expand = function(args) + vim.snippet.expand(args.body) + end, + }, + window = { + completion = cmp.config.window.bordered(), + documentation = cmp.config.window.bordered(), + }, + mapping = cmp.mapping.preset.insert({ + ['<C-b>'] = cmp.mapping.scroll_docs(-4), + ['<C-f>'] = cmp.mapping.scroll_docs(4), + ['<C-j>'] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Select }), + ['<C-k>'] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Select }), + ['<C-y>'] = cmp.mapping.confirm({ select = true }), + ['<CR>'] = cmp.mapping.confirm({ select = true }), + }), + sources = cmp.config.sources({ + { name = 'nvim_lsp' }, + { name = 'path' }, + }, { + { name = 'buffer' }, + }) + } +end + +return { + setup = setup +} |