Neovim: mostly finished configuring completions, maybe some extra addons in the future
This commit is contained in:
@@ -8,6 +8,8 @@
|
||||
- TODO: Add refactoring keys like <leader>iv for introduce variable, extract method, introduce constant etc
|
||||
- TODO: Decide which outline-plugin to use (lspsaga or aerial, or smthing else)
|
||||
- TODO: Finish configuring lsp saga (I think it has supertypes and stuff which aren't in the doc)
|
||||
- TODO: Create your own luasnip snippets, search what "choices" are
|
||||
- TODO: Look for a list of sources for completions to add more cool stuff https://github.com/hrsh7th/nvim-cmp/wiki/List-of-sources
|
||||
|
||||
- TODO: learn what dot repeat is
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
"bluloco.nvim": { "branch": "main", "commit": "e7586def35c3584f1cc71fecf3e89e53dc4a40c6" },
|
||||
"ccc.nvim": { "branch": "main", "commit": "4fb5abaef2f2e0540fe22d4d74a9841205fff9e4" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" },
|
||||
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
||||
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
|
||||
"darcula": { "branch": "master", "commit": "faf8dbab27bee0f27e4f1c3ca7e9695af9b1242b" },
|
||||
"darcula-solid.nvim": { "branch": "main", "commit": "d950b9ca20096313c435a93e57af7815766f3d3d" },
|
||||
@@ -14,7 +15,6 @@
|
||||
"diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" },
|
||||
"edgy.nvim": { "branch": "main", "commit": "a8bc1d24798c80a391f1a5d898a50c41a7f93883" },
|
||||
"fidget.nvim": { "branch": "main", "commit": "c12f8a58ee472ce5983c3a3f3aad0ff6c49a6a83" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "682157939e57bd6a2c86277dfd4d6fbfce63dbac" },
|
||||
"ftFT.nvim": { "branch": "master", "commit": "f3e43c9584e14b27f04c27a95a9d9f0e58dfec02" },
|
||||
"github-nvim-theme": { "branch": "main", "commit": "4f44a5c930372c85483d02700f332d34417e50b2" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "82bc6225e958411a6846b27ac7c21bf8af1f72e4" },
|
||||
@@ -24,6 +24,7 @@
|
||||
"lazy.nvim": { "branch": "main", "commit": "c501b429cf995c645454539b924aaefae45bb9eb" },
|
||||
"lazydev.nvim": { "branch": "main", "commit": "6184ebbbc8045d70077659b7d30c705a588dc62f" },
|
||||
"leap.nvim": { "branch": "main", "commit": "eca8108dcd5f41fbde2a674dceb58b81ed887dc8" },
|
||||
"lspkind.nvim": { "branch": "master", "commit": "1735dd5a5054c1fb7feaf8e8658dbab925f4f0cf" },
|
||||
"lspsaga.nvim": { "branch": "main", "commit": "6f920cfabddb9b7de5a3a4d0b7cd4f0774ae23e2" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "0a5a66803c7407767b799067986b4dc3036e1983" },
|
||||
"lush.nvim": { "branch": "main", "commit": "7c0e27f50901481fe83b974493c4ea67a4296aeb" },
|
||||
|
||||
@@ -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,
|
||||
},
|
||||
})
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -28,6 +28,7 @@ vim.opt.ignorecase = true
|
||||
vim.opt.smartcase = true
|
||||
|
||||
-- Misc
|
||||
vim.opt_local.wrap = false
|
||||
vim.opt.wrap = false
|
||||
vim.opt.scrolloff = 8
|
||||
vim.opt.undofile = true
|
||||
|
||||
Reference in New Issue
Block a user