-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
jump.lua
88 lines (78 loc) · 2.16 KB
/
jump.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
return {
'phaazon/hop.nvim',
branch = 'v2',
highlights = function(config)
local c = config.colors
return {
HopNextKey = { fg = c.green, bg = c.black, bold = true },
HopNextKey1 = { fg = '#00dfff', bg = c.black, bold = true },
HopNextKey2 = { fg = '#2b8db3', bg = c.black },
}
end,
config = function(config)
require('hop').setup(config.move.jump)
end,
defaultConfig = {
{ 'move', 'jump' },
{
keys = 'asdghklqwertyuiopzxcvbnmfj',
quit_key = '<Esc>',
multi_windows = false,
create_hl_autocmd = false,
},
},
keymaps = function()
-- local HintDirection = require('hop.hint').HintDirection
local hop = require('hop')
local HintPosition = require('hop.hint').HintPosition
local HintDirection = require('hop.hint').HintDirection
local function genChar(char)
return function()
hop.hint_patterns({}, char)
end
end
local keymaps = {
{
'',
'fw',
function()
hop.hint_words { direction = HintDirection.AFTER_CURSOR }
end,
{ desc = 'cursor jumps to the start of word' },
},
{
'',
'fb',
function()
hop.hint_words { direction = HintDirection.BEFORE_CURSOR }
end,
{ desc = 'cursor jumps to char which user type' },
},
{
'',
'fe',
function()
hop.hint_words { hint_position = HintPosition.END }
end,
{ desc = 'cursor jumps to the end of word' },
},
{ '', 'fc', hop.hint_char1, { desc = 'cursor jumps to char which user type' } },
{ '', 'f1', hop.hint_char1, { desc = 'cursor jumps to char which user type' } },
{ '', 'f2', hop.hint_char2, { desc = 'cursor jumps to chars prefixed which user type' } },
{ '', 'fl', hop.hint_lines, { desc = 'cursor jumps to line (skip whitespace)' } },
{
'',
'fL',
hop.hint_lines_skip_whitespace,
{ desc = 'cursor jumps to line (include whitespace)' },
},
}
for _, i in pairs {
-- LuaFormatter off
',', '.', '/', '\\', '?', ';', ':', '\'', '"', '(', ')', '[', ']', '{', '}',
'~','!', '@', '#', '$', '%', '^', '&', '*', '-', '_', '+', '=',
-- LuaFormatter on
} do keymaps[#keymaps + 1] = { '', 'f' .. i, genChar(i), { desc = 'cursor jumps to ' .. i } } end
return keymaps
end,
}