nvim-cmp-buffer-lines icon indicating copy to clipboard operation
nvim-cmp-buffer-lines copied to clipboard

[Function request] Automatic escape of pattern characters in lines on selection

Open yyy33 opened this issue 3 years ago • 2 comments
trafficstars

For example, if I want to search for line 115 in the document, I should use very nomagic \V[system="Linux" class="Alacritty" modifier="(AltLeft ShiftLeft)"] or \[system="Linux" class="Alacritty" modifier="(AltLeft ShiftLeft)"] Instead of [system="Linux" class="Alacritty" modifier="(AltLeft ShiftLeft)"]

#TODO 支持向进程的标准输入发送字符串,比如向终端发送字符串【ctrl-shift-c】,
#然后在vim中就可以映射: map 《c-s-c》 key/command
#查看键码的网站
#https://www.toptal.com/developers/keycode/for/a

#F系列键的终端ascii转义序列
KF1 = Escape Shift{O} Shift{P}
KF2 = Escape Shift{O} Shift{Q}
KF3 = Escape Shift{O} Shift{R}
KF4 = Escape Shift{O} Shift{S}
KF5 = Escape BracketLeft 1 5 Shift{Backquote}
KF6 = Escape BracketLeft 1 7 Shift{Backquote}
KF7 = Escape BracketLeft 1 8 Shift{Backquote}
KF8 = Escape BracketLeft 1 9 Shift{Backquote}
KF9 = Escape BracketLeft 2 0 Shift{Backquote}
KF10 = Escape BracketLeft 2 1 Shift{Backquote}
KF11 = Escape BracketLeft 2 3 Shift{Backquote}
KF12 = Escape BracketLeft 2 4 Shift{Backquote}
KF13 = Escape BracketLeft 1 Semicolon 2 Shift{P}
KF14 = Escape BracketLeft 1 Semicolon 2 Shift{Q}
KF15 = Escape BracketLeft 1 Semicolon 2 Shift{R}
KF16 = Escape BracketLeft 1 Semicolon 2 Shift{S}
KF17 = Escape BracketLeft 1 5 Semicolon 2 Shift{Backquote}
KF18 = Escape BracketLeft 1 7 Semicolon 2 Shift{Backquote}
KF19 = Escape BracketLeft 1 8 Semicolon 2 Shift{Backquote}
KF20 = Escape BracketLeft 1 9 Semicolon 2 Shift{Backquote}
KF21 = Escape BracketLeft 2 0 Semicolon 2 Shift{Backquote}
KF22 = Escape BracketLeft 2 1 Semicolon 2 Shift{Backquote}
KF23 = Escape BracketLeft 2 3 Semicolon 2 Shift{Backquote}
KF24 = Escape BracketLeft 2 4 Semicolon 2 Shift{Backquote}
KF25 = Escape BracketLeft 1 Semicolon 5 Shift{P}
KF26 = Escape BracketLeft 1 Semicolon 5 Shift{Q}
KF27 = Escape BracketLeft 1 Semicolon 5 Shift{R}
KF28 = Escape BracketLeft 1 Semicolon 5 Shift{S}
KF29 = Escape BracketLeft 1 5 Semicolon 5 Shift{Backquote}
KF30 = Escape BracketLeft 1 7 Semicolon 5 Shift{Backquote}
KF31 = Escape BracketLeft 1 8 Semicolon 5 Shift{Backquote}
KF32 = Escape BracketLeft 1 9 Semicolon 5 Shift{Backquote}
KF33 = Escape BracketLeft 2 0 Semicolon 5 Shift{Backquote}
KF34 = Escape BracketLeft 2 1 Semicolon 5 Shift{Backquote}
KF35 = Escape BracketLeft 2 3 Semicolon 5 Shift{Backquote}
KF36 = Escape BracketLeft 2 4 Semicolon 5 Shift{Backquote}
KF37 = Escape BracketLeft 1 Semicolon 6 Shift{P}
KF38 = Escape BracketLeft 1 Semicolon 6 Shift{Q}
KF39 = Escape BracketLeft 1 Semicolon 6 Shift{R}
KF40 = Escape BracketLeft 1 Semicolon 6 Shift{S}
KF41 = Escape BracketLeft 1 5 Semicolon 6 Shift{Backquote}
KF42 = Escape BracketLeft 1 7 Semicolon 6 Shift{Backquote}
KF43 = Escape BracketLeft 1 8 Semicolon 6 Shift{Backquote}
KF44 = Escape BracketLeft 1 9 Semicolon 6 Shift{Backquote}
KF45 = Escape BracketLeft 2 0 Semicolon 6 Shift{Backquote}
KF46 = Escape BracketLeft 2 1 Semicolon 6 Shift{Backquote}
KF47 = Escape BracketLeft 2 3 Semicolon 6 Shift{Backquote}
KF48 = Escape BracketLeft 2 4 Semicolon 6 Shift{Backquote}
KF49 = Escape BracketLeft 1 Semicolon 3 Shift{P}
KF50 = Escape BracketLeft 1 Semicolon 3 Shift{Q}
KF51 = Escape BracketLeft 1 Semicolon 3 Shift{R}
KF52 = Escape BracketLeft 1 Semicolon 3 Shift{S}
KF53 = Escape BracketLeft 1 5 Semicolon 3 Shift{Backquote}
KF54 = Escape BracketLeft 1 7 Semicolon 3 Shift{Backquote}
KF55 = Escape BracketLeft 1 8 Semicolon 3 Shift{Backquote}
KF56 = Escape BracketLeft 1 9 Semicolon 3 Shift{Backquote}
KF57 = Escape BracketLeft 2 0 Semicolon 3 Shift{Backquote}
KF58 = Escape BracketLeft 2 1 Semicolon 3 Shift{Backquote}
KF59 = Escape BracketLeft 2 3 Semicolon 3 Shift{Backquote}
KF60 = Escape BracketLeft 2 4 Semicolon 3 Shift{Shift{Backquote}}
KF61 = Escape BracketLeft 1 Semicolon 4 Shift{P}
KF62 = Escape BracketLeft 1 Semicolon 4 Shift{Q}
KF63 = Escape BracketLeft 1 Semicolon 4 Shift{R}

[system="Linux" class="Alacritty" modifier="(MetaLeft ShiftLeft)"]
H >> KF63
J >> KF62
K >> KF61
L >> KF60
Equal >> KF59
Minus >> KF58
Enter >> KF57
Period >> KF56

[system="Linux" class="Alacritty" modifier="MetaLeft"]
H >> KF55
J >> KF54
K >> KF53
L >> KF52
U >> KF51
Equal >> KF50
Minus >> KF49
0 >> KF48
Enter >> KF47
Period >> KF46
O >> KF45

[system="Linux" class="Alacritty" modifier="(ControlLeft ShiftLeft)"]
Semicolon >> KF44
Comma >> KF43
Period >> KF42

[system="Linux" class="Alacritty"]
(ControlLeft ShiftLeft){Any} >> (ControlLeft ShiftLeft){Any}
(ControlLeft ShiftRight){Any} >> (ControlLeft ShiftRight){Any}
#BUG 下面映射理论上可以替代上面的两条映射,但是不起作用
#(ControlLeft Any){Any} >> (ControlLeft Any){Any}

[system="Linux" class="Alacritty" modifier="ControlLeft"]
Semicolon >> KF41
Comma >> KF40
Enter >> KF39
Period >> KF38
BracketLeft >> KF37
Quote >> KF36
Space >> KF35
Any >> ControlLeft{Any}

[system="Linux" class="Alacritty" modifier="(AltLeft ShiftLeft)"]
Semicolon >> KF34
Comma >> KF33

[system="Linux" class="Alacritty"]
(AltLeft ShiftLeft){Any} >> (AltLeft ShiftLeft){Any}
(AltLeft ShiftRight){Any} >> (AltLeft ShiftRight){Any}

[system="Linux" class="Alacritty" modifier="(AltLeft Backquote)"]
Enter >> KF32
Space >> KF31
#J >> KF30

[system="Linux" class="Alacritty" modifier="(AltLeft CapsLock)"]
J >> KF9
K >> KF8

[system="Linux" class="Alacritty" modifier="CapsLock"]
P >> KF7
J >> KF6
K >> KF5
N >> KF4

[system="Linux" class="Alacritty" modifier="AltLeft"]
Semicolon >> KF29
Comma >> KF28
Enter >> KF27
Period >> KF26
Quote >> KF25
Space >> KF24
Any >> AltLeft{Any}

[system="Linux" class="Alacritty" modifier="Backquote"]
Enter >> KF23
Space >> KF22
J >> KF21
K >> KF20
L >> KF19
U >> KF18
Period >> KF17
R >> KF16
V >> KF15
O >> KF14

#BUG 在中文输入法下shiftleft+, shiftleft+. 有问题
[system="Linux" class="Alacritty" modifier="ShiftLeft"]
# Enter >> KF13
Space >> KF12
Any >> ShiftLeft{Any}

[system="Linux" class="Alacritty"]
#TODO 实现类似xcape的效果,在按住超过500ms后就不发送了
ControlLeft >> KF11
AltLeft >> KF10

#warpd
[system="Linux" modifier="CapsLock"]
H >> (AltLeft MetaLeft){C}
J >> (AltLeft MetaLeft){C}
K >> (AltLeft MetaLeft){C}
L >> (AltLeft MetaLeft){C}
N >> (AltLeft MetaLeft){C}
P >> (AltLeft MetaLeft){C}
M >> (AltLeft MetaLeft){X}
O >> (AltLeft MetaLeft){L}
Semicolon >> (AltLeft MetaLeft){H}
I >> (AltLeft MetaLeft){S}

[default]
CapsLock{Space} >> CapsLock
CapsLock >> Escape
Escape >> CapsLock
Space{Any} >> MetaLeft{Any}
(Space ShiftLeft){Any} >> (MetaLeft ShiftLeft){Any}

yyy33 avatar Nov 14 '22 01:11 yyy33

This might be difficult to implement, and I don't know if it is possible, but I will do my best. Thanks for the feature request.

amarz45 avatar Nov 14 '22 15:11 amarz45

This might be difficult to implement, and I don't know if it is possible, but I will do my best. Thanks for the feature request.

Yes, I think it might not be so difficult to add \V in front of the resulting line, otherwise we would have to escape each pattern symbol

yyy33 avatar Nov 28 '22 16:11 yyy33