diff options
| author | nsfisis <nsfisis@gmail.com> | 2024-08-07 01:07:36 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2024-08-07 01:07:36 +0900 |
| commit | dd61c58f42d089dbf47eb88b9a555d9b31e7cd64 (patch) | |
| tree | 0e6dc850c2daafc912c455361c7da36593115948 | |
| parent | 33ed3e47b00babbbda6983653398e16f5f6c6e09 (diff) | |
| download | dotfiles-dd61c58f42d089dbf47eb88b9a555d9b31e7cd64.tar.gz dotfiles-dd61c58f42d089dbf47eb88b9a555d9b31e7cd64.tar.zst dotfiles-dd61c58f42d089dbf47eb88b9a555d9b31e7cd64.zip | |
nvim/hop: migrate hop.nvim repo
| -rw-r--r-- | .config/nvim/lazy-lock.json | 4 | ||||
| -rw-r--r-- | .config/nvim/lua/vimrc/plugins.lua | 49 |
2 files changed, 13 insertions, 40 deletions
diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json index 8d24996..b2d2162 100644 --- a/.config/nvim/lazy-lock.json +++ b/.config/nvim/lazy-lock.json @@ -7,7 +7,7 @@ "denops.vim": { "branch": "main", "commit": "f5bcc4fa09a303e12d4407175ef40269b293c772" }, "emmet-vim": { "branch": "master", "commit": "3fb2f63799e1922f7647ed9ff3b32154031a76ee" }, "foldCC.vim": { "branch": "master", "commit": "344335d27349b837d33dc7757de0cb7930ac33ae" }, - "hop.nvim": { "branch": "v2", "commit": "90db1b2c61b820e230599a04fedcd2679e64bd07" }, + "hop.nvim": { "branch": "master", "commit": "036462a345792279c58f2f6445756efab706f04a" }, "indent-blankline.nvim": { "branch": "master", "commit": "3fe94b8034dd5241cb882bb73847303b58857ecf" }, "lazy.nvim": { "branch": "main", "commit": "077102c5bfc578693f12377846d427f49bc50076" }, "nvim-lspconfig": { "branch": "master", "commit": "6c505d4220b521f3b0e7b645f6ce45fa914d0eed" }, @@ -49,4 +49,4 @@ "vim-textobj-user": { "branch": "master", "commit": "41a675ddbeefd6a93664a4dc52f302fe3086a933" }, "vim-window-adjuster": { "branch": "master", "commit": "3dd7dd0a5e8a479a568ff10ee3cf6b1ffca8d20c" }, "yankround.vim": { "branch": "master", "commit": "9dca96ed35b09de9fe5474de40da323d75fa3204" } -}
\ No newline at end of file +} 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. |
