-
Notifications
You must be signed in to change notification settings - Fork 2
/
reasymotion.kak
69 lines (49 loc) · 1.9 KB
/
reasymotion.kak
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
decl -hidden str _scrolloff
decl -hidden range-specs reasymotionselections
decl -hidden str reasymotion_keys
set-option global reasymotion_keys "abcdefghijklmnopqrstuvwxyz"
face global REasymotionBackground rgb:aaaaaa
face global REasymotionForeground white,red+F
def reasymotion-select-screen -params 1 %{
set-option window _scrolloff %opt{scrolloff}
set-option window scrolloff 0,0
execute-keys "gbGt%arg{1}<a-:>"
reasymotion-selection
hook window -once NormalKey .* %{
set-option window scrolloff %opt{_scrolloff}
}
hook window -once NormalIdle .* %{
set-option window scrolloff %opt{_scrolloff}
}}
# gbGt to select whole screen
def reasymotion-selection %{
add-highlighter buffer/reasymotionselections replace-ranges reasymotionselections
add-highlighter buffer/reasymotionbackground fill REasymotionBackground
evaluate-commands %sh{
# need enviroment variables
# (can't remove because otherwise kak doesn't export them so the program can't access them)
# $kak_selections_desc $kak_opt_reasymotion_keys
/home/charles/.config/zsh/bin/rkak_easymotion start
}
}
def reasymotion-line %{
reasymotion-select-screen <a-s>x
}
def reasymotion-word %{
reasymotion-select-screen s\w+<ret>
}
def reasymotion-on-letter-to-word %{
on-key %{
reasymotion-select-screen "s\b%val{key}\w*<ret>"
}
}
def reasymotion-on-letter-to-letter %{
on-key %{
reasymotion-select-screen "s%val{key}<ret>"
}
}
declare-user-mode easymotion
map global user 'e' ': enter-user-mode easymotion<ret>' -docstring 'enter easymotion mode'
map global easymotion 'e' ': reasymotion-word<ret>' -docstring 'by words'
map global easymotion 'l' ': reasymotion-on-letter-to-letter<ret>' -docstring 'by letter'
map global easymotion 'L' ': reasymotion-line<ret>' -docstring 'by Line'