From 5cee865dfec7a29e84c785792263a204f4be20cc Mon Sep 17 00:00:00 2001 From: Michael Yockey Date: Wed, 7 May 2025 00:57:21 -0400 Subject: [PATCH] feat: LSP completion and LazyGit - Replaces Luasnip with Blink - Removes Neogit - Adds LazyGit --- dependencies/homebrew.txt | 1 + nvim/.config/nvim/lazy-lock.json | 38 ++++++------- .../nvim/lua/yock/plugins/completion.lua | 16 ++++++ nvim/.config/nvim/lua/yock/plugins/git.lua | 17 ++++++ nvim/.config/nvim/lua/yock/plugins/init.lua | 1 - nvim/.config/nvim/lua/yock/plugins/lsp.lua | 55 ++++++------------- nvim/.config/nvim/lua/yock/plugins/neogit.lua | 12 ---- .../.config/nvim/lua/yock/plugins/trouble.lua | 42 ++++++++++++++ nvim/.config/nvim/snippets/ruby.lua | 3 + zsh/dot-zshrc | 1 - 10 files changed, 114 insertions(+), 72 deletions(-) create mode 100644 nvim/.config/nvim/lua/yock/plugins/completion.lua create mode 100644 nvim/.config/nvim/lua/yock/plugins/git.lua delete mode 100644 nvim/.config/nvim/lua/yock/plugins/neogit.lua create mode 100644 nvim/.config/nvim/lua/yock/plugins/trouble.lua create mode 100644 nvim/.config/nvim/snippets/ruby.lua diff --git a/dependencies/homebrew.txt b/dependencies/homebrew.txt index aedebec..38d79c3 100644 --- a/dependencies/homebrew.txt +++ b/dependencies/homebrew.txt @@ -8,6 +8,7 @@ git gitkraken-cli gnupg golang +lazygit lua-language-server nodenv nodenv/nodenv/nodenv-default-packages diff --git a/nvim/.config/nvim/lazy-lock.json b/nvim/.config/nvim/lazy-lock.json index 5dc24d7..c3c5f2d 100644 --- a/nvim/.config/nvim/lazy-lock.json +++ b/nvim/.config/nvim/lazy-lock.json @@ -1,39 +1,37 @@ { "FixCursorHold.nvim": { "branch": "master", "commit": "1900f89dc17c603eec29960f57c00bd9ae696495" }, - "LuaSnip": { "branch": "master", "commit": "c9b9a22904c97d0eb69ccb9bab76037838326817" }, "auto-dark-mode.nvim": { "branch": "master", "commit": "c31de126963ffe9403901b4b0990dde0e6999cc6" }, + "blink.cmp": { "branch": "main", "commit": "4f38ce99a472932d5776337f08f7a8180f1f571a" }, "cloak.nvim": { "branch": "main", "commit": "648aca6d33ec011dc3166e7af3b38820d01a71e4" }, - "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, - "cmp-nvim-lsp": { "branch": "main", "commit": "99290b3ec1322070bcfb9e846450a46f6efa50f0" }, - "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" }, "direnv.vim": { "branch": "master", "commit": "ab2a7e08dd630060cd81d7946739ac7442a4f269" }, - "git-blame.nvim": { "branch": "master", "commit": "2883a7460f611c2705b23f12d58d398d5ce6ec00" }, - "gitmoji.nvim": { "branch": "main", "commit": "326ddf01cbf3425566a089126ece7e8bd2560601" }, + "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, + "git-blame.nvim": { "branch": "master", "commit": "8503b199edf9a666fe7b1a989cf14e3c26b2eb03" }, + "gitmoji.nvim": { "branch": "main", "commit": "2659de229c2b26d50732f1220700eebbcdb2d6ef" }, "harpoon": { "branch": "harpoon2", "commit": "ed1f853847ffd04b2b61c314865665e1dadf22c7" }, "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, - "lualine.nvim": { "branch": "master", "commit": "b8b60c7f1d0d95ad74ee215b2291280b30482476" }, + "lazygit.nvim": { "branch": "main", "commit": "b9eae3badab982e71abab96d3ee1d258f0c07961" }, + "lualine.nvim": { "branch": "master", "commit": "15884cee63a8c205334ab13ab1c891cd4d27101a" }, "markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" }, - "neogit": { "branch": "master", "commit": "333968f8222fda475d3e4545a9b15fe9912ca26a" }, - "neotest": { "branch": "master", "commit": "dddbe8fe358b05b2b7e54fe4faab50563171a76d" }, + "neotest": { "branch": "master", "commit": "f0edc1dafdb04ae51a3863c1c5e4268d7462931b" }, "neotest-rspec": { "branch": "main", "commit": "281c0ed0e55d623e8028796e1c4dc27b7e421fd0" }, - "nvim-cmp": { "branch": "main", "commit": "1e1900b0769324a9675ef85b38f99cca29e203b3" }, "nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" }, - "nvim-dap": { "branch": "master", "commit": "a720d4966f758ab22e8ec28812b6df90a53e0f02" }, + "nvim-dap": { "branch": "master", "commit": "8df427aeba0a06c6577dc3ab82de3076964e3b8d" }, "nvim-dap-ruby": { "branch": "main", "commit": "93cae460d1a9bced94cf7b45748351b6cddd4ab4" }, - "nvim-dap-ui": { "branch": "master", "commit": "bc81f8d3440aede116f821114547a476b082b319" }, - "nvim-lspconfig": { "branch": "master", "commit": "2574ad38c6ee4f0bef3a1ca305cd5df627a52bb3" }, + "nvim-dap-ui": { "branch": "master", "commit": "73a26abf4941aa27da59820fd6b028ebcdbcf932" }, + "nvim-lspconfig": { "branch": "master", "commit": "4bc481b6f0c0cf3671fc894debd0e00347089a4e" }, "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, - "nvim-surround": { "branch": "main", "commit": "6c54643ef42016b744888b06d2381abd23f9b7ea" }, + "nvim-surround": { "branch": "main", "commit": "0e62500b98f4513feaaf7425c135472457ea5b7d" }, "nvim-tmux-navigation": { "branch": "main", "commit": "4898c98702954439233fdaf764c39636681e2861" }, - "nvim-treesitter": { "branch": "master", "commit": "d76a8b6e1b67fd3bcffec4a5d45fd9dee4dbbee8" }, - "nvim-treesitter-endwise": { "branch": "master", "commit": "57d52841a966be6ff9a998a6d3dc1ac9cc9d95fc" }, - "nvim-web-devicons": { "branch": "master", "commit": "4c3a5848ee0b09ecdea73adcd2a689190aeb728c" }, - "oil.nvim": { "branch": "master", "commit": "548587d68b55e632d8a69c92cefd981f360634fa" }, + "nvim-treesitter": { "branch": "master", "commit": "28d480e0624b259095e56f353ec911f9f2a0f404" }, + "nvim-treesitter-endwise": { "branch": "master", "commit": "d6cbb83307d516ec076d17c9a33d704ef626ee8c" }, + "nvim-web-devicons": { "branch": "master", "commit": "2c2b4eafce6cdd0cb165036faa17396eff18f847" }, + "oil.nvim": { "branch": "master", "commit": "685cdb4ffa74473d75a1b97451f8654ceeab0f4a" }, "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" }, - "telescope.nvim": { "branch": "master", "commit": "a17d611a0e111836a1db5295f04945df407c5135" }, + "telescope.nvim": { "branch": "master", "commit": "a4ed82509cecc56df1c7138920a1aeaf246c0ac5" }, "todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" }, + "trouble.nvim": { "branch": "main", "commit": "85bedb7eb7fa331a2ccbecb9202d8abba64d37b3" }, "undotree": { "branch": "master", "commit": "b951b87b46c34356d44aa71886aecf9dd7f5788a" }, - "vim-doge": { "branch": "master", "commit": "750d17dcd5a38a6afb51ddd07ee7d3e96bab7e9e" }, + "vim-doge": { "branch": "master", "commit": "03a84072ef21b205237c77986c78914395d646c3" }, "which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" } } diff --git a/nvim/.config/nvim/lua/yock/plugins/completion.lua b/nvim/.config/nvim/lua/yock/plugins/completion.lua new file mode 100644 index 0000000..98ec50a --- /dev/null +++ b/nvim/.config/nvim/lua/yock/plugins/completion.lua @@ -0,0 +1,16 @@ +return { + 'saghen/blink.cmp', + version = '*', + dependencies = { + 'rafamadriz/friendly-snippets', + }, + opts = { + keymap = { + preset = 'default', + }, + sources = { + default = { 'lsp', 'path', 'snippets', 'buffer' }, + }, + }, + opts_extend = { 'sources.default' }, +} diff --git a/nvim/.config/nvim/lua/yock/plugins/git.lua b/nvim/.config/nvim/lua/yock/plugins/git.lua new file mode 100644 index 0000000..2306c73 --- /dev/null +++ b/nvim/.config/nvim/lua/yock/plugins/git.lua @@ -0,0 +1,17 @@ +return { + 'kdheepak/lazygit.nvim', + lazy = true, + cmd = { + 'LazyGit', + 'LazyGitConfig', + 'LazyGitCurrentFile', + 'LazyGitFilter', + 'LazyGitFilterCurrentFile', + }, + dependencies = { + "nvim-lua/plenary.nvim", + }, + keys = { + { 'g', 'LazyGit', { desc = 'Lazygit' } }, + }, +} diff --git a/nvim/.config/nvim/lua/yock/plugins/init.lua b/nvim/.config/nvim/lua/yock/plugins/init.lua index 2ff2fd2..476cd8b 100644 --- a/nvim/.config/nvim/lua/yock/plugins/init.lua +++ b/nvim/.config/nvim/lua/yock/plugins/init.lua @@ -5,5 +5,4 @@ return { 'mfussenegger/nvim-dap', -- 'github/copilot.vim', { 'folke/todo-comments.nvim', dependencies = { 'nvim-lua/plenary.nvim' }, opts = {} }, - { 'L3MON4D3/LuaSnip', build = 'make install_jsregexp', opts = {} }, } diff --git a/nvim/.config/nvim/lua/yock/plugins/lsp.lua b/nvim/.config/nvim/lua/yock/plugins/lsp.lua index 65db127..26b8315 100644 --- a/nvim/.config/nvim/lua/yock/plugins/lsp.lua +++ b/nvim/.config/nvim/lua/yock/plugins/lsp.lua @@ -1,47 +1,12 @@ return { 'neovim/nvim-lspconfig', dependencies = { - 'hrsh7th/nvim-cmp', - 'hrsh7th/cmp-nvim-lsp', - 'hrsh7th/cmp-buffer', - 'L3MON4D3/LuaSnip', + 'saghen/blink.cmp', }, config = function() local lspconfig = require('lspconfig') - local capabilities = require('cmp_nvim_lsp').default_capabilities() - local cmp = require('cmp') - local luasnip = require('luasnip') - require('luasnip.loaders.from_vscode').lazy_load() - - -- Completion - luasnip.filetype_extend('ruby', { 'rails' }) - - cmp.setup({ - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) - end, - }, - window = { - completion = cmp.config.window.bordered(), - }, - mapping = cmp.mapping.preset.insert({ - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), - [''] = cmp.mapping.complete(), - [''] = cmp.mapping.abort(), - [''] = cmp.mapping.confirm({ select = true }), - }), - sources = cmp.config.sources({ - { name = 'nvim_lsp' }, - { name = 'luasnip' }, - }, { - { name = 'buffer' }, - }) - }) - - -- LSP - capabilities.textDocument.completion.completionItem.snippetSupport = true + local lsp_capabilities = vim.lsp.protocol.make_client_capabilities() + local capabilities = require('blink.cmp').get_lsp_capabilities(lsp_capabilities) lspconfig.pylsp.setup({ capabilities = capabilities }) lspconfig.ts_ls.setup({ capabilities = capabilities }) @@ -74,6 +39,9 @@ return { 'vim', 'require', 'out', + 's', + 'c', + 't', } } } @@ -84,6 +52,16 @@ return { lspconfig.sourcekit.setup({ capabilities = capabilities }) lspconfig.sqlls.setup({ capabilities = capabilities }) + local function filteredQuickfix() + vim.lsp.buf.code_action({ + context = { only = { 'quickfix' } }, + apply = true, + filter = function(codeAction) + return codeAction.isPreferred + end + }) + end + vim.api.nvim_create_autocmd('LspAttach', { group = vim.api.nvim_create_augroup('UserLspConfig', {}), callback = function(ev) @@ -98,6 +76,7 @@ return { vim.keymap.set('n', '[d', function() vim.diagnostic.goto_next() end, opts) vim.keymap.set('n', ']d', function() vim.diagnostic.goto_prev() end, opts) vim.keymap.set('n', 'vca', function() vim.lsp.buf.code_action() end, opts) + vim.keymap.set('n', '', filteredQuickfix, opts) vim.keymap.set('n', 'vrr', function() vim.lsp.buf.references() end, opts) vim.keymap.set('n', 'vrn', function() vim.lsp.buf.rename() end, opts) vim.keymap.set('n', 'vrh', function() vim.lsp.buf.signature_help() end, opts) diff --git a/nvim/.config/nvim/lua/yock/plugins/neogit.lua b/nvim/.config/nvim/lua/yock/plugins/neogit.lua deleted file mode 100644 index 20ce29f..0000000 --- a/nvim/.config/nvim/lua/yock/plugins/neogit.lua +++ /dev/null @@ -1,12 +0,0 @@ -return { - "NeogitOrg/neogit", - dependencies = { - "nvim-lua/plenary.nvim", - "sindrets/diffview.nvim", - "nvim-telescope/telescope.nvim", - }, - config = true, - keys = { - { 'g', ':Neogit', { desc = 'Open Neogit' } }, - }, -} diff --git a/nvim/.config/nvim/lua/yock/plugins/trouble.lua b/nvim/.config/nvim/lua/yock/plugins/trouble.lua new file mode 100644 index 0000000..221b5e2 --- /dev/null +++ b/nvim/.config/nvim/lua/yock/plugins/trouble.lua @@ -0,0 +1,42 @@ +return { + "folke/trouble.nvim", + opts = {}, -- for default options, refer to the configuration section for custom setup. + cmd = "Trouble", + keys = { + { + "xx", + "Trouble diagnostics toggle", + desc = "Diagnostics (Trouble)", + }, + { + "xX", + "Trouble diagnostics toggle filter.buf=0", + desc = "Buffer Diagnostics (Trouble)", + }, + { + "cs", + "Trouble symbols toggle focus=false", + desc = "Symbols (Trouble)", + }, + { + "cl", + "Trouble lsp toggle focus=false win.position=right", + desc = "LSP Definitions / references / ... (Trouble)", + }, + { + "xL", + "Trouble loclist toggle", + desc = "Location List (Trouble)", + }, + { + "xQ", + "Trouble qflist toggle", + desc = "Quickfix List (Trouble)", + }, + { + "xt", + "Trouble todo", + desc = "Todos (Trouble)", + }, + }, +} diff --git a/nvim/.config/nvim/snippets/ruby.lua b/nvim/.config/nvim/snippets/ruby.lua new file mode 100644 index 0000000..12976e9 --- /dev/null +++ b/nvim/.config/nvim/snippets/ruby.lua @@ -0,0 +1,3 @@ +return { + s('froz', t('# frozen_string_literal: true')) +} diff --git a/zsh/dot-zshrc b/zsh/dot-zshrc index c4caef0..f0338c0 100644 --- a/zsh/dot-zshrc +++ b/zsh/dot-zshrc @@ -62,4 +62,3 @@ case `uname` in export PATH=/home/myockey/.local/bin:$PATH ;; esac -