This commit is contained in:
2025-08-07 05:56:44 +02:00
commit b6e8123c91
141 changed files with 5097 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
function _autopair_backspace
set --local index (commandline --cursor)
set --local buffer (commandline)
test $index -ge 1 &&
contains -- (string sub --start=$index --length=2 -- "$buffer") $autopair_pairs &&
commandline --function delete-char
commandline --function backward-delete-char
end

View File

@@ -0,0 +1,13 @@
function _autopair_insert_left --argument-names left right
set --local buffer (commandline)
set --local before (commandline --cut-at-cursor)
commandline --insert -- $left
switch "$buffer"
case "$before"{," "\*,$autopair_right\*}
set --local index (commandline --cursor)
commandline --insert -- $right
commandline --cursor $index
end
end

View File

@@ -0,0 +1,11 @@
function _autopair_insert_right --argument-names key
set --local buffer (commandline)
set --local before (commandline --cut-at-cursor)
switch "$buffer"
case "$before$key"\*
commandline --cursor (math (commandline --cursor) + 1)
case \*
commandline --insert -- $key
end
end

View 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

View File

@@ -0,0 +1,7 @@
function _autopair_tab
commandline --paging-mode && down-or-search && return
string match --quiet --regex -- '\$[^\s]*"$' (commandline --current-token) &&
commandline --function delete-char
commandline --function complete
end

View File

@@ -0,0 +1,3 @@
function batdiff --description 'batdiff function'
git diff --name-only --diff-filter=d $argv | bat --diff
end

3
fish/functions/cat.fish Normal file
View File

@@ -0,0 +1,3 @@
function cat --wraps=bat --description 'alias cat=bat'
bat $argv;
end

3
fish/functions/cpr.fish Normal file
View File

@@ -0,0 +1,3 @@
function cpr
rsync --archive -hh --partial --info=stats1,progress2 --modify-window=1 $argv
end

3
fish/functions/du.fish Normal file
View File

@@ -0,0 +1,3 @@
function du --wraps='dust -bs' --description 'alias du=dust -bs'
dust -bs $argv;
end

View File

@@ -0,0 +1,3 @@
function egrep --description 'alias egrep=egrep --color=auto'
command egrep --color=auto $argv;
end

View File

@@ -0,0 +1,3 @@
function fgrep --description 'alias fgrep=fgrep --color=auto'
command fgrep --color=auto $argv;
end

View File

@@ -0,0 +1,3 @@
function get_open_ports --wraps='netstat -tunlp' --description 'alias get_open_ports=netstat -tunlp'
netstat -tunlp $argv;
end

3
fish/functions/grep.fish Normal file
View File

@@ -0,0 +1,3 @@
function grep --description 'alias grep=grep --color=auto'
command grep --color=auto $argv;
end

3
fish/functions/la.fish Normal file
View File

@@ -0,0 +1,3 @@
function la --wraps='exa -a --long --color=auto' --description 'alias la=exa -a --long --color=auto'
exa -a --long --color=auto $argv;
end

3
fish/functions/lg.fish Normal file
View File

@@ -0,0 +1,3 @@
function lg --wraps='exa --git --long' --description 'alias lg=exa --git --long'
exa --git --long $argv;
end

3
fish/functions/ll.fish Normal file
View File

@@ -0,0 +1,3 @@
function ll --wraps='exa --long --color=auto' --description 'alias ll exa --long --color=auto'
exa --long --color=auto $argv;
end

3
fish/functions/ls.fish Normal file
View File

@@ -0,0 +1,3 @@
function ls --wraps='exa --long --color=auto' --description 'alias ls=exa --long --color=auto'
exa --long --color=auto $argv;
end

3
fish/functions/mvr.fish Normal file
View File

@@ -0,0 +1,3 @@
function mvr
rsync --archive -hh --partial --info=stats1,progress2 --modify-window=1 --remove-source-files $argv
end