summaryrefslogtreecommitdiff
path: root/.config/nvim/lua/custom
diff options
context:
space:
mode:
Diffstat (limited to '.config/nvim/lua/custom')
-rw-r--r--.config/nvim/lua/custom/completion.lua30
-rw-r--r--.config/nvim/lua/custom/lsp.lua3
-rw-r--r--.config/nvim/lua/custom/plugins/completion.lua5
-rw-r--r--.config/nvim/lua/custom/plugins/lsp.lua5
4 files changed, 24 insertions, 19 deletions
diff --git a/.config/nvim/lua/custom/completion.lua b/.config/nvim/lua/custom/completion.lua
index 04ae172..507d807 100644
--- a/.config/nvim/lua/custom/completion.lua
+++ b/.config/nvim/lua/custom/completion.lua
@@ -1,5 +1,6 @@
require('custom.snippets.lua')
local luasnip = require('luasnip')
+local lspkind = require('lspkind')
local cmp = require('cmp')
-- Enable paretheses for function completions
@@ -36,21 +37,24 @@ cmp.setup({
enabled = is_enabled,
completion = { completeopt = 'menu,menuone,noinsert' },
sources = cmp.config.sources({
- { name = 'nvim_lsp' },
- { name = 'luasnip' },
+ { name = 'nvim_lsp' }, -- for lsp
+ { name = 'luasnip' }, -- for snippets
{ name = 'lazydev', group_index = 0 }, -- for lazydev.nvim
{ name = 'path' }, -- for filesystem
- }),
-
+ }, {}),
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
window = {
- -- TODO: Decide if I like borders or not
- completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
+ completion = {
+ border = 'rounded',
+ winhighlight = 'Normal:Pmenu,FloatBorder:Pmenu,Search:None',
+ col_offset = -3,
+ side_padding = 0,
+ },
},
mapping = cmp.mapping.preset.insert({
['<Tab>'] = tab(true),
@@ -60,10 +64,18 @@ cmp.setup({
['<C-u>'] = cmp.mapping.scroll_docs(-4),
['<C-d>'] = cmp.mapping.scroll_docs(4),
['<C-m>'] = cmp.mapping.abort(),
- -- NOTE: Select makes it so it doesn't put the text in the buffer (like Insert or defualt does)
- -- Ex: typing "p" and then select "private" will not write "private" in your buffer, but keep it "p"
- -- Only after accepting the suggestion then it'll become "private"
['<C-n>'] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Select }),
['<C-p>'] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Select }),
}),
+ ---@diagnostic disable-next-line: missing-fields
+ formatting = {
+ fields = { 'kind', 'abbr', 'menu' },
+ 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.menu = ' ' .. (strings[2] or '') .. '' -- right (text)
+ return kind
+ end,
+ },
})
diff --git a/.config/nvim/lua/custom/lsp.lua b/.config/nvim/lua/custom/lsp.lua
index 929014d..2acbed1 100644
--- a/.config/nvim/lua/custom/lsp.lua
+++ b/.config/nvim/lua/custom/lsp.lua
@@ -56,9 +56,6 @@ vim.api.nvim_create_autocmd('LspAttach', {
local bufnr = args.buf
local client = assert(vim.lsp.get_client_by_id(args.data.client_id), 'must have valid client')
- -- TODO: Check if I need this line
- -- vim.opt_local.omnifunc = "v:lua.vim.lsp.omnifunc"
-
local settings = servers[client.name]
if type(settings) ~= 'table' then
---@diagnostic disable-next-line: cast-local-type
diff --git a/.config/nvim/lua/custom/plugins/completion.lua b/.config/nvim/lua/custom/plugins/completion.lua
index 5e0f2ef..a1835ad 100644
--- a/.config/nvim/lua/custom/plugins/completion.lua
+++ b/.config/nvim/lua/custom/plugins/completion.lua
@@ -3,9 +3,8 @@ return {
lazy = false,
priority = 100,
dependencies = {
- -- 'onsails/lspkind.nvim',
- -- 'hrsh7th/cmp-path',
- -- 'hrsh7th/cmp-buffer',
+ 'onsails/lspkind.nvim', -- icons for completion type
+ 'hrsh7th/cmp-path', -- complete filepaths
'hrsh7th/cmp-nvim-lsp', -- lsp source for nvim-cmp
'saadparwaiz1/cmp_luasnip', -- snippets source for nvim-cmp
{ 'L3MON4D3/LuaSnip', build = 'make install_jsregexp' }, -- snippets plugin
diff --git a/.config/nvim/lua/custom/plugins/lsp.lua b/.config/nvim/lua/custom/plugins/lsp.lua
index e555ace..8972299 100644
--- a/.config/nvim/lua/custom/plugins/lsp.lua
+++ b/.config/nvim/lua/custom/plugins/lsp.lua
@@ -12,10 +12,7 @@ return {
opts = { library = { { path = 'luvit-meta/library', words = { 'vim%.uv' } } } },
},
- -- FIXME: Starts with a black blackground
- -- Desired behaviour is same color as background or transparent
- -- Progress ui
- { 'j-hui/fidget.nvim', opts = {} },
+ { 'j-hui/fidget.nvim', opts = { notification = { window = { winblend = 0 } } } },
-- AUtoformatting
-- 'stevear/conform.nvim',