37 ms·
Here is a little fish function I've used for years. function p set -l argc (count $argv) if test $argc -eq 0 cd ~/projects re
by betenoire 3y ago
Here is a little fish function I've used for years.
function p
set -l argc (count $argv)
if test $argc -eq 0
cd ~/projects
return
end
set -l project $argv[1]
cd ~/projects/$project
test $argc -eq 1; and return
set -l file (fzf -q (string join " " $argv[2..-1]))
test -z $file; and return
$EDITOR $file
end
Jumps to my project roots, and even opens my editor with extra args. Completion, too.
set -l commands (command ls -p ~/projects/ | grep "/" | tr '\n/' ' ')
complete -c p -f \
-n "not __fish_seen_subcommand_from $commands" \
-a $commands
Maybe someone who uses Fish will find this useful