Something that should be mentioned is starting a command with a space doesn't add it to your history in most shells, really useful for one-off commands that you don't want cluttering your history. Also, increase your `$HISTSIZE` to more than you think you would need, there have been cases where it helped me find some obscure command I ran like 3 years before.
Also a good thing to remember if you are ever dealing with credentials:
This reminds me of an excerpt from an old Emacs manual: . . . if you forget which commands deal with windows, just type @b[ESC-?]@t[window]@b[ESC]. This weird command is presented with such a benevolent innocence as if it's the simplest thing in the world. I think the better advice for command-line editing would be to set up the mouse.
I think you're confused by the markup. It looks like it's saying Alt-? (Alt and Esc are interchangeable due to terminal reasons) to open up the help search and then type 'window' to search for window commands. Sounds pretty simple to me
Indeed, @b[] is for bold, and @t[] is for something else. The joke falls apart, and somehow a piece of my identity goes with it. But thanks for clarifying.
This reminds me of an excerpt from an old Emacs manual: . . . if you forget which commands deal with windows, just type @b[ESC-?]@t[window]@b[ESC]. This weird command is presented with such a benevolent innocence as if it's the simplest thing in the world. I think the better advice for command-line editing would be to set up the mouse.
I have yet to see a shell that has mouse enabled line editing support. It should certainly be possible though. I do prefer vi bindings at the same time though. Vi bindings and mouse support complement each other well, you don't have to choose one or the other, just use whichever feels most natural and convenient in that exact moment.
I think modern terminal emulators and readline-based shells support it.
This is not to say that there's nothing to improve. Multiline editing experience suffers, and non-readline shells aren't supported. Those problems were solved by Plan 9 (at the cost of dropping xterm compatibility), but the mainstream hasn't yet adopted those solutions.
What is it lacking in your eyes that makes it not true? I find fish’s vi mode more ergonomically complete for things like editing multi-line commands
Just pressing `xp` to swap two characters does not work in fish. Combining deletion with a movement also does not work (e.g. `d3w` to delete three words).
Just pressing `xp` to swap two characters does not work in fish. Combining deletion with a movement also does not work (e.g. `d3w` to delete three words).
these have been fixed as of 4.4.0
Awesome! That released hasn't landed yet in my distro's repos. Thanks a lot! Fish is a great product.
Do yourself a favor and upgrade your history search with fzf shell integration (or similar): https://youtu.be/u-qLj4YBry0?t=223 / https://junegunn.github.io/fzf/shell-integration/
CTRL + W usually deletes everything until the previous whitespace, so it would delete the whole '/var/log/nginx/' string in OP's example. Alt + backspace usually deletes until it encounters a non-alphanumeric character. Be careful working CTRL + W into muscle memory though, I've lost count of how many browser tabs I've closed by accident...
> Be careful working CTRL + W into muscle memory though, I've lost count of how many browser tabs I've closed by accident... I still maintain this is why macOS is the best OS for terminal work -- all the common keybindings for GUI tools use a different modifier key, so e.g. ⌘C and ⌘W work the same in your terminal as they do in your browser. (Lots of the readline/emacs-style editing keybindings work everywhere in mac…
100% agree, and I am surprised I do not see this mentioned more often. I came up on Linux and then had to use MacOS for a job and got used to the cmd / ctrl separation and now I cannot use a terminal on Linux without major pain. I've tried a few of the key rebinding options and they all feel klunky.
Maybe not a shell trick per-se but I have been a very big fan of zoxide. It can jump around your common directories. If you have a ~/workspace/projects and you are anywhere and type `cd projects` it will take you to that directory. I never realized how much I got hooked onto it, until I used a system without it.
I just type "z p" in that case and that's enough to get me there.
One thing I find life-changing is to remap the up arrow so that it does not iterates through all commands, but only those starting with the characters I have already written. So e.g. I can type `tar -`, then the up arrow, and get the tar parameters that worked last time. In zsh this is configured with bindkey "^[OA" up-line-or-beginning-search # Up bindkey "^[OB" down-line-or-beginning-search # Down
I agree it's a game changer! For bash to do the same I put this in my .inputrc: ## arrow up "\e[A":history-search-backward ## arrow down "\e[B":history-search-forward