diff options
Diffstat (limited to 'plugin')
| -rw-r--r-- | plugin/cmp.lua | 88 | ||||
| -rw-r--r-- | plugin/gitsigns.lua | 1 | ||||
| -rw-r--r-- | plugin/indentblankline.lua | 3 | ||||
| -rw-r--r-- | plugin/lspconfig.lua | 20 | ||||
| -rw-r--r-- | plugin/nvimtree.lua | 5 | ||||
| -rw-r--r-- | plugin/zerolsp.lua | 54 |
6 files changed, 63 insertions, 108 deletions
diff --git a/plugin/cmp.lua b/plugin/cmp.lua deleted file mode 100644 index 56b25f5..0000000 --- a/plugin/cmp.lua +++ /dev/null @@ -1,88 +0,0 @@ -local luasnip = require('luasnip') -local cmp = require'cmp' - -local has_words_before = function() - unpack = unpack or table.unpack - local line, col = unpack(vim.api.nvim_win_get_cursor(0)) - return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match('%s') == nil -end - -local kind_icons = { - Text = "", - Method = "", - Function = "", - Constructor = "", - Field = "", - Variable = "", - Class = "ﴯ", - Interface = "", - Module = "", - Property = "ﰠ", - Unit = "", - Value = "", - Enum = "", - Keyword = "", - Snippet = "", - Color = "", - File = "", - Reference = "", - Folder = "", - EnumMember = "", - Constant = "", - Struct = "", - Event = "", - Operator = "", - TypeParameter = "" -} - -cmp.setup({ - snippet = { - expand = function(args) - require('luasnip').lsp_expand(args.body) - end, - }, - window = { - }, - mapping = cmp.mapping.preset.insert({ - ['<Tab>'] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - elseif luasnip.expand_or_jumpable() then - luasnip.expand_or_jump() - elseif has_words_before() then - cmp.complete() - else - fallback() - end - end, { 'i', 's' }), - - ['<S-Tab>'] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif luasnip.jumpable(-1) then - luasnip.jump(-1) - else - fallback() - end - end, { 'i', 's' }), - }), - sources = cmp.config.sources({ - { name = 'nvim_lsp' }, - { name = 'luasnip' }, - { name = 'omni' }, - { name = 'buffer' }, - }), - formatting = { - format = function(entry, vim_item) - vim_item.kind = string.format('%s %s', kind_icons[vim_item.kind], vim_item.kind) - vim_item.menu = ({ - buffer = "[Buffer]", - nvim_lsp = "[LSP]", - luasnip = "[LuaSnip]", - nvim_lua = "[Lua]", - latex_symbols = "[LaTeX]", - })[entry.source.name] - return vim_item - end - }, -}) diff --git a/plugin/gitsigns.lua b/plugin/gitsigns.lua new file mode 100644 index 0000000..91fa65b --- /dev/null +++ b/plugin/gitsigns.lua @@ -0,0 +1 @@ +require('gitsigns').setup() diff --git a/plugin/indentblankline.lua b/plugin/indentblankline.lua new file mode 100644 index 0000000..d869bbc --- /dev/null +++ b/plugin/indentblankline.lua @@ -0,0 +1,3 @@ +require("indent_blankline").setup { + show_end_of_line = true, +} diff --git a/plugin/lspconfig.lua b/plugin/lspconfig.lua deleted file mode 100644 index 398d1ae..0000000 --- a/plugin/lspconfig.lua +++ /dev/null @@ -1,20 +0,0 @@ -require('mason').setup() - -require('mason-lspconfig').setup({ - ensure_installed = { - } -}) - -local lsp_capabilities = require('cmp_nvim_lsp').default_capabilities() -local lsp_attach = function(client, bufnr) -end - -local lspconfig = require('lspconfig') -require('mason-lspconfig').setup_handlers({ - function(server_name) - lspconfig[server_name].setup({ - on_attach = lsp_attach, - capabilities = lsp_capabilities, - }) - end, -}) diff --git a/plugin/nvimtree.lua b/plugin/nvimtree.lua new file mode 100644 index 0000000..42e69b2 --- /dev/null +++ b/plugin/nvimtree.lua @@ -0,0 +1,5 @@ +vim.g.loaded_netrw = 1 +vim.g.loaded_netrwPlugin = 1 + +-- empty setup using defaults +require("nvim-tree").setup() diff --git a/plugin/zerolsp.lua b/plugin/zerolsp.lua new file mode 100644 index 0000000..a37bee4 --- /dev/null +++ b/plugin/zerolsp.lua @@ -0,0 +1,54 @@ +local lsp = require('lsp-zero').preset({ + name = 'minimal', + set_lsp_keymaps = true, + manage_nvim_cmp = true, + suggest_lsp_servers = false, +}) + +local luasnip = require("luasnip") +local cmp = require("cmp") + +lsp.setup_nvim_cmp({ + formatting = { + fields = {'abbr', 'menu', 'kind'}, + + mapping = lsp.defaults.cmp_mappings({ + ["<Tab>"] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + elseif has_words_before() then + cmp.complete() + else + fallback() + end + end, { "i", "s" }), + + ["<S-Tab>"] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { "i", "s" }), + }), + + format = function(entry, item) + local menu_icon = { + nvim_lsp = 'λ', + luasnip = '⋗', + buffer = 'Ω', + path = '🖫', + nvim_lua = 'Π', + } + + item.menu = menu_icon[entry.source.name] + return item + end, + }, +}) + +lsp.setup() |
