Hacker News new | ask | show | jobs
Show HN: Goto – A Linux shell 'cd' replacement tool (github.com)
26 points by ankitvad 4153 days ago
11 comments

If you prefer something automatic that will learn from your own usage, have a look at https://github.com/clvv/fasd
I cannot recommend fasd enough.

If I want to end up in one of my folders, say my "pictures of dogs" folder, I'd just type "z dogs" into my shell and be there because it's part of the path and I visit it frequently.

If I want to work on that ruby script I was writing, I can just type "vim `f backup.rb`", or even just "vim `f back`".

If I know I have many folders that might fit the criterion (e.g. one of my many folders that end in .git/), I can just type "z -i .git" and pick from the frecent list... it's usually near the top because fasd is just magic like that.

I HIGHLY recommend that tool.

For your vim use case, I have v aliased to "f -e vim" so I can just say "v back".

fasd is incredibly useful. Along with l aliased to "ls", it is the first thing I miss on foreign servers.

Awesome, looks like it's time for me to replace autojump
See also https://github.com/twerth/bashmarks

Edit: what I'm actually using is https://github.com/huyng/bashmarks The original link is what I googled on my phone before being able to check it on the computer.

The problem with this is that it saves all the attribute as functions and messes up the .bashrc file. Eg: to save I use: goto -s <shortcut> while this program uses: s <shortcut> Mine is a little minimal, also, the shortcut thing is just an added feature. I just wanted to replicate the Sublime Texts, fuzzy search feature. I don't think bashmarks has fuzzy-find ??
bashmarks don't have fuzzy search but they have completion. g <tab> and I can see the 12 bashmarks I defined. No need to list them. Does goto has completion on bookmark names? That's a killer feature.

Anyway I'll give goto a try because goto a_file_name could also be a killer feature. But a short name is also a good thing. I think I'll rename goto to some single letter, maybe t. I hope you don't mind.

Be my guest, just open install.sh or your .bashrc and change alias. im using goto for ". goto" you can use: "a/b/c/d..whatever" for ". goto". Cheers :)
I can tell it's not going to be as good - because you know.. 4 letters vs 2.

Jokes aside I don't think this provides anything over zsh or fish or another shell that supports directory and tab completion?

When i said minimal, i meant WRT the .bashrc file. I didn't want extra stuff and functions there. Also, this is just cd with a glorified jumping feature. Like i said, it's a better form of 'cd'. You can't compare it to zsh/fish or other shells!!!
None of what you just said makes any sense. 'cd' isn't something unique to bash; indeed, a quick glance at the project didn't reveal that it's just trying to fix a deficiency in bash (although I did suspect it). 'cd' isn't broken; bash is. So you can absolutely compare this to zsh and fish, and the conclusion is that it's redundant and inferior to the built-in tools of those shells, which, incidentally, support all of the "features" of goto not only for cd but for any command (assuming, for zsh, just a few settings have been toggled to bring it out of brain-dead/bash- compatibility mode).
Hey. I think you know more, A-LOT more than me about shells and stuff. I use a normal out-of-the-box BASH shell. I don't find any deficiency in 'cd'. None, whatsoever. "Goto" just adds a couple of more features on top of it. That's it. I wanted to replicate Sublime Texts fuzzy-finder, I added a bookmark/shortcut thingy just for the sake of it(..you know more features. ) It helps me traverse between directories and that's that, dude.. Dunno about zsh, fish etc etc. No idea about auto-completes. I made it. Found it useful, wanted people to review it. It was fun, got to learn some more stuff. That's that. Sorry, If you didn't like it.
I use Bashmarks for a few years already ( https://github.com/huyng/bashmarks ). Does this have any advantage, or is it just another NIH thing?

Also - if the purpose is to save as much typing as possible, why it isnt a bit shorter command than 'goto'? .)

It has a fuzzy file finder present, that makes it easier to look for files inside the working directory. Also, "goto" worked for me, and hence i use that. i have a wide variety of .deb packages installed and they were contradicting the "g" tag. If you like something else, just modify your .bashrc alias or open install.sh and modify the alias value being written there. That is a minute difference.

Also, another difference between bashmark and this is that it uses all functionalities as an extension to goto. ie. to save you write" goto -s <shortcut> " instead of "s <shortcut>" this is again done to simplify the .bashrc and remove g/s/l/p functions from being created. Gives me greater control.

As I work on quite a big directory tree, where most of the repos are in just a few parent directories, I like using the CDPATH variable that is present in at least (oh-my-)zsh and bash(-completion) (IIRC).

That would auto-update when new directories / repos are added later - maybe a useful addition to your tool?

This looks cool. I’m going to give it a “check” on my Mac.

EDIT: Appears to be working peachy on OS X 10.10.2 with zsh.

Thanks for the MAC test :) I was worried about the privilege problems it may run into.. you know, accessing stuff without sudo/su in Ubuntu/MAC is a nightmare.
No problem. However, I usually use z - https://github.com/rupa/z to jump around, but I like the shortcuts concept of goto.
Have a look at Fish shell for some inspiration.
No man page! No Unix badge for you.
https://github.com/ankitvad/goto -> Addded 'man' page support.
Yeah, i've just added it in goto -help||-h||h, i'll be creating a page soon. Later today, maybe. Thanks, for reminding. :)
Contains directory shortcut Bookmarking and a Fuzzy File finder. Unchecked on a MAC.
Working good an Arch, nice 'n' easy.
this is what i need. i actually tried to google for this yesterday and couldnt find it. :D