From 7166c238e8160fbffc219744b0fc96b96e889bd7 Mon Sep 17 00:00:00 2001 From: Kyren223 Date: Sat, 6 Jul 2024 15:55:25 +0300 Subject: [PATCH] Neovim: some minor tweaks and added 2 commented out plugins --- .config/nvim/TODO.md | 15 +++++++++++++++ .config/nvim/lazy-lock.json | 2 +- .config/nvim/lua/autocmds.lua | 10 ++++++++++ .config/nvim/lua/plugins/completions.lua | 2 +- .config/nvim/lua/plugins/lightbulb.lua | 20 ++++++++++++++++++++ .config/nvim/lua/plugins/lsp-saga.lua | 1 + .config/nvim/lua/plugins/lsp_signature.lua | 20 ++++++++++++++++++++ 7 files changed, 68 insertions(+), 2 deletions(-) create mode 100644 .config/nvim/lua/plugins/lightbulb.lua create mode 100644 .config/nvim/lua/plugins/lsp_signature.lua diff --git a/.config/nvim/TODO.md b/.config/nvim/TODO.md index 380a648..730d412 100644 --- a/.config/nvim/TODO.md +++ b/.config/nvim/TODO.md @@ -11,6 +11,21 @@ - TODO: Remove the vsc*de snippets/completions and make my own luasnip snippets [tutorial](https://www.youtube.com/watch?v=FmHhonPjvvA) - TODO: Setup [nvim spectre](https://github.com/nvim-pack/nvim-spectre) +# VERY IMPORTANT + +## TODO: Code actions +Don't show bs code actions (some kind of filter for "quickfix" and "refactor.extract" potentially?) +Sort quickfix actions to be first and then the rest less important ones +Alt enter should show a list of code actions +A lightbulb somewhere ONLY if the cursor (not line) has a code action and ONLY if it's a quickfix + +## TODO: Completions and snippets +Remove all the bs vscode snippets +Make my own snippets per file type +Learn how to navigate between snippet params +HAVE ACTUAL GOOD SORTING FOR SNIPPETS (hopefully this is possible) +when there is an lsp active, it shouldn't show any other types like regex +it should just show lsp stuff diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json index f5613cc..b4989c5 100644 --- a/.config/nvim/lazy-lock.json +++ b/.config/nvim/lazy-lock.json @@ -41,6 +41,7 @@ "nvim-cmp": { "branch": "main", "commit": "a110e12d0b58eefcf5b771f533fc2cf3050680ac" }, "nvim-dap": { "branch": "master", "commit": "6f79b822997f2e8a789c6034e147d42bc6706770" }, "nvim-dap-ui": { "branch": "master", "commit": "b7267003ba4dd860350be86f75b9d9ea287cedca" }, + "nvim-lightbulb": { "branch": "master", "commit": "8f00b89dd1b1dbde16872bee5fbcee2e58c9b8e9" }, "nvim-lspconfig": { "branch": "master", "commit": "bd7c76375a511994c9ca8d69441f134dc10ae3bd" }, "nvim-neoclip.lua": { "branch": "main", "commit": "709c97fabec9da7d04f7d2f5e207423af8c02871" }, "nvim-nio": { "branch": "master", "commit": "7969e0a8ffabdf210edd7978ec954a47a737bbcc" }, @@ -53,7 +54,6 @@ "okai": { "branch": "main", "commit": "b028c2916c39b1c4ad53756d262f9d0576edac87" }, "overseer.nvim": { "branch": "master", "commit": "433ae548434d83ab3c6afe6afc549832f7dd56f1" }, "plenary.nvim": { "branch": "master", "commit": "a3e3bc82a3f95c5ed0d7201546d5d2c19b20d683" }, - "project.nvim": { "branch": "main", "commit": "8c6bad7d22eef1b71144b401c9f74ed01526a4fb" }, "spaceduck": { "branch": "main", "commit": "350491f19343b24fa85809242089caa02d4dadce" }, "sqlite.lua": { "branch": "master", "commit": "d0ffd703b56d090d213b497ed4eb840495f14a11" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "9ef21b2e6bb6ebeaf349a0781745549bbb870d27" }, diff --git a/.config/nvim/lua/autocmds.lua b/.config/nvim/lua/autocmds.lua index 5da48ca..fd8b235 100644 --- a/.config/nvim/lua/autocmds.lua +++ b/.config/nvim/lua/autocmds.lua @@ -5,3 +5,13 @@ vim.api.nvim_create_autocmd('TextYankPost', { vim.highlight.on_yank() end, }) + +vim.api.nvim_create_autocmd('FileType', { + group = vim.api.nvim_create_augroup('disable-auto-comment', { clear = true }), + pattern = '*', + callback = function() + -- autowrap using textwidth | enter in insert mode | o/O in normal mode + -- vim.opt.formatoptions:remove({ 'c', 'r', 'o' }) + vim.cmd('set formatoptions-=cro') + end, +}) diff --git a/.config/nvim/lua/plugins/completions.lua b/.config/nvim/lua/plugins/completions.lua index 0244f1d..0699e9b 100644 --- a/.config/nvim/lua/plugins/completions.lua +++ b/.config/nvim/lua/plugins/completions.lua @@ -37,7 +37,7 @@ return { [''] = cmp.mapping.scroll_docs(-4), [''] = cmp.mapping.scroll_docs(4), [''] = cmp.mapping.complete(), - [''] = cmp.mapping.abort(), + [''] = cmp.mapping.abort(), [''] = cmp.mapping.confirm({ select = true }), }), sources = cmp.config.sources({ diff --git a/.config/nvim/lua/plugins/lightbulb.lua b/.config/nvim/lua/plugins/lightbulb.lua new file mode 100644 index 0000000..29aeffb --- /dev/null +++ b/.config/nvim/lua/plugins/lightbulb.lua @@ -0,0 +1,20 @@ +return { + 'kosayoda/nvim-lightbulb', + config = function() + require('nvim-lightbulb').setup({ + autocmd = { + enabled = true, + updatetime = 50, + }, + action_kinds = { 'quickfix', 'refactor.rewrite' }, + sign = { enabled = false }, + virtual_text = { enabled = true }, + float = { enabled = true }, + ignore = { + ft = { 'neo-tree' }, + actions_without_kind = true, + }, + }) + local test = "" + end, +} diff --git a/.config/nvim/lua/plugins/lsp-saga.lua b/.config/nvim/lua/plugins/lsp-saga.lua index c028d84..edbe855 100644 --- a/.config/nvim/lua/plugins/lsp-saga.lua +++ b/.config/nvim/lua/plugins/lsp-saga.lua @@ -7,6 +7,7 @@ return { config = function() require('lspsaga').setup({ lightbulb = { + enable = false, sign = false, virtual_text = true, }, diff --git a/.config/nvim/lua/plugins/lsp_signature.lua b/.config/nvim/lua/plugins/lsp_signature.lua new file mode 100644 index 0000000..33c2429 --- /dev/null +++ b/.config/nvim/lua/plugins/lsp_signature.lua @@ -0,0 +1,20 @@ +return { + -- 'ray-x/lsp_signature.nvim', + -- event = 'VeryLazy', + -- config = function() + -- local lsp_signature = require('lsp_signature') + -- vim.api.nvim_create_autocmd('LspAttach', { + -- callback = function(args) + -- local bufnr = args.buf + -- local client = vim.lsp.get_client_by_id(args.data.client_id) + -- if vim.tbl_contains({ 'null-ls' }, client.name) then + -- return + -- end + -- lsp_signature.on_attach({}, bufnr) + -- end, + -- }) + -- + -- require('lsp_signature').setup({}) + -- vim.keymap.set({ 'i', 'n' }, '', lsp_signature.toggle_float_win, { desc = 'toggle signature' }) + -- end, +}