diff --git a/modules/home/nvim/lua/plugins/lsp.lua b/modules/home/nvim/lua/plugins/lsp.lua index 3b7ebc9..e6ca968 100644 --- a/modules/home/nvim/lua/plugins/lsp.lua +++ b/modules/home/nvim/lua/plugins/lsp.lua @@ -48,6 +48,35 @@ local lsp_keymaps = function(buffer) 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 = "", +} + + return { { "dundalek/lazy-lsp.nvim", @@ -128,4 +157,60 @@ return { } } }, + + { + "hrsh7th/nvim-cmp", + version = false, -- last release is way too old + event = "InsertEnter", + dependencies = { + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-path", + "saadparwaiz1/cmp_luasnip", + }, + opts = function() + local cmp = require("cmp") + return { + completion = { + completeopt = "menu,menuone,noinsert", + }, + snippet = { + expand = function(args) + require("luasnip").lsp_expand(args.body) + end, + }, + mapping = cmp.mapping.preset.insert({ + [""] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }), + [""] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }), + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.complete(), + [""] = cmp.mapping.abort(), + [""] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + }), + sources = cmp.config.sources({ + { name = "nvim_lsp" }, + { name = "luasnip" }, + { name = "path" }, + }), + formatting = { + fields = { "abbr", "kind" }, + format = function(_, vim_item) + vim_item.kind = string.format('%s %s', kind_icons[vim_item.kind], vim_item.kind) + return vim_item + end, + }, + navigation = { + documentation = { + border = { "╭", "─", "╮", "│", "╯", "─", "╰", "│" }, + }, + }, + experimental = { + ghost_text = { + hl_group = true, + }, + }, + } + end, + }, } diff --git a/modules/home/nvim/lua/settings.lua b/modules/home/nvim/lua/settings.lua index 8c7d09a..d108d65 100644 --- a/modules/home/nvim/lua/settings.lua +++ b/modules/home/nvim/lua/settings.lua @@ -13,6 +13,7 @@ local options = { smartcase = true, mouse = "a", + mousemodel = "extend", splitbelow = true, splitright = true, cursorline = true,