From 542e6b79ad976fba2967e8fc7ea521efd06d6997 Mon Sep 17 00:00:00 2001 From: PowerUser64 Date: Wed, 17 Aug 2022 19:42:37 -0700 Subject: [PATCH 1/8] nvim: add neogen and vim-oscyank --- .config/nvim/lua/blake/plugins.lua | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/.config/nvim/lua/blake/plugins.lua b/.config/nvim/lua/blake/plugins.lua index ce0e5e4..2a077fe 100644 --- a/.config/nvim/lua/blake/plugins.lua +++ b/.config/nvim/lua/blake/plugins.lua @@ -219,6 +219,7 @@ return require('packer').startup({function() ) end, } + ---- DAP (Debug Adapter Protocol) use { -- nvim-dap: DAP support 'mfussenegger/nvim-dap', @@ -340,6 +341,17 @@ return require('packer').startup({function() }) end } + use { -- neogen: annotation generator for neovim + 'danymat/neogen', + requires = "nvim-treesitter/nvim-treesitter", + config = function() + require('neogen').setup({ + snippet_engine = "luasnip", + }) + local opts = { noremap = true, silent = true } + vim.api.nvim_set_keymap("n", "af", ":lua require('neogen').generate('func')", opts) + end + } -- Conveniences use { -- sort motion: (gs) @@ -455,6 +467,13 @@ return require('packer').startup({function() require('marks').setup() end } + use { -- oscyank: copy text to system clipboard over ssh + 'ojroques/vim-oscyank', + config = function() + -- Yanking to "+ will yank to system board + vim.cmd [[ autocmd TextYankPost * if v:event.operator is 'y' && v:event.regname is '+' | execute 'OSCYankReg +' | endif ]] + end + } use { -- rhysd: clever-split: split calculation based on pane dimensions - CS or CleverSplit 'rhysd/clever-split.vim', config = function() From 40c17ddae8fba562cc49dbb5e2e31f9e525566c2 Mon Sep 17 00:00:00 2001 From: PowerUser64 Date: Wed, 17 Aug 2022 19:43:07 -0700 Subject: [PATCH 2/8] nvim: un-remap code action back to ca --- .config/nvim/lua/blake/lsp.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/nvim/lua/blake/lsp.lua b/.config/nvim/lua/blake/lsp.lua index e3edf4c..a9cbb82 100644 --- a/.config/nvim/lua/blake/lsp.lua +++ b/.config/nvim/lua/blake/lsp.lua @@ -246,7 +246,7 @@ M.lspconfig = function() buffmap(bufnr, 'n', 'wl', 'lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))', opts) buffmap(bufnr, 'n', 'D', 'lua vim.lsp.buf.type_definition()', opts) buffmap(bufnr, 'n', 'rn', 'lua vim.lsp.buf.rename()', opts) - buffmap(bufnr, 'n', 'a', 'lua vim.lsp.buf.code_action()', opts) + buffmap(bufnr, 'n', 'ca', 'lua vim.lsp.buf.code_action()', opts) buffmap(bufnr, 'n', 'gr', 'lua require("telescope.builtin").lsp_references()', opts) -- Telescope buffmap(bufnr, 'n', 'f', 'lua vim.lsp.buf.format { async = true }', opts) buffmap(bufnr, 'n', 'so', 'lua require("telescope.builtin").lsp_document_symbols()', opts) From 2e62c7b12ee291dc80dd3c9867cd77b68227b11a Mon Sep 17 00:00:00 2001 From: PowerUser64 Date: Wed, 17 Aug 2022 22:23:48 -0700 Subject: [PATCH 3/8] nvim: considering hop.nvim --- .config/nvim/lua/blake/plugins.lua | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.config/nvim/lua/blake/plugins.lua b/.config/nvim/lua/blake/plugins.lua index 2a077fe..09a8936 100644 --- a/.config/nvim/lua/blake/plugins.lua +++ b/.config/nvim/lua/blake/plugins.lua @@ -319,9 +319,6 @@ return require('packer').startup({function() use { -- matchup: Use the percent (%) key for more things 'andymass/vim-matchup', } - -- use { -- lightspeed: Jump around in files quickly - -- 'ggandor/lightspeed.nvim', - -- } use { -- indentline: Line indent indicators 'lukas-reineke/indent-blankline.nvim', config = function() @@ -352,6 +349,12 @@ return require('packer').startup({function() vim.api.nvim_set_keymap("n", "af", ":lua require('neogen').generate('func')", opts) end } + use { -- hop.nvim: Jump around files quickly + 'phaazon/hop.nvim', + config = function() + require('hop').setup { keys = 'etovxqpdygfblzhckisuran' } + end + } -- Conveniences use { -- sort motion: (gs) From 5ef57426d7b4da98277e0b9aa55185f13939c100 Mon Sep 17 00:00:00 2001 From: PowerUser64 Date: Fri, 19 Aug 2022 01:08:55 -0700 Subject: [PATCH 4/8] nvim: add lumen and FixCursorHold --- .config/nvim/lua/blake/plugins.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.config/nvim/lua/blake/plugins.lua b/.config/nvim/lua/blake/plugins.lua index 09a8936..53875eb 100644 --- a/.config/nvim/lua/blake/plugins.lua +++ b/.config/nvim/lua/blake/plugins.lua @@ -22,7 +22,6 @@ return require('packer').startup({function() } -- Packer - -- use 'wbthomason/packer.nvim', use { -- packer: plugin manager 'wbthomason/packer.nvim', config = function() @@ -90,6 +89,9 @@ return require('packer').startup({function() use { -- ifdef-highlighting: highlight c/c++ ifdef's - :Define :Undefine 'vim-scripts/ifdef-highlighting' } + use { -- lumen: make vim respect the system light/dark theme setting (linux + macos) + 'vimpostor/vim-lumen', + } -- IDE features ---- LSP @@ -477,6 +479,9 @@ return require('packer').startup({function() vim.cmd [[ autocmd TextYankPost * if v:event.operator is 'y' && v:event.regname is '+' | execute 'OSCYankReg +' | endif ]] end } + use { -- fixcursorhold: fix neovim bug #12587 - https://github.com/neovim/neovim/issues/12587 + 'antoinemadec/FixCursorHold.nvim', + } use { -- rhysd: clever-split: split calculation based on pane dimensions - CS or CleverSplit 'rhysd/clever-split.vim', config = function() @@ -544,7 +549,6 @@ return require('packer').startup({function() 'tpope/vim-sleuth', } - -- Bootstrap packer if needed { if (packer_bootstrap) then print('Please wait for packer to install plugins') From 5d6e349a468f3acc507e32a9213457fada7ce7ab Mon Sep 17 00:00:00 2001 From: PowerUser64 Date: Fri, 19 Aug 2022 01:09:38 -0700 Subject: [PATCH 5/8] nvim: remove plugins to install list --- .config/nvim/init.lua | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index 738b07d..1fa1a7d 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -30,9 +30,3 @@ require('blake.settings') -- Downsides: -- - Hardest (requires me to make a for loop, and I don't know lua) -- - Doesn't take advantage of advanced plugin manager features (ex: dependencies) --- Plugins to install: --- lightspeed.nvim --- lightbulb? --- telescope --- - trouble.nvim - From a7b8f061958d06eab7ddde101b3cc4ce94f48fee Mon Sep 17 00:00:00 2001 From: PowerUser64 Date: Fri, 19 Aug 2022 01:09:56 -0700 Subject: [PATCH 6/8] nvim: rework completion menu -- big change I'm excited about :D --- .config/nvim/lua/blake/lsp.lua | 41 +++++++++++++++------------------- 1 file changed, 18 insertions(+), 23 deletions(-) diff --git a/.config/nvim/lua/blake/lsp.lua b/.config/nvim/lua/blake/lsp.lua index a9cbb82..3cb96e9 100644 --- a/.config/nvim/lua/blake/lsp.lua +++ b/.config/nvim/lua/blake/lsp.lua @@ -150,34 +150,32 @@ M.cmp = function() { name = 'path' }, }, formatting = { + fields = { "abbr", "kind", "menu" }, format = function(entry, vim_item) -- fancy icons and a name of kind - require('lspkind').cmp_format({ - mode = 'symbol', -- show only symbol annotations - maxwidth = 50, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters) - - -- The function below will be called before any actual modifications from lspkind - -- so that you can provide more controls on popup customization. (See [#30](https://github.com/onsails/lspkind-nvim/pull/30)) - -- before = function (entry, vim_item) - -- ... - -- return vim_item - -- end - }) + local kind = require("lspkind").cmp_format({ mode = "symbol", maxwidth = 50 })(entry, vim_item) + -- local strings = vim.split(kind.kind, "%s", { trimempty = true }) -- set a name for each source + vim_item.kind = " " .. kind.kind vim_item.menu = ({ - path = "[Path]", - nvim_lua = "[Lua]", - nvim_lsp = "[LSP]", - treesitter = "[TS]", - calc = "[Calc]", - spell = "[Spell]", - cmdline = "[cmdline]", - buffer = "[Buffer]", - })[entry.source.name] + path = "[path]", + emoji = "[emoji]", + nvim_lua = "[lua]", + nvim_lsp = "[lsp]", + treesitter = "[ts]", + calc = "[calc]", + spell = "[spell]", + cmdline = "[cmd]", + buffer = "[buf]", + luasnip = "[snip]", + })[entry.source.name] or "unknown type" return vim_item end, }, window = { + completion = { + winhighlight = "Normal:Pmenu,FloatBorder:Pmenu,Search:None", + }, documentation = { border = { "╭", "─", "╮", "│", "╯", "─", "╰", "│" }, }, @@ -186,7 +184,6 @@ M.cmp = function() ghost_text = true, } } - -- Thanks to iwataka on github for this bit local search_config = { mapping = cmp.mapping.preset.cmdline(), @@ -194,11 +191,9 @@ M.cmp = function() { name = 'buffer' }, } } - -- Use buffer source for `/` and `?` cmp.setup.cmdline('/', search_config) cmp.setup.cmdline('?', search_config) - -- `:` cmdline setup. cmp.setup.cmdline(':', { mapping = cmp.mapping.preset.cmdline(), From 932f7764b5787ad038d016bc26051a61a265cc71 Mon Sep 17 00:00:00 2001 From: PowerUser64 Date: Fri, 19 Aug 2022 13:53:02 -0700 Subject: [PATCH 7/8] shell: nvc: pass through arguments to $EDITOR --- .config/shell/bin/nvc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.config/shell/bin/nvc b/.config/shell/bin/nvc index d6869fb..920241a 100755 --- a/.config/shell/bin/nvc +++ b/.config/shell/bin/nvc @@ -1,6 +1,6 @@ #!/bin/sh # Purpose: edit nvim configuration while being cd'd into the directory that # most of the files live so they can easily be :e'd -# Usage: nvc +# Usage: nvc [$EDITOR options] cd ~/.config/nvim/lua/blake \ - && nvim ../../init.lua + && $EDITOR "$@" ../../init.lua From e20be55819870e05c0e8c712f1101a4470c26cb1 Mon Sep 17 00:00:00 2001 From: PowerUser64 Date: Fri, 19 Aug 2022 23:52:14 -0700 Subject: [PATCH 8/8] zsh: add extra newline before 'Please Wait for plugins to install' --- .zshrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.zshrc b/.zshrc index a3f6302..f12968f 100644 --- a/.zshrc +++ b/.zshrc @@ -15,7 +15,7 @@ ${SKIP_PLUGINS:-false} || { print -P "%F{33}▓▒░ %F{220}Installing %F{33}DHARMA%F{220} Initiative Plugin Manager (%F{33}zdharma-continuum/zinit%F{220})…%f" command mkdir -p "$ZINIT_HOME_DIR" && command chmod g-rwX "$ZINIT_HOME_DIR" command git clone https://github.com/zdharma-continuum/zinit "$ZINIT_HOME_DIR/bin" && \ - print -P "%F{33}▓▒░ %F{34}Installation successful.%f%b\nPlease wait while plugins install." || \ + print -P "%F{33}▓▒░ %F{34}Installation successful.%f%b\n\nPlease wait while plugins install." || \ print -P "%F{160}▓▒░ The clone has failed.%f%b" elif [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"