diff options
Diffstat (limited to '.config/nvim/lua/user/plugins')
| -rw-r--r-- | .config/nvim/lua/user/plugins/cmp.lua | 19 | ||||
| -rw-r--r-- | .config/nvim/lua/user/plugins/lspconfig.lua | 12 | ||||
| -rw-r--r-- | .config/nvim/lua/user/plugins/luasnip.lua | 9 | ||||
| -rw-r--r-- | .config/nvim/lua/user/plugins/nvim-tree.lua | 14 |
4 files changed, 41 insertions, 13 deletions
diff --git a/.config/nvim/lua/user/plugins/cmp.lua b/.config/nvim/lua/user/plugins/cmp.lua index 4bfe38e..81cd2ee 100644 --- a/.config/nvim/lua/user/plugins/cmp.lua +++ b/.config/nvim/lua/user/plugins/cmp.lua @@ -3,13 +3,14 @@ local has_words_before = function() return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match '%s' == nil end +local luasnip = require 'luasnip' local cmp = require 'cmp' local lspkind = require 'lspkind' -- Set completeopt to have a better completion experience vim.o.completeopt = 'menuone,longest,preview' -cmp.setup { +cmp.setup({ experimental = { ghost_text = true, }, @@ -23,6 +24,11 @@ cmp.setup { }, }, }, + snippet = { + expand = function(args) + require('luasnip').lsp_expand(args.body) + end, + }, mapping = { ['<C-p>'] = cmp.mapping.select_prev_item(), ['<C-n>'] = cmp.mapping.select_next_item(), @@ -35,7 +41,9 @@ cmp.setup { select = false, }, ['<Tab>'] = cmp.mapping(function(fallback) - if cmp.visible() then + if luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + elseif cmp.visible() then cmp.select_next_item() elseif has_words_before() then cmp.complete() @@ -44,7 +52,9 @@ cmp.setup { end end, { 'i', 's' }), ['<S-Tab>'] = cmp.mapping(function(fallback) - if cmp.visible() then + if luasnip.jumpable(-1) then + luasnip.jump(-1) + elseif cmp.visible() then cmp.select_prev_item() else fallback() @@ -56,7 +66,8 @@ cmp.setup { { name = 'nvim_lsp' }, { name = 'nvim_lsp_signature_help' }, { name = 'nvim_lua' }, + { name = 'luasnip' }, { name = 'path' }, { name = 'buffer' }, }, -} +}) diff --git a/.config/nvim/lua/user/plugins/lspconfig.lua b/.config/nvim/lua/user/plugins/lspconfig.lua index 1467d66..b5dfc86 100644 --- a/.config/nvim/lua/user/plugins/lspconfig.lua +++ b/.config/nvim/lua/user/plugins/lspconfig.lua @@ -69,6 +69,14 @@ require 'lspconfig'.tsserver.setup { } } +require 'lspconfig'.html.setup { + on_attach = on_attach, + capabilities = capabilities, + flags = { + debounce_text_changes = 150, + } +} + local runtime_path = vim.split(package.path, ';') table.insert(runtime_path, "lua/?.lua") table.insert(runtime_path, "lua/?/init.lua") @@ -88,8 +96,8 @@ require 'lspconfig'.sumneko_lua.setup { path = runtime_path, }, diagnostics = { - -- Recognize the `vim` und `use` global - globals = { 'vim', 'use' }, + -- Recognize globals + globals = { 'vim', 'use', 'parse' }, }, workspace = { -- Make server aware of Neovim runtime files diff --git a/.config/nvim/lua/user/plugins/luasnip.lua b/.config/nvim/lua/user/plugins/luasnip.lua new file mode 100644 index 0000000..2e7462a --- /dev/null +++ b/.config/nvim/lua/user/plugins/luasnip.lua @@ -0,0 +1,9 @@ +local ls = require "luasnip" +require("luasnip.loaders.from_lua").load({ paths = "~/.config/nvim/snippets" }) + +ls.config.set_config { + history = true, + updateevents = 'TextChanged,TextChangedI', + enable_autosnippets = true, +} + diff --git a/.config/nvim/lua/user/plugins/nvim-tree.lua b/.config/nvim/lua/user/plugins/nvim-tree.lua index a4173e7..3c425c5 100644 --- a/.config/nvim/lua/user/plugins/nvim-tree.lua +++ b/.config/nvim/lua/user/plugins/nvim-tree.lua @@ -1,11 +1,11 @@ --- vim.g.nvim_tree_git_hl = 1 -vim.g.nvim_tree_highlight_opened_files = 1 -vim.g.nvim_tree_group_empty = 1 - require('nvim-tree').setup { - git = { - ignore = false, - }, + renderer = { + highlight_opened_files = "all", + group_empty = true, + }, + git = { + ignore = false, + }, } vim.cmd [[highlight NvimTreeIndentMarker guifg=#30323E]] |
