Zsh has this out of the box. You just type the name of a directory and it will `pushd` to it. At least I think it's built-in. It could be oh-my-zsh I suppose.
It's not out of the box. It works on my omz shell, although I didn't do anything to specifically enable this since it never bothered me to type cd and I kinda hate "magic". On an out-of-the-ubuntu-box zsh, it doesn't work:
+1 for broot[1], it works so fast and can be used even to fuzzy search sub-sub-directories. I'm also bit lost on the features but the help is quite good and mostly I use it just to find a directory and enter it, which requires only one keyboard shortcut.
I'd like to get more information on what is less obvious than it was at the beginning and any hint on how to fix that. Broot's chat is always open for that.
it works a bit differently i think, but it does have a fuzzy search. if i type "cd ae[tab]" then fish will list all directories with the letters a and e in them, except when there are entries that start with "ae" then it will only show those. that is fuzzy search only comes when there are no better matches.
I built a "Control-P" feature for fish that would also be a good trigger for this tool. Basically, you activate the shortcut to run the program, then it will change the directory based on the selection, but restore your original command line after. So you can be halfway through a command before realizing you are in the wrong place. Also, can cd with one fewer keystroke. My version is at [0], but obviously modifiable for other tools like this one.
i have been looking at elvish from time to time (ever since we met in beijing :-). but i am missing two key features:
autosuggestion: type something and then suggest a command from the history that matches what i typed.
non-incremental history: if the autosuggestion is not the right one, use arrow keys to search for a better one.
fish has both.
zsh has a module for autosuggestion. but if the suggestion is wrong then i have start search and retype what i just wrote. i want to avoid having to type twice.
another feature i am looking for is renaming files in place:
instead of: 'mv oldname newname;' i want something like 'rename oldname; enter;' and now allow me to edit 'oldname' into 'newname'. very often the filenames are long and i only want to change a few characters in it. having to retype the whole filepath when using mv can lead to errors.
that's pretty much what i had in mind, but only for a single rename.
i just did a search and embarrassingly discovered imv which is part of the renameutils package which also contains qmv, a tool to batch rename lots of files by loading the list into an editor. embarrassed because qmv is my favourite tool for batch renaming, and so i have it already installed.
imv is exactly what i am looking for, for the single file rename case: "The imv ("interactive move") program, is trivial but useful when you are too lazy to type (or even complete) the name of the file to rename twice. It allows a file name to be edited in the terminal using the GNU Readline library."
so we can consider this problem solved.
back to alternative shells: i am just spoiled by fish (no the fish isn't spoiled): autosuggestion and non-incremental search like fish are a requirement for me to consider any other shell now.
btw: autosuggestion for elvish is being discussed here: https://github.com/elves/elvish/issues/322 and apparently it has some of that search feature too (from a comment): "type the beginning of a command and press Up and cycle through all the commands that start with the string I typed."
Autosuggestion is one of those features that I never bothered to implement and have learned to live without. Maybe some day :)
There's also Ctrl-R for searching through history, and unlike other shells it has a list UI (like fzf). If you've typed something and then press Ctrl-R, it gets used as the filter.
> having to retype the whole filepath when using mv can lead to errors.
If you use bash, or any readline-based command line (in emacs mode):
mv long.file.name |^W^Y^Y
results in
mv long.file.name long.file.name |
(| is the cursor).
Then, you just edit the second copy of the filename.
BTW, M-C-b/M-C-f will move by one whole "argument" (even if it contains escaped spaces).
edit: and if your filename has spaces, replace the ^W above with M-C-b C-k
Nice. I ended up using fff + a little script that pops you to where you select, but I'll see if this is more elegant.
I don't know about y'all, but my biggest problem with these things is that I'm definitely faster when I remember to use them, but I have literal decades of slow muscle memory that makes me cd/autojump all the time instead.
(Relatedly, why is Dolphin apparently the only GUI file manager trying to make a serious attempt at shell integration? This seems weird? I might be missing something?)
My reluctance to use these nice modern shell utilities stems from the fact that if I come to rely on them, I will drive myself crazy trying to use them in places where they are not available and never will be. (I routinely log into various hosts to poke around and troubleshoot.) It's more worth my time to be as efficient as I can with the tools that are included out-of-the-box with most standard Linux and *nix OSes.
(But I can see utilities like this being useful for people who only rarely have a reason to SSH into other hosts, which is most developers I suspect.)
100% this. my current activity is spread over half a dozen machines, and i create a new one for every dev project. i want to minimize the amount of setup i have to do to get things working. this is also the reason why i learned VI. because at the time emacs was not available on all the unix systems i was working on, and it wasn't easy to install.
if a tool is very good and it's available as a linux distribution package then i'll use it because i can rely on it being easy to install. but if that's not the case, more often than not it's not worth the effort.
I agree to an extent. But then again, I already rely heavily on aliases, functions, vi-mode, command history, and many other shell features, that it's painful to use a barebones shell to get any work done. So I have a small snippet I run on every new environment, to make the experience a little more enjoyable. This includes installing some required tools, copying over bash or zsh configs, the tmux config, etc. It doesn't take more than a minute, and beats struggling with the default environment.
Adding this tool wouldn't be an issue if it greatly increases my productivity.
Looks very similar to my tool, tere: https://github.com/mgunyho/tere. The main difference seems to be that I don't do any file manipulation, while walk has the option to delete files/folders. In my implementation, you don't need to type '/' for fuzzy search, just typing searches and jumps by default.
I also have a list of similar projects at the end of the README, I'll add this as well! edit: Oh I already had it in my list, the project has just been renamed from llama to walk.
This thing is amazing... does everything I want, it is perfect! Love it!
Opens in NVim, if I exit, I am back in the file manager... just brilliant.
Also exit with Esc to folder you are looking and ctrl-C to original... very cool.
"Esc Exit with cd" key binding is a bit off IMO, people usually expect Esc calcels or dismisses things not doing forward action.
considering that "Enter" is already taken, it's a hard choice i admit.
don't see the cursor under vt100 nor xterm…
accidentally hit "dd" on a directory…
unexpected "(u)ndo in 5… 4… 3…" message pop up…
muscle memory kicked in "Ctrl–C Ctrl–C Ctrl–C" but no avail.
prophetically it was walk's directory itself.
turned out the Esc key binding was the least of the issues.
39 comments
[ 0.23 ms ] story [ 281 ms ] thread"broot" also lives in this space, but is rapidly getting too complex for me to memorize without consulting the help page.
[1] https://github.com/Canop/broot
I'd like to get more information on what is less obvious than it was at the beginning and any hint on how to fix that. Broot's chat is always open for that.
(Thanks for your work on broot btw! It really is a great tool)
[1]: https://fishshell.com
[1] https://github.com/jarun/nnn
[0] https://github.com/CGamesPlay/dotfiles/blob/3560a5a92d475537...
autosuggestion: type something and then suggest a command from the history that matches what i typed.
non-incremental history: if the autosuggestion is not the right one, use arrow keys to search for a better one.
fish has both.
zsh has a module for autosuggestion. but if the suggestion is wrong then i have start search and retype what i just wrote. i want to avoid having to type twice.
another feature i am looking for is renaming files in place:
instead of: 'mv oldname newname;' i want something like 'rename oldname; enter;' and now allow me to edit 'oldname' into 'newname'. very often the filenames are long and i only want to change a few characters in it. having to retype the whole filepath when using mv can lead to errors.
https://github.com/bAndie91/tools/blob/master/user-tools/rn
and
https://github.com/bAndie91/tools/blob/master/user-tools/ren...
that's pretty much what i had in mind, but only for a single rename.
i just did a search and embarrassingly discovered imv which is part of the renameutils package which also contains qmv, a tool to batch rename lots of files by loading the list into an editor. embarrassed because qmv is my favourite tool for batch renaming, and so i have it already installed.
imv is exactly what i am looking for, for the single file rename case: "The imv ("interactive move") program, is trivial but useful when you are too lazy to type (or even complete) the name of the file to rename twice. It allows a file name to be edited in the terminal using the GNU Readline library."
so we can consider this problem solved.
back to alternative shells: i am just spoiled by fish (no the fish isn't spoiled): autosuggestion and non-incremental search like fish are a requirement for me to consider any other shell now.
btw: autosuggestion for elvish is being discussed here: https://github.com/elves/elvish/issues/322 and apparently it has some of that search feature too (from a comment): "type the beginning of a command and press Up and cycle through all the commands that start with the string I typed."
i am going to have to try that.
There's also Ctrl-R for searching through history, and unlike other shells it has a list UI (like fzf). If you've typed something and then press Ctrl-R, it gets used as the filter.
If you use bash, or any readline-based command line (in emacs mode):
results in (| is the cursor). Then, you just edit the second copy of the filename. BTW, M-C-b/M-C-f will move by one whole "argument" (even if it contains escaped spaces).edit: and if your filename has spaces, replace the ^W above with M-C-b C-k
[0] https://en.wikipedia.org/wiki/Norton_Commander
I don't know about y'all, but my biggest problem with these things is that I'm definitely faster when I remember to use them, but I have literal decades of slow muscle memory that makes me cd/autojump all the time instead.
(Relatedly, why is Dolphin apparently the only GUI file manager trying to make a serious attempt at shell integration? This seems weird? I might be missing something?)
(But I can see utilities like this being useful for people who only rarely have a reason to SSH into other hosts, which is most developers I suspect.)
if a tool is very good and it's available as a linux distribution package then i'll use it because i can rely on it being easy to install. but if that's not the case, more often than not it's not worth the effort.
Adding this tool wouldn't be an issue if it greatly increases my productivity.
I also have a list of similar projects at the end of the README, I'll add this as well! edit: Oh I already had it in my list, the project has just been renamed from llama to walk.
I am really a simple man, what can I say.