init
This commit is contained in:
9
fish/functions/_autopair_backspace.fish
Normal file
9
fish/functions/_autopair_backspace.fish
Normal 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
|
13
fish/functions/_autopair_insert_left.fish
Normal file
13
fish/functions/_autopair_insert_left.fish
Normal 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
|
11
fish/functions/_autopair_insert_right.fish
Normal file
11
fish/functions/_autopair_insert_right.fish
Normal 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
|
20
fish/functions/_autopair_insert_same.fish
Normal file
20
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
|
7
fish/functions/_autopair_tab.fish
Normal file
7
fish/functions/_autopair_tab.fish
Normal 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
|
3
fish/functions/batdiff.fish
Normal file
3
fish/functions/batdiff.fish
Normal 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
3
fish/functions/cat.fish
Normal file
@@ -0,0 +1,3 @@
|
||||
function cat --wraps=bat --description 'alias cat=bat'
|
||||
bat $argv;
|
||||
end
|
3
fish/functions/cpr.fish
Normal file
3
fish/functions/cpr.fish
Normal 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
3
fish/functions/du.fish
Normal file
@@ -0,0 +1,3 @@
|
||||
function du --wraps='dust -bs' --description 'alias du=dust -bs'
|
||||
dust -bs $argv;
|
||||
end
|
3
fish/functions/egrep.fish
Normal file
3
fish/functions/egrep.fish
Normal file
@@ -0,0 +1,3 @@
|
||||
function egrep --description 'alias egrep=egrep --color=auto'
|
||||
command egrep --color=auto $argv;
|
||||
end
|
3
fish/functions/fgrep.fish
Normal file
3
fish/functions/fgrep.fish
Normal file
@@ -0,0 +1,3 @@
|
||||
function fgrep --description 'alias fgrep=fgrep --color=auto'
|
||||
command fgrep --color=auto $argv;
|
||||
end
|
3
fish/functions/get_open_ports.fish
Normal file
3
fish/functions/get_open_ports.fish
Normal 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
3
fish/functions/grep.fish
Normal 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
3
fish/functions/la.fish
Normal 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
3
fish/functions/lg.fish
Normal 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
3
fish/functions/ll.fish
Normal 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
3
fish/functions/ls.fish
Normal 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
3
fish/functions/mvr.fish
Normal file
@@ -0,0 +1,3 @@
|
||||
function mvr
|
||||
rsync --archive -hh --partial --info=stats1,progress2 --modify-window=1 --remove-source-files $argv
|
||||
end
|
Reference in New Issue
Block a user