Article 6D0EM Directory Bookmarker

Directory Bookmarker

by
dugan
from LinuxQuestions.org on (#6D0EM)
After over a decade of looking at directory changers and bookmarkers (zoxide, fasd, autojump, etc), I decided to just write one.

It's for FISH, because that's what I use, and it uses FZF.

You just write out your list of directory "bookmarks" in ~/.sdirs. For example:

Code:~/Videos
~/DownloadsThe following then goes in ~/.config/fish/functions/j.fish:

Code:function j
if count $argv > /dev/null
if set --local result (command cat ~/.sdirs | command fzf --select-1 --exit-0 --query $argv)
cd (echo "echo $result" | sh)
end
else
if set --local result (command cat ~/.sdirs | command fzf --select-1 --exit-0)
cd (echo "echo $result" | sh)
end
end
end
Then you just enter "j" for a menu, or, "j D" to jump to ~/Downloads.

These are what I looked at to get it done:

https://github.com/mgunyho/tere
https://stackoverflow.com/questions/...-tilde-in-bash
https://www.reddit.com/r/commandline..._exactly_what/
https://github.com/huyng/bashmarks
https://stackoverflow.com/a/29643375

If you'd rather have it for BASH or Zsh, well, that's left as an exercise for the reader.

My previous attempt:

https://gist.github.com/duganchen/40...f2957aa1764dca
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments