From 4ace3901c7b411812035f087e4967e33043772bb Mon Sep 17 00:00:00 2001 From: Michael Yockey Date: Sun, 28 Apr 2024 15:04:03 -0400 Subject: [PATCH] feat: Add completion and remove Copilot --- dependencies/homebrew.txt | 5 ++ nodenv/.config/nodenv/default-packages | 2 + nvim/.config/nvim/lazy-lock.json | 37 ++++++++---- nvim/.config/nvim/lua/yock/plugins/cloak.lua | 5 +- .../nvim/lua/yock/plugins/completion.lua | 56 +++++++++++++++++++ nvim/.config/nvim/lua/yock/plugins/dap-ui.lua | 5 ++ nvim/.config/nvim/lua/yock/plugins/dap.lua | 10 ++++ .../.config/nvim/lua/yock/plugins/gitmoji.lua | 5 ++ nvim/.config/nvim/lua/yock/plugins/init.lua | 2 +- nvim/.config/nvim/lua/yock/plugins/lsp.lua | 34 +++++++++-- .../nvim/lua/yock/plugins/treesitter.lua | 2 +- nvim/.config/nvim/lua/yock/remap.lua | 12 ---- zsh/.gitignore | 1 + zsh/dot-zshrc | 2 +- 14 files changed, 146 insertions(+), 32 deletions(-) create mode 100644 nodenv/.config/nodenv/default-packages create mode 100644 nvim/.config/nvim/lua/yock/plugins/completion.lua create mode 100644 nvim/.config/nvim/lua/yock/plugins/dap.lua create mode 100644 nvim/.config/nvim/lua/yock/plugins/gitmoji.lua diff --git a/dependencies/homebrew.txt b/dependencies/homebrew.txt index 35a8725..d8983e6 100644 --- a/dependencies/homebrew.txt +++ b/dependencies/homebrew.txt @@ -1,11 +1,16 @@ +fd fzf gh git gnupg +golang nodenv +nodenv/nodenv/nodenv-default-packages pinentry-mac rbenv ruby-build +rust +rust-analyzer stow tmux wget diff --git a/nodenv/.config/nodenv/default-packages b/nodenv/.config/nodenv/default-packages new file mode 100644 index 0000000..0d2b2ae --- /dev/null +++ b/nodenv/.config/nodenv/default-packages @@ -0,0 +1,2 @@ +@angular/language-server +typescript-language-server diff --git a/nvim/.config/nvim/lazy-lock.json b/nvim/.config/nvim/lazy-lock.json index 1bd5f04..6a31489 100644 --- a/nvim/.config/nvim/lazy-lock.json +++ b/nvim/.config/nvim/lazy-lock.json @@ -1,26 +1,39 @@ { + "LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" }, "cloak.nvim": { "branch": "main", "commit": "6e5bcd50bebc5cdb7cd3a00eb3d97ab7c4cc3b94" }, - "copilot.vim": { "branch": "release", "commit": "9484e35cf222e9360e05450622a884f95c662c4c" }, + "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, + "cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" }, + "cmp-dotenv": { "branch": "main", "commit": "fd78929551010bc20602e7e663e42a5e14d76c96" }, + "cmp-emoji": { "branch": "main", "commit": "e8398e2adf512a03bb4e1728ca017ffeac670a9f" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" }, + "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, + "cmp-rpncalc": { "branch": "master", "commit": "f5f12d2684015bf1d0402b118dc633fef312c16c" }, + "cmp-tmux": { "branch": "main", "commit": "95b1b921802e6f60627b3e76afb9380fddd87f9a" }, + "cmp-zsh": { "branch": "main", "commit": "c24db8e58fac9006ec23d93f236749288d00dec9" }, + "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, "flexoki": { "branch": "main", "commit": "975654bce67514114db89373539621cff42befb5" }, - "git-blame.nvim": { "branch": "master", "commit": "a0282d05adbee80aaf4e2ff35b81b52940b67bed" }, + "friendly-snippets": { "branch": "main", "commit": "ea068f1becd91bcd4591fceb6420d4335e2e14d3" }, + "git-blame.nvim": { "branch": "master", "commit": "ad1d1365c9189d89797fe8d559677d5f55dc2830" }, + "gitmoji.nvim": { "branch": "main", "commit": "326ddf01cbf3425566a089126ece7e8bd2560601" }, "lazy.nvim": { "branch": "main", "commit": "31ddbea7c10b6920c9077b66c97951ca8682d5c8" }, - "lualine.nvim": { "branch": "master", "commit": "b5e8bb642138f787a2c1c5aedc2a78cb2cebbd67" }, - "nvim": { "branch": "main", "commit": "aebe43db9cb26e1c70fc5b2fd4158169c405e720" }, - "nvim-dap": { "branch": "master", "commit": "405df1dcc2e395ab5173a9c3d00e03942c023074" }, + "lualine.nvim": { "branch": "master", "commit": "0a5a66803c7407767b799067986b4dc3036e1983" }, + "nvim": { "branch": "main", "commit": "a1439ad7c584efb3d0ce14ccb835967f030450fe" }, + "nvim-cmp": { "branch": "main", "commit": "ce16de5665c766f39c271705b17fff06f7bcb84f" }, + "nvim-dap": { "branch": "master", "commit": "6ae8a14828b0f3bff1721a35a1dfd604b6a933bb" }, "nvim-dap-ruby": { "branch": "main", "commit": "a2248b7b31f6f096b9e847e769afd00060e0aae4" }, "nvim-dap-ui": { "branch": "master", "commit": "edfa93f60b189e5952c016eee262d0685d838450" }, - "nvim-lspconfig": { "branch": "master", "commit": "96e5711040df23583591391ce49e556b8cd248d8" }, + "nvim-lspconfig": { "branch": "master", "commit": "ed8b8a15acc441aec669f97d75f2c1f2ac8c8aa5" }, "nvim-nio": { "branch": "master", "commit": "5800f585def265d52f1d8848133217c800bcb25d" }, - "nvim-surround": { "branch": "main", "commit": "84a26afce16cffa7e3322cfa80a42cddf60616eb" }, + "nvim-surround": { "branch": "main", "commit": "a4e30d33add8a9743b4f518b3a788b3c8e5def71" }, "nvim-tmux-navigation": { "branch": "main", "commit": "4898c98702954439233fdaf764c39636681e2861" }, - "nvim-treesitter": { "branch": "master", "commit": "1b050206e490a4146cdf25c7b38969c1711b5620" }, - "nvim-web-devicons": { "branch": "master", "commit": "3ee60deaa539360518eaab93a6c701fe9f4d82ef" }, + "nvim-treesitter": { "branch": "master", "commit": "fea5808a58dc00b7131163886fe2648bbcae9dff" }, + "nvim-web-devicons": { "branch": "master", "commit": "b3468391470034353f0e5110c70babb5c62967d3" }, "plenary.nvim": { "branch": "master", "commit": "8aad4396840be7fc42896e3011751b7609ca4119" }, - "rspec.nvim": { "branch": "main", "commit": "304682100b152071c2186994690c9646a5d46e05" }, + "rspec.nvim": { "branch": "main", "commit": "c9b9d530707221483ad737ca5329110b8e4b5a23" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "9ef21b2e6bb6ebeaf349a0781745549bbb870d27" }, - "telescope.nvim": { "branch": "master", "commit": "4626aaa2bcfdacf55fd6d44b430e2df81b2403ff" }, + "telescope.nvim": { "branch": "master", "commit": "d00d9df48c00d8682c14c2b5da78bda7ef06b939" }, "todo-comments.nvim": { "branch": "main", "commit": "a7e39ae9e74f2c8c6dc4eea6d40c3971ae84752d" }, - "undotree": { "branch": "master", "commit": "aa93a7e5890dbbebbc064cd22260721a6db1a196" }, + "undotree": { "branch": "master", "commit": "56c684a805fe948936cda0d1b19505b84ad7e065" }, "vim-doge": { "branch": "master", "commit": "a96aef58c04e30caf0ce6e98da2e43694624df18" }, "which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" } } \ No newline at end of file diff --git a/nvim/.config/nvim/lua/yock/plugins/cloak.lua b/nvim/.config/nvim/lua/yock/plugins/cloak.lua index f56076e..28d0ecb 100644 --- a/nvim/.config/nvim/lua/yock/plugins/cloak.lua +++ b/nvim/.config/nvim/lua/yock/plugins/cloak.lua @@ -26,5 +26,8 @@ return { replace = nil, }, }, - } + }, + keys = { + { 'ct', function() require('cloak').toggle() end, { desc = 'Toggle cloak' } }, + }, } 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..1a2570c --- /dev/null +++ b/nvim/.config/nvim/lua/yock/plugins/completion.lua @@ -0,0 +1,56 @@ +return { + 'hrsh7th/nvim-cmp', + dependencies= { + 'hrsh7th/cmp-nvim-lsp', + 'hrsh7th/cmp-buffer', + 'hrsh7th/cmp-path', + 'hrsh7th/cmp-cmdline', + 'hrsh7th/cmp-emoji', + 'L3MON4D3/LuaSnip', + 'saadparwaiz1/cmp_luasnip', + 'rafamadriz/friendly-snippets', + 'PhilRunninger/cmp-rpncalc', + 'andersevenrud/cmp-tmux', + 'tamago324/cmp-zsh', + 'Dynge/gitmoji.nvim', + 'SergioRibera/cmp-dotenv', + }, + build = 'make install jsregexp', + config = function() + local cmp = require('cmp') + local luasnip = require('luasnip') + require('luasnip.loaders.from_vscode').lazy_load() + + luasnip.filetype_extend('ruby', { 'rails' }) + + cmp.setup({ + snippet = { + expand = function(args) + print('expand called') + print(args.body) + luasnip.lsp_expand(args.body) + end, + }, + 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:ruby_lsp' }, + { name = 'luasnip' }, + { name = 'buffer' }, + { name = 'path' }, + { name = 'cmdline' }, + { name = 'rpncalc' }, + { name = 'emoji' }, + { name = 'gitmoji' }, + { name = 'tmux' }, + { name = 'zsh' }, + { name = 'dotenv' }, + }) + }) + end, +} diff --git a/nvim/.config/nvim/lua/yock/plugins/dap-ui.lua b/nvim/.config/nvim/lua/yock/plugins/dap-ui.lua index 51319d5..c68b8e4 100644 --- a/nvim/.config/nvim/lua/yock/plugins/dap-ui.lua +++ b/nvim/.config/nvim/lua/yock/plugins/dap-ui.lua @@ -19,4 +19,9 @@ return { dapui.close() end end, + keys = { + { 'duo', function() require('dapui').open() end, { desc = 'Open DAP UI' } }, + { 'duc', function() require('dapui').close() end, { desc = 'Close DAP UI' } }, + { 'dut', function() require('dapui').toggle() end, { desc = 'Toggle DAP UI' } }, + }, } diff --git a/nvim/.config/nvim/lua/yock/plugins/dap.lua b/nvim/.config/nvim/lua/yock/plugins/dap.lua new file mode 100644 index 0000000..b272fa2 --- /dev/null +++ b/nvim/.config/nvim/lua/yock/plugins/dap.lua @@ -0,0 +1,10 @@ +return { + 'mfussenegger/nvim-dap', + config = function() end, + keys = { + { 'dtb', function() require('dap').toggle_breakpoint() end, { desc = 'Toggle Breakpoint' } }, + { 'dc', function() require('dap').continue() end, { desc = 'Start or continue execution' } }, + { 'dso', function() require('dap').step_over() end, { desc = 'Step over' } }, + { 'dsi', function() require('dap').step_into() end, { desc = 'Step into' } }, + } +} diff --git a/nvim/.config/nvim/lua/yock/plugins/gitmoji.lua b/nvim/.config/nvim/lua/yock/plugins/gitmoji.lua new file mode 100644 index 0000000..aaf97ce --- /dev/null +++ b/nvim/.config/nvim/lua/yock/plugins/gitmoji.lua @@ -0,0 +1,5 @@ +return { + 'Dynge/gitmoji.nvim', + opts = {}, + ft = 'gitcommit', +} diff --git a/nvim/.config/nvim/lua/yock/plugins/init.lua b/nvim/.config/nvim/lua/yock/plugins/init.lua index a425ae9..a514e85 100644 --- a/nvim/.config/nvim/lua/yock/plugins/init.lua +++ b/nvim/.config/nvim/lua/yock/plugins/init.lua @@ -4,6 +4,6 @@ return { 'f-person/git-blame.nvim', 'nvim-lua/plenary.nvim', 'mfussenegger/nvim-dap', - 'github/copilot.vim', + -- 'github/copilot.vim', { 'folke/todo-comments.nvim', dependencies = { 'nvim-lua/plenary.nvim' }, opts = {} }, } diff --git a/nvim/.config/nvim/lua/yock/plugins/lsp.lua b/nvim/.config/nvim/lua/yock/plugins/lsp.lua index 5e4c72a..fe65452 100644 --- a/nvim/.config/nvim/lua/yock/plugins/lsp.lua +++ b/nvim/.config/nvim/lua/yock/plugins/lsp.lua @@ -1,14 +1,34 @@ return { 'neovim/nvim-lspconfig', + dependencies = { + 'hrsh7th/nvim-cmp', + 'hrsh7th/cmp-nvim-lsp', + }, config = function() local lspconfig = require('lspconfig') + local capabilities = require('cmp_nvim_lsp').default_capabilities() + capabilities.textDocument.completion.completionItem.snippetSupport = true - lspconfig.tsserver.setup({}) - --lspconfig.rubocop.setup({}) - lspconfig.ruby_ls.setup({}) - lspconfig.angularls.setup({}) + lspconfig.tsserver.setup({ capabilities = capabilities }) + lspconfig.ruby_lsp.setup({ capabilities = capabilities }) + lspconfig.angularls.setup({ capabilities = capabilities }) + lspconfig.emmet_ls.setup({ + capabilities = capabilities, + filetypes = { + 'html', + 'eruby', + 'css', + 'scss', + 'sass', + 'javascript', + 'typescript', + 'javascriptreact', + 'typescriptreact' + }, + }) lspconfig.lua_ls.setup({ settings = { + capabilities = capabilities, Lua = { diagnostics = { globals = { @@ -19,10 +39,16 @@ return { } } }) + lspconfig.gopls.setup({ capabilities = capabilities }) + lspconfig.rust_analyzer.setup({ capabilities = capabilities }) vim.api.nvim_create_autocmd('LspAttach', { group = vim.api.nvim_create_augroup('UserLspConfig', {}), callback = function(ev) + local client = vim.lsp.get_client_by_id(ev.data.client_id) + if client.server_capabilities.inlayHintProvider then + vim.lsp.inlay_hint.enable(ev.buf, true) + end -- Enable completion triggered by vim.bo[ev.buf].omnifunc = 'v:lua.vim.lsp.omnifunc' diff --git a/nvim/.config/nvim/lua/yock/plugins/treesitter.lua b/nvim/.config/nvim/lua/yock/plugins/treesitter.lua index 6d5a169..696c0ae 100644 --- a/nvim/.config/nvim/lua/yock/plugins/treesitter.lua +++ b/nvim/.config/nvim/lua/yock/plugins/treesitter.lua @@ -3,7 +3,7 @@ return { build = ':TSUpdate', opts = { -- A list of parser names, or "all" (the five listed parsers should always be installed) - ensure_installed = { "lua", "ruby", "javascript", "typescript", "c" }, + ensure_installed = { 'lua', 'ruby', 'javascript', 'typescript', 'c', 'css', 'scss', 'go', 'rust' }, -- Install parsers synchronously (only applied to `ensure_installed`) sync_install = false, diff --git a/nvim/.config/nvim/lua/yock/remap.lua b/nvim/.config/nvim/lua/yock/remap.lua index 179cde7..28fbaa4 100644 --- a/nvim/.config/nvim/lua/yock/remap.lua +++ b/nvim/.config/nvim/lua/yock/remap.lua @@ -19,15 +19,3 @@ vim.keymap.set('n', 'do', vim.diagnostic.open_float, { desc = 'Open diag -- Undotree vim.keymap.set("n", "u", vim.cmd.UndotreeToggle) - --- DAP -vim.keymap.set('n', 'dtb', function() require('dap').toggle_breakpoint() end) -vim.keymap.set('n', 'dc', function() require('dap').continue() end) -vim.keymap.set('n', 'dso', function() require('dap').step_over() end) -vim.keymap.set('n', 'dsi', function() require('dap').step_into() end) -vim.keymap.set('n', 'duo', function() require('dapui').open() end) -vim.keymap.set('n', 'duc', function() require('dapui').close() end) -vim.keymap.set('n', 'dut', function() require('dapui').toggle() end) - --- Cloak -vim.keymap.set('n', 'ct', function() require('cloak').toggle() end, { desc = 'Toggle cloak' }) diff --git a/zsh/.gitignore b/zsh/.gitignore index e256a05..afcf846 100644 --- a/zsh/.gitignore +++ b/zsh/.gitignore @@ -1 +1,2 @@ dot-env +dot-zshenv diff --git a/zsh/dot-zshrc b/zsh/dot-zshrc index 508141c..e0e3d4a 100644 --- a/zsh/dot-zshrc +++ b/zsh/dot-zshrc @@ -27,7 +27,7 @@ export TERM="xterm-256color" export GPG_TTY=$(tty) export EDITOR="code -nw" export RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl@1.1)" -export PATH="$(npm -g bin):/usr/local/sbin:$PATH" +export PATH="$HOME/go/bin:$(npm -g bin):/usr/local/sbin:$PATH" for file in $HOME/.functions/*.zsh; do source $file