nvim: Switch to hop and drop sneak

This commit is contained in:
Sanchayan Maity 2021-11-14 19:20:45 +05:30
parent 6278cd24dd
commit 56842dd2a9
4 changed files with 31 additions and 20 deletions

View file

@ -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<CR>' , opts)
remap('n', 'gl', ':HopLineStart<CR>', opts)
remap('n', 'gL', ':HopLine<CR>' , opts)
remap('n', 's' , "<cmd>lua require'hop'.hint_char2()<CR>", opts)
remap('x', 's' , "<cmd>lua require'hop'.hint_char2()<CR>", opts)
remap('o', 's' , "<cmd>lua require'hop'.hint_char2()<CR>", opts)
remap('n', ',s' , "<cmd>lua require'hop'.hint_words()<CR>", opts)
remap('x', ',s' , "<cmd>lua require'hop'.hint_words()<CR>", opts)
remap('o', ',s' , "<cmd>lua require'hop'.hint_words()<CR>", opts)
remap('n', 'f', "<cmd>lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.AFTER_CURSOR, current_line_only = true})<CR>" , opts)
remap('n', 'F', "<cmd>lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.BEFORE_CURSOR, current_line_only = true})<CR>", opts)
remap('x', 'f', "<cmd>lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.AFTER_CURSOR, current_line_only = true})<CR>" , opts)
remap('x', 'F', "<cmd>lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.BEFORE_CURSOR, current_line_only = true})<CR>", opts)
remap('o', 'f', "<cmd>lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.AFTER_CURSOR, current_line_only = true})<CR>" , opts)
remap('o', 'F', "<cmd>lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.BEFORE_CURSOR, current_line_only = true})<CR>", opts)

View file

@ -1,19 +0,0 @@
local remap = vim.api.nvim_set_keymap
-- Replace 'f' with 1 character sneak
remap('n', 'f', '<Plug>Sneak_f', { noremap = false })
remap('n', 'F', '<Plug>Sneak_F', { noremap = false })
remap('x', 'f', '<Plug>Sneak_f', { noremap = false })
remap('x', 'F', '<Plug>Sneak_F', { noremap = false })
remap('o', 'f', '<Plug>Sneak_f', { noremap = false })
remap('o', 'F', '<Plug>Sneak_F', { noremap = false })
-- Replace 't' with 1 character sneak
remap('n', 't', '<Plug>Sneak_t', { noremap = false })
remap('n', 'T', '<Plug>Sneak_T', { noremap = false })
remap('x', 't', '<Plug>Sneak_t', { noremap = false })
remap('x', 'T', '<Plug>Sneak_T', { noremap = false })
remap('o', 't', '<Plug>Sneak_t', { noremap = false })
remap('o', 'T', '<Plug>Sneak_T', { noremap = false })
-- Two character sneak
remap('n', 's', '<Plug>Sneak_s', { noremap = false })
remap('n', 'S', '<Plug>Sneak_S', { noremap = false })

View file

@ -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

View file

@ -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',