AutoYADM commit: 2025-03-28 18:45:08
This commit is contained in:
parent
393973db39
commit
4606237776
78 changed files with 2856 additions and 1 deletions
20
.config/fish/functions/_autopair_insert_same.fish
Normal file
20
.config/fish/functions/_autopair_insert_same.fish
Normal file
|
@ -0,0 +1,20 @@
|
|||
function _autopair_insert_same --argument-names key
|
||||
set --local buffer (commandline)
|
||||
set --local index (commandline --cursor)
|
||||
set --local next (string sub --start=(math $index + 1) --length=1 -- "$buffer")
|
||||
|
||||
if test (math (count (string match --all --regex -- "$key" "$buffer")) % 2) = 0
|
||||
test $key = $next && commandline --cursor (math $index + 1) && return
|
||||
|
||||
commandline --insert -- $key
|
||||
|
||||
if test $index -lt 1 ||
|
||||
contains -- (string sub --start=$index --length=1 -- "$buffer") "" " " $autopair_left &&
|
||||
contains -- $next "" " " $autopair_right
|
||||
commandline --insert -- $key
|
||||
commandline --cursor (math $index + 1)
|
||||
end
|
||||
else
|
||||
commandline --insert -- $key
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue