Live data from Hacker News

Quickly navigate your filesystem from the command line

jeroenjanssens.com

51–60 of 148 posts

Re: Quickly navigate your filesystem from the command line

#51
Reminds me of z, which I use all the time. Anyone else use z? If you have not heard of it, get it now https://github.com/rupa/z.

z is a wonderful complement to cd. After cd into a folders with z set up, a file stores all folders navigated to sorted by frecency, then simply jump to a folder with z [foldernameregex].

Re: Quickly navigate your filesystem from the command line

#52
post #7

You might want to check out z: https://github.com/rupa/z

https://github.com/clvv/fasd I used to use z, but I've since switched to fasd. It's much like z, but also so much better. In addition to being able to do "z " you can do "f ". So, for example, if I've got a rails project I've worked on a lot recently I know its config.ru is high on frecency, so I'll just do "vim `f config`" to edit that file. If I want a file that's not so recent I can always do "vim `f -i config`" t…

Thanks for this. I've been using z and like it quite a bit, but I'm always open to ways to improve my workflow.

Re: Quickly navigate your filesystem from the command line

#53
Here is a fully functional (albeit minimal) Windows version: http://appleseedhq.net/stuff/marks-v1.zip. Tested on Windows 7 (does not require PowerShell).

GitHub: https://github.com/dictoon/marks

Edit: to install, unzip anywhere and add to your path. Then:

  C:\Windows> mark win

  C:\Windows> marks
  win => C:\Windows

  C:\Windows> cd ..

  C:\> jump win

  C:\Windows> 
Marks will be stored in a marks\ subdirectory (relatively to the mark.bat file).

Re: Quickly navigate your filesystem from the command line

#54

To have completion with bash you can use this: function _jump { local cur=${COMP_WORDS[COMP_CWORD]} local marks=$(find $MARKPATH -type l -printf "%f\n") COMPREPLY=($(compgen -W '${marks[@]}' -- "$cur")) return 0 } complete -o default -o nospace -F _jump jump Bash completion really needs better docs :-|

Hmmm, this doesn't seem to work in `zsh`. Typing `jump ` suggests everything in the current directory (folders and files).

Does anyone here know offhand how autocompletion in `zsh` works?

Re: Quickly navigate your filesystem from the command line

#55
post #42

I have a similar tool but it also manages shell environment variables, allowing you to jump around and/or switch working projects. You can check it out at: http://github.com/timtadh/swork

Without having me dig through the code, could you tell me in a few lines how it works? (not usage, but how internally you managed to handle shell environment vars, "clean after" finishing/switching, etc)

Re: Quickly navigate your filesystem from the command line

#56
post #51

Reminds me of z, which I use all the time. Anyone else use z? If you have not heard of it, get it now https://github.com/rupa/z . z is a wonderful complement to cd. After cd into a folders with z set up, a file stores all folders navigated to sorted by frecency, then simply jump to a folder with z [foldernameregex].

z is absolutely wonderful. Even my boss has become a convert, and he's been hacking unix since the 1970s, when he worked at AT&T, and is very set in his ways.

[Disclaimer: rupa's a good friend of mine]

Re: Quickly navigate your filesystem from the command line

#57

Interesting idea. I've the bash built-in "pushd" and "popd" for a long time for similar reasons, but those effectively limit you to treating the history as a stack rather than an arbitrary list.

yeah, it can be annoying that the directory stack sequence keeps changing, which means that sometimes you can't easily re-run commands from your history if you've pushd since you last ran the command

e.g., a command like "tar cfz bak.tgz ~3 ~2/subdirectory ~1" would mean something else once you've "pushd +3".

I always find it hard to undo my sequence changes to get the stack in the same order as before, so usually end up typing "dirs -v" a lot (or its alias) and renumbering my ~N references.

Post reply on HN