files: fish: Fix behavior of some custom fish functions

sioyek
Luis Guilherme Coelho 2024-01-29 21:21:07 -03:00
parent 602b1ad16c
commit fc3f29f227
No known key found for this signature in database
GPG Key ID: 1F2E76ACE3F531C8
1 changed files with 11 additions and 9 deletions

View File

@ -38,10 +38,20 @@ end
function bang-bang-k function bang-bang-k
set -l k (string replace '!!:' '' $argv[1]) set -l k (string replace '!!:' '' $argv[1])
set -l arr (string replace -ra ' ' '\n' $history[1]) set -l arr (string replace -ra '([^\\\ ])( |\n)+' '$1\n' $history[1])
echo $arr[$k] echo $arr[$k]
end end
function bang-dollar
set -l arr (string replace -ra '([^\\\ ])( |\n)+' '$1\n' $history[1])
echo $arr[-1]
end
function bang-star
set -l arr (string replace -ra '([^\\\ ])( |\n)+' '$1\n' $history[1])
echo $arr[..-2]
end
function edit-home function edit-home
echo "~/projects/code/scm/radix/ && $EDITOR home-environments/$(whoami).scm" echo "~/projects/code/scm/radix/ && $EDITOR home-environments/$(whoami).scm"
end end
@ -49,11 +59,3 @@ end
function edit-system function edit-system
echo "~/projects/code/scm/radix/ && $EDITOR operating-systems/$(hostname).scm" echo "~/projects/code/scm/radix/ && $EDITOR operating-systems/$(hostname).scm"
end end
function bang-dollar
string replace -ra '.* ' '' "$history[1]"
end
function bang-star
string replace -ra ' [^ ]+$' '' "$history[1]"
end