aboutsummaryrefslogtreecommitdiffstats
path: root/nvim/lua/plugins/nvim-cmp.lua
diff options
context:
space:
mode:
authorJean-Pierre Appel <jeanpierre.appel01@gmail.com>2024-01-15 16:15:05 -0500
committerJean-Pierre Appel <jeanpierre.appel01@gmail.com>2024-01-15 16:15:05 -0500
commit2cb9af61acfda466b747e5b18c947d1538c1240e (patch)
treecdb258438ffc2d255cf16eb8988fa0f4f7954e6d /nvim/lua/plugins/nvim-cmp.lua
parentbe7a52c6885048ed618f312070e55ab25bafb60d (diff)
refactor: setup completions less insanely
Diffstat (limited to 'nvim/lua/plugins/nvim-cmp.lua')
-rw-r--r--nvim/lua/plugins/nvim-cmp.lua72
1 files changed, 71 insertions, 1 deletions
diff --git a/nvim/lua/plugins/nvim-cmp.lua b/nvim/lua/plugins/nvim-cmp.lua
index 32285bf..b560732 100644
--- a/nvim/lua/plugins/nvim-cmp.lua
+++ b/nvim/lua/plugins/nvim-cmp.lua
@@ -216,4 +216,74 @@ function user.insert_tab()
)
end
-return Plugins
+-- return Plugins
+
+return {
+ {
+ "L3MON4D3/LuaSnip",
+ version = "v2.*",
+ build = "make install_jsregexp"
+ },
+ -- completion sources
+ {
+ 'hrsh7th/cmp-path',
+ },
+ {
+ 'saadparwaiz1/cmp_luasnip'
+ },
+ { -- TODO: lazy load on filtetype
+ 'hrsh7th/cmp-nvim-lua'
+ },
+ {
+ -- TODO: lazy load on lsp load
+ 'hrsh7th/cmp-nvim-lsp',
+ dependencies= {
+ 'neovim/nvim-lspconfig'
+ },
+ },
+ {
+ 'hrsh7th/cmp-buffer',
+ },
+ {
+ 'hrsh7th/nvim-cmp',
+ config = function()
+ local cmp = require('cmp')
+ cmp.setup({
+ snippet = {
+ expand = function(args)
+ require('luasnip').lsp_expand(args.body)
+ end
+ },
+ sources = {
+ { name = 'nvim_lsp', keyword_length = 3 },
+ { name = 'luasnip', keyword_length = 2 },
+ { name = 'path' },
+ { name = 'nvim_lua' },
+ { name = 'buffer', keyword_length = 3 }
+ -- TODO: add more sources
+ },
+ window = {
+ -- TODO: style cmp windows
+ completion = cmp.config.window.bordered(),
+ documentation = cmp.config.window.bordered()
+ },
+ mapping = cmp.mapping.preset.insert({
+ ['<C-k>'] = cmp.mapping.scroll_docs(-5),
+ ['<C-j>'] = cmp.mapping.scroll_docs(5),
+ ['<TAB>'] = cmp.mapping(function(fallback)
+ if cmp.visible() then
+ cmp.confirm({select = true })
+ else
+ fallback()
+ end
+ end, {'i', 's'})
+ })
+ })
+ end
+ },
+
+ -- {
+ -- 'kdheepak/cmp-latex-symbols',
+ -- dependencies = { 'hrsh7th/nvim-cmp' }
+ -- },
+}