Earlier quoted context omitted.
My biggest complaint about the fish shell is the lack of true vi mode. They attempt to emulate it and it works to some degree, but it's no comparison to readline's implementation.
Have you tried a recent version? An issue I opened about this years ago was finally closed, they claim it’s fixed now. I haven’t tried the purported fix, though.
Shell Tricks That Make Life Easier (and Save Your Sanity)
151–160 of 287 posts
Re: Shell Tricks That Make Life Easier (and Save Your Sanity)
#152What confuses me is that Ctrl+Y "yank" means the opposite of what it means in Vim. Certainly does not help with keeping my sanity.
Are you yanking into your kill ring or yanking out of your kill ring? I had trouble with yanking and killing until I realized the complement to yanking, killing, only makes sense in the into-the-kill-ring" direction, so yanking must be out of the kill ring.
When I use vim, which I don't think has a kill ring but registers, I think I am yanking into a register and then pasting from a register later.
So, just ask yourself this: "are you using a kill ring or register to store your text?" and the answer becomes clear.
Re: Shell Tricks That Make Life Easier (and Save Your Sanity)
#153Earlier quoted context omitted.
> assuming some comfort with emacs is presumably OK in a manual for the software! How do you get familiar with the software, if the manual expects you to be an expert in it already?
Not sure if it did at the time, but today emacs comes with a tutorial. You’re not expected to learn it by starting on page 1 of the manual.
Re: Shell Tricks That Make Life Easier (and Save Your Sanity)
#154One 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
Re: Shell Tricks That Make Life Easier (and Save Your Sanity)
#155Earlier quoted context omitted.
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.
> This weird command is presented with such a benevolent innocence as if it's the simplest thing in the world. I think it's a question of context and familiarity. To a vim user, like me and, I assume, ahmedfromtunis, their examples do indeed seem simple and natural. Presumably, to an emacs user, the example you quote (if it's quoted literally—I don't use emacs and can't even tell) is just as natural, and assuming som…
Re: Shell Tricks That Make Life Easier (and Save Your Sanity)
#156One 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
Heh. I've done this since forever, but I use PgUp and PgDn so I can retain the original meaning of the up arrow key.
Re: Shell Tricks That Make Life Easier (and Save Your Sanity)
#157 # it's in my PATH but can't remember where
which myscript
vi `!!`Re: Shell Tricks That Make Life Easier (and Save Your Sanity)
#158 dcd() {
# If no argument is given, do nothing
[ -z "$1" ] && return
# Find the first matching directory under the current directory
local dir
dir=$(find . -type d -path "*$1*" -print -quit 2>/dev/null)
# If a directory was found, cd into it
[ -n "$dir" ] && cd "$dir"
}
I thought this would be way too slow for actual use, but I've come to love it.Re: Shell Tricks That Make Life Easier (and Save Your Sanity)
#159My header on top of every script #!/usr/bin/env bash set -eEuo pipefail # shellcheck disable=SC2034 DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" #######################################################
Re: Shell Tricks That Make Life Easier (and Save Your Sanity)
#160Earlier quoted context omitted.
From the atuin.sh website > Sync your shell history to all of your machines I think of my shell history as very machine specific. Can you give some insights on how you benefit from history sync? If you use it.
Same, I find shared history not very useful. However what I do find useful is eternal history. It's doable with some .bashrc hacks, and slow because it's file based on every command, but: - never delete history - associate history with a session token - set separate tokens in each screen, tmux, whatever session - sort such that backward search (ctrl-R) hits current session history first, and the rest second Like half…