LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General > LinuxQuestions.org Member Success Stories
User Name
Password
LinuxQuestions.org Member Success Stories Just spent four hours configuring your favorite program? Just figured out a Linux problem that has been stumping you for months?
Post your Linux Success Stories here.

Notices


Reply
  Search this Thread
Old 07-15-2023, 02:06 PM   #1
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,237

Rep: Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322
Directory Bookmarker


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
~/Downloads
The 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

Last edited by dugan; 07-15-2023 at 02:19 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
UK Finance Directory,Online Finance Directory,UK Finance,Finance Directory in UK seekuk General 1 12-30-2005 04:04 AM
what is the difference between "/" root directory and "/root" directory? augustus123 Linux - General 4 11-20-2004 05:22 PM
write permissions for directory - not accidently move/deleted the directory linuxgamer Linux - Newbie 10 12-02-2003 03:04 AM
mv the contents of one directory to the parent directory warkrime Linux - Newbie 4 07-14-2003 07:03 PM
home directory under a home directory GEEXTER Linux - General 4 04-03-2003 09:17 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General > LinuxQuestions.org Member Success Stories

All times are GMT -5. The time now is 09:50 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration