diff options
| author | Kyren223 <ulmliad223@gmail.com> | 2024-07-14 16:31:42 +0300 |
|---|---|---|
| committer | Kyren223 <ulmliad223@gmail.com> | 2024-07-14 16:31:42 +0300 |
| commit | 282c1c9db72670719d4d3e7b924d90d14228f06d (patch) | |
| tree | f624044467648ec8ce49b7aca6ef21ec3c6aa5a4 /.config/nvim/lua/custom | |
| parent | 0df12a6506bacc7afb709df7443bf31bcc3d84ed (diff) | |
Neovim: snippets now load automatically, changed TODO.md
Diffstat (limited to '.config/nvim/lua/custom')
| -rw-r--r-- | .config/nvim/lua/custom/completion.lua | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/.config/nvim/lua/custom/completion.lua b/.config/nvim/lua/custom/completion.lua index 85a963f..5cf8c7b 100644 --- a/.config/nvim/lua/custom/completion.lua +++ b/.config/nvim/lua/custom/completion.lua @@ -1,4 +1,7 @@ -require('custom.snippets.lua') +for _, ft_path in ipairs(vim.api.nvim_get_runtime_file('lua/custom/snippets/*.lua', true)) do + loadfile(ft_path)() +end + local luasnip = require('luasnip') local lspkind = require('lspkind') local cmp = require('cmp') @@ -37,10 +40,10 @@ cmp.setup({ enabled = is_enabled, completion = { completeopt = 'menu,menuone,noinsert' }, sources = cmp.config.sources({ - { name = 'nvim_lsp' }, -- for lsp - { name = 'luasnip' }, -- for snippets + { name = 'nvim_lsp' }, -- for lsp + { name = 'luasnip' }, -- for snippets { name = 'lazydev', group_index = 0 }, -- for lazydev.nvim - { name = 'path' }, -- for filesystem + { name = 'path' }, -- for filesystem }, {}), snippet = { expand = function(args) @@ -73,7 +76,7 @@ cmp.setup({ format = function(entry, vim_item) local kind = lspkind.cmp_format({ mode = 'symbol_text', maxwidth = 50 })(entry, vim_item) local strings = vim.split(kind.kind, '%s', { trimempty = true }) - kind.kind = ' ' .. (strings[1] or '') .. ' ' -- left (icon) + kind.kind = ' ' .. (strings[1] or '') .. ' ' -- left (icon) kind.menu = ' ' .. (strings[2] or '') .. '' -- right (text) return kind end, |
