radix/files/fish/functions/fish_custom_functions.fish

25 lines
571 B
Fish
Raw Normal View History

function xdg-user-directory
string replace '@' '' \
(string join '' '$XDG_' (string upper $argv[1]) '_DIR')
end
2023-10-29 18:17:51 +00:00
function bang-bang
echo "$history[1]"
end
function bang-bang-k
set -l k (string replace '!!:' '' $argv[1])
set -l arr (string replace -ra '([^\\\ ])( |\n)+' '$1\n' $history[1])
2023-10-29 18:17:51 +00:00
echo $arr[$k]
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