50 lines
1.1 KiB
Fish
50 lines
1.1 KiB
Fish
function code-projects
|
|
string replace '@' '~/projects/code/' $argv[1]
|
|
end
|
|
|
|
function bookmarks
|
|
$EDITOR (string replace ':' '~/resources/bookmarks/' $argv[1])
|
|
end
|
|
|
|
function xdg-base-directory
|
|
function aux
|
|
fenv "source ~/.config/user-dirs.dirs; echo $argv[1]" 2>/dev/null
|
|
end
|
|
switch (string replace '@' '' $argv[1])
|
|
case "desktop"
|
|
aux '$XDG_DESKTOP_DIR'
|
|
case "documents"
|
|
aux '$XDG_DOCUMENTS_DIR'
|
|
case "downloads"
|
|
aux '$XDG_DOWNLOAD_DIR'
|
|
case "music"
|
|
aux '$XDG_MUSIC_DIR'
|
|
case "pictures"
|
|
aux '$XDG_PICTURES_DIR'
|
|
case "public"
|
|
aux '$XDG_PUBLICSHARE_DIR'
|
|
case "templates"
|
|
aux '$XDG_TEMPLATES_DIR'
|
|
case "videos"
|
|
aux '$XDG_VIDEOS_DIR'
|
|
end
|
|
end
|
|
|
|
function bang-bang
|
|
echo "$history[1]"
|
|
end
|
|
|
|
function bang-bang-k
|
|
set -l k (string replace '!!:' '' $argv[1])
|
|
set -l arr $history[1]
|
|
echo $arr[$k]
|
|
end
|
|
|
|
function bang-dollar
|
|
string replace -ra '.* ' '' "$history[1]"
|
|
end
|
|
|
|
function bang-star
|
|
string replace -ra ' [^ ]+$' '' "$history[1]"
|
|
end
|