aboutsummaryrefslogtreecommitdiffhomepage
path: root/.config/nvim/lua/vimrc
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2024-08-07 01:07:36 +0900
committernsfisis <nsfisis@gmail.com>2024-08-07 01:07:36 +0900
commitdd61c58f42d089dbf47eb88b9a555d9b31e7cd64 (patch)
tree0e6dc850c2daafc912c455361c7da36593115948 /.config/nvim/lua/vimrc
parent33ed3e47b00babbbda6983653398e16f5f6c6e09 (diff)
downloaddotfiles-dd61c58f42d089dbf47eb88b9a555d9b31e7cd64.tar.gz
dotfiles-dd61c58f42d089dbf47eb88b9a555d9b31e7cd64.tar.zst
dotfiles-dd61c58f42d089dbf47eb88b9a555d9b31e7cd64.zip
nvim/hop: migrate hop.nvim repo
Diffstat (limited to '.config/nvim/lua/vimrc')
-rw-r--r--.config/nvim/lua/vimrc/plugins.lua49
1 files changed, 11 insertions, 38 deletions
diff --git a/.config/nvim/lua/vimrc/plugins.lua b/.config/nvim/lua/vimrc/plugins.lua
index 5ff13d0..b4cd1ef 100644
--- a/.config/nvim/lua/vimrc/plugins.lua
+++ b/.config/nvim/lua/vimrc/plugins.lua
@@ -406,8 +406,7 @@ return {
},
-- Neovim clone of EasyMotion
{
- 'phaazon/hop.nvim',
- branch = 'v2', -- Hop.nvim's README recommends this.
+ 'smoka7/hop.nvim',
lazy = true,
keys = {
{'f', '<Plug>(hop-f)', mode = {'n', 'o', 'x'}},
@@ -425,52 +424,26 @@ return {
{'sk', '<Plug>(hop-k)', mode = {'n', 'o', 'x'}},
},
config = function()
- require('hop').setup {
+ local hop = require('hop')
+ hop.setup {
keys = 'asdfghweryuiocvbnmjkl;',
}
-
- -- Emulate `g:EasyMotion_startofline = 0` in hop.nvim.
- local function hop_jk(opts)
- local hop = require('hop')
- local jump_target = require('hop.jump_target')
-
- local column = vim.fn.col('.')
- local match
- if column == 1 then
- match = function(_)
- return 0, 1, false
- end
- else
- local pat = vim.regex('\\%' .. column .. 'c')
- match = function(s)
- return pat:match_str(s)
- end
- end
- setmetatable(opts, { __index = hop.opts })
- hop.hint_with(
- jump_target.jump_targets_by_scanning_lines({
- oneshot = true,
- match = match,
- }),
- opts
- )
- end
-
- local hop = require('hop')
local HintDirection = require('hop.hint').HintDirection
local AFTER_CURSOR = HintDirection.AFTER_CURSOR
local BEFORE_CURSOR = HintDirection.BEFORE_CURSOR
- vim.keymap.set('', '<Plug>(hop-f)', function() hop.hint_char1({ direction = AFTER_CURSOR, current_line_only = true }) end, { silent = true })
+ vim.keymap.set('', '<Plug>(hop-f)', function() hop.hint_char1({ direction = AFTER_CURSOR, current_line_only = true }) end, { silent = true })
vim.keymap.set('', '<Plug>(hop-F)', function() hop.hint_char1({ direction = BEFORE_CURSOR, current_line_only = true }) end, { silent = true })
- vim.keymap.set('', '<Plug>(hop-t)', function() hop.hint_char1({ direction = AFTER_CURSOR, current_line_only = true, hint_offset = -1 }) end, { silent = true })
- vim.keymap.set('', '<Plug>(hop-T)', function() hop.hint_char1({ direction = BEFORE_CURSOR, current_line_only = true, hint_offset = 1 }) end, { silent = true })
+ vim.keymap.set('', '<Plug>(hop-t)', function() hop.hint_char1({ direction = AFTER_CURSOR, current_line_only = true, hint_offset = -1 }) end, { silent = true })
+ vim.keymap.set('', '<Plug>(hop-T)', function() hop.hint_char1({ direction = BEFORE_CURSOR, current_line_only = true, hint_offset = 1 }) end, { silent = true })
vim.keymap.set('', '<Plug>(hop-s2)', function() hop.hint_char2() end, { silent = true })
- vim.keymap.set('', '<Plug>(hop-n)', function() hop.hint_patterns({ direction = AFTER_CURSOR }, vim.fn.getreg('/')) end, { silent = true })
+
+ vim.keymap.set('', '<Plug>(hop-n)', function() hop.hint_patterns({ direction = AFTER_CURSOR }, vim.fn.getreg('/')) end, { silent = true })
vim.keymap.set('', '<Plug>(hop-N)', function() hop.hint_patterns({ direction = BEFORE_CURSOR }, vim.fn.getreg('/')) end, { silent = true })
- vim.keymap.set('', '<Plug>(hop-j)', function() hop_jk({ direction = AFTER_CURSOR }) end, { silent = true })
- vim.keymap.set('', '<Plug>(hop-k)', function() hop_jk({ direction = BEFORE_CURSOR }) end, { silent = true })
+
+ vim.keymap.set('', '<Plug>(hop-j)', function() hop.hint_vertical({ direction = AFTER_CURSOR }) end, { silent = true })
+ vim.keymap.set('', '<Plug>(hop-k)', function() hop.hint_vertical({ direction = BEFORE_CURSOR }) end, { silent = true })
end,
},
-- Extend J.