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
39
.config/fish/conf.d/autopair.fish
Normal file
39
.config/fish/conf.d/autopair.fish
Normal file
|
@ -0,0 +1,39 @@
|
|||
status is-interactive || exit
|
||||
|
||||
set --global autopair_left "(" "[" "{" '"' "'"
|
||||
set --global autopair_right ")" "]" "}" '"' "'"
|
||||
set --global autopair_pairs "()" "[]" "{}" '""' "''"
|
||||
|
||||
function _autopair_fish_key_bindings --on-variable fish_key_bindings
|
||||
set --query fish_key_bindings[1] || return
|
||||
|
||||
test $fish_key_bindings = fish_default_key_bindings &&
|
||||
set --local mode default insert ||
|
||||
set --local mode insert default
|
||||
|
||||
bind --mode $mode[-1] --erase \177 \b \t
|
||||
|
||||
bind --mode $mode[1] \177 _autopair_backspace # macOS ⌫
|
||||
bind --mode $mode[1] \b _autopair_backspace
|
||||
bind --mode $mode[1] \t _autopair_tab
|
||||
|
||||
printf "%s\n" $autopair_pairs | while read --local left right --delimiter ""
|
||||
bind --mode $mode[-1] --erase $left $right
|
||||
if test $left = $right
|
||||
bind --mode $mode[1] $left "_autopair_insert_same \\$left"
|
||||
else
|
||||
bind --mode $mode[1] $left "_autopair_insert_left \\$left \\$right"
|
||||
bind --mode $mode[1] $right "_autopair_insert_right \\$right"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
_autopair_fish_key_bindings
|
||||
|
||||
function _autopair_uninstall --on-event autopair_uninstall
|
||||
string collect (
|
||||
bind --all | string replace --filter --regex -- "_autopair.*" --erase
|
||||
set --names | string replace --filter --regex -- "^autopair" "set --erase autopair"
|
||||
) | source
|
||||
functions --erase (functions --all | string match "_autopair_*")
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue