From 56842dd2a914b93e1b06722b445340e76f60a5e2 Mon Sep 17 00:00:00 2001 From: Sanchayan Maity Date: Sun, 14 Nov 2021 19:20:45 +0530 Subject: [PATCH] nvim: Switch to hop and drop sneak --- nvim/.config/nvim/after/plugin/hop.lua | 23 +++++++++++++++++++++++ nvim/.config/nvim/after/plugin/sneak.lua | 19 ------------------- nvim/.config/nvim/colors/yolokai.vim | 7 +++++++ nvim/.config/nvim/lua/plugins.lua | 2 +- 4 files changed, 31 insertions(+), 20 deletions(-) create mode 100644 nvim/.config/nvim/after/plugin/hop.lua delete mode 100644 nvim/.config/nvim/after/plugin/sneak.lua diff --git a/nvim/.config/nvim/after/plugin/hop.lua b/nvim/.config/nvim/after/plugin/hop.lua new file mode 100644 index 0000000..fe5d29d --- /dev/null +++ b/nvim/.config/nvim/after/plugin/hop.lua @@ -0,0 +1,23 @@ +local remap = vim.api.nvim_set_keymap +local opts = { noremap=true, silent=true, unique=true } + +require'hop'.setup { keys = 'etovxqpdygfblzhckisuran' } + +remap('n', 'g/', ':HopPattern' , opts) +remap('n', 'gl', ':HopLineStart', opts) +remap('n', 'gL', ':HopLine' , opts) + +remap('n', 's' , "lua require'hop'.hint_char2()", opts) +remap('x', 's' , "lua require'hop'.hint_char2()", opts) +remap('o', 's' , "lua require'hop'.hint_char2()", opts) + +remap('n', ',s' , "lua require'hop'.hint_words()", opts) +remap('x', ',s' , "lua require'hop'.hint_words()", opts) +remap('o', ',s' , "lua require'hop'.hint_words()", opts) + +remap('n', 'f', "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.AFTER_CURSOR, current_line_only = true})" , opts) +remap('n', 'F', "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.BEFORE_CURSOR, current_line_only = true})", opts) +remap('x', 'f', "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.AFTER_CURSOR, current_line_only = true})" , opts) +remap('x', 'F', "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.BEFORE_CURSOR, current_line_only = true})", opts) +remap('o', 'f', "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.AFTER_CURSOR, current_line_only = true})" , opts) +remap('o', 'F', "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.BEFORE_CURSOR, current_line_only = true})", opts) diff --git a/nvim/.config/nvim/after/plugin/sneak.lua b/nvim/.config/nvim/after/plugin/sneak.lua deleted file mode 100644 index 2548d88..0000000 --- a/nvim/.config/nvim/after/plugin/sneak.lua +++ /dev/null @@ -1,19 +0,0 @@ -local remap = vim.api.nvim_set_keymap - --- Replace 'f' with 1 character sneak -remap('n', 'f', 'Sneak_f', { noremap = false }) -remap('n', 'F', 'Sneak_F', { noremap = false }) -remap('x', 'f', 'Sneak_f', { noremap = false }) -remap('x', 'F', 'Sneak_F', { noremap = false }) -remap('o', 'f', 'Sneak_f', { noremap = false }) -remap('o', 'F', 'Sneak_F', { noremap = false }) --- Replace 't' with 1 character sneak -remap('n', 't', 'Sneak_t', { noremap = false }) -remap('n', 'T', 'Sneak_T', { noremap = false }) -remap('x', 't', 'Sneak_t', { noremap = false }) -remap('x', 'T', 'Sneak_T', { noremap = false }) -remap('o', 't', 'Sneak_t', { noremap = false }) -remap('o', 'T', 'Sneak_T', { noremap = false }) --- Two character sneak -remap('n', 's', 'Sneak_s', { noremap = false }) -remap('n', 'S', 'Sneak_S', { noremap = false }) diff --git a/nvim/.config/nvim/colors/yolokai.vim b/nvim/.config/nvim/colors/yolokai.vim index 11c84ff..ec31b1d 100644 --- a/nvim/.config/nvim/colors/yolokai.vim +++ b/nvim/.config/nvim/colors/yolokai.vim @@ -724,6 +724,13 @@ local highlight_groups = { CmpItemAbbrMatch = {bg=black, fg=red, style='bold' }, CmpItemAbbrMatchFuzzy = {bg=black, fg=aqua, style='bold' }, CmpItemAbbrDeprecated = {bg=black, fg=purple, style=NONE }, + + --[[ 4.4.16 Hop ]] + HopNextKey = {bg=red , fg=black , style='bold'}, + HopNextKey1 = {bg=black, fg=orange , style='bold'}, + HopNextKey2 = {bg=black, fg=purple , style='bold'}, + HopUnmatched = {bg=black, fg=lightgrey, style='bold'}, + HopCursor = {bg=black, fg=aqua , style='bold'}, } -- We do not care about terminals which do not support 256 colors diff --git a/nvim/.config/nvim/lua/plugins.lua b/nvim/.config/nvim/lua/plugins.lua index 8947daf..1177340 100644 --- a/nvim/.config/nvim/lua/plugins.lua +++ b/nvim/.config/nvim/lua/plugins.lua @@ -5,7 +5,7 @@ vim.cmd 'packadd packer.nvim' local init = function () use {'wbthomason/packer.nvim', opt = true} -- Vertical Motion - use 'justinmk/vim-sneak' + use 'phaazon/hop.nvim' -- Search use { 'junegunn/fzf',