radix/files/fish/functions/fish_custom_functions.fish

62 lines
1.4 KiB
Fish
Raw Normal View History

function code-projects
string replace '@' '~/projects/code/' $argv[1]
end
function git-root
set -l result (git root 2>/dev/null) && \
echo $result || echo ""
end
2023-10-08 17:30:14 +00:00
function bookmarks
$EDITOR (string replace ':' '~/resources/bookmarks/' $argv[1])
end
function xdg-user-directory
switch (string replace '@' '' $argv[1])
case "desktop"
echo $XDG_DESKTOP_DIR
case "documents"
echo $XDG_DOCUMENTS_DIR
case "downloads"
echo $XDG_DOWNLOAD_DIR
case "music"
echo $XDG_MUSIC_DIR
case "pictures"
echo $XDG_PICTURES_DIR
case "public"
echo $XDG_PUBLICSHARE_DIR
case "templates"
echo $XDG_TEMPLATES_DIR
case "videos"
echo $XDG_VIDEOS_DIR
end
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
function edit-home
echo "~/projects/code/scm/radix/ && $EDITOR home-environments/$(whoami).scm"
2023-10-29 18:17:51 +00:00
end
function edit-system
echo "~/projects/code/scm/radix/ && $EDITOR operating-systems/$(hostname).scm"
2023-10-29 18:17:51 +00:00
end