upvote
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.

reply
For a bit about the language, read `3bcw` as move `b`ackward by `3` words and `c`hange the `w`ord under the cursor.

The general form of `b` is `[count]b` where

    [count] An optional number that may precede the command to multiply
            or iterate the command.  If no number is given, a count of one    
            is used, unless otherwise noted.  Note that in this manual the
            [count] is not mentioned in the description of the command,
            but only in the explanation.  This was done to make the
            commands easier to look up.  If the 'showcmd' option is on,
            the (partially) entered count is shown at the bottom of the
            window.  You can use <Del> to erase the last digit (|N<Del>|).

    b       [count] words backward.  |exclusive| motion.
https://vimdoc.sourceforge.net/htmldoc/intro.html#[count]

https://vimdoc.sourceforge.net/htmldoc/motion.html#b

For `c` it’s

    ["x]c{motion} Delete {motion} text [into register x] and start
                  insert.  When  'cpoptions' includes the 'E' flag and
                  there is no text to delete (e.g., with "cTx" when the
                  cursor is just after an 'x'), an error occurs and
                  insert mode does not start (this is Vi compatible).
                  When  'cpoptions' does not include the 'E' flag, the
                  "c" command always starts insert mode, even if there
                  is no text to delete.

    {motion} A command that moves the cursor.  These are explained in
             |motion.txt|.  Examples:
                 w           to start of next word
                 b           to begin of current word
                 4j          four lines down
                 /The<CR>    to next occurrence of "The"
https://vimdoc.sourceforge.net/htmldoc/change.html#c

https://vimdoc.sourceforge.net/htmldoc/intro.html#{motion}

reply
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.

reply
> 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 some comfort with emacs is presumably OK in a manual for the software!

reply
> 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?

reply
I got familiar with vi by reading a book that had the main vi commands listed out. First learnt how to quit without saving changes, the rest was just practice.
reply
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.
reply
Why not? I expect to learn how to use a software by reading its manual.
reply
Surely you can still do that, but starting with the tutorial will be easier and more efficient.
reply
By reading introductory material.
reply
The example confusingly includes some weird markup. It's just saying press `ESC-?` then type "window" to search for window commands. These isn't even valid in modern Emacs. The equivalent is `C-h` followed by `a` then type "window".
reply
I've been a (n)vim user for 20+ years now, but I hate vi-mode in the shell. However if I feel that I need to do a complex command, I just do ctrl-x+e to open up in neovim (with EDITOR=nvim set). I find it a good middle ground.
reply
It’s strange. I have heard this from lots of others too. I think I am an anomaly here. I can’t live without shell vi mode
reply
it is an additional burden to switch to shell vi mode, it is not the standard. Maybe you can put it in all of yout bashrc files but you will probably hear some swearing from the people logging to your machines :).
reply
You're not alone, I heavily rely on vi mode and often struggle if I'm on someone else's machine and can't use it. I always wonder how you're supposed to work without it but I never dare to ask
reply
`set -o vi` is quickly typed in anger...
reply
Same - shell vi mode is critical for intensive terminal sessions.
reply
agreed, i use neovim as a terminal multiplexer because vi-mode is really bad. I wrote a blog post on how i solved the issue for myself https://loosh.ch/blog/neovidenal
reply
I'm the same and in my opinion this is the best of both worlds. Taking the time to learn some of the regular (emacs-style) shortcuts is one of the best investments I've ever done. Even just CTRL+Y and the likes.

edit: And of course, CTRL+R, the best time saver of all

reply
Huh. I don’t use vi-mode for more than jumping to the beginning or end of a line, which I like a lot.
reply
I'm a vim user but in the shell I use Ctrl-a and Ctrl-e to get to the beginning and end. If I need more editing I use Ctrl-x Ctrl-e to hop into vim.
reply
It really shines for navigating history. <esc>/ searches history the same way as the editor search function
reply
C-a and C-e are your friend.
reply
You mean, like the “home” and “end” buttons?
reply
Yeah but those are so far away, i have to hunt for them every time
reply
deleted
reply
I used to hate it because I'd sometimes change modes without realizing it, but I began to appreciate it a lot more when I added a mode indicator -- a red 'N' on the rightmost side of the input line.
reply
Agree.

I WANT to love it - and if I was only ever working on one, or a small number of systems that I was the only one working on I’d probably do it. I’m ALL about customizing my environment.

However ssh into various servers through the day (some of which are totally ephemeral), and having to code switch my brain back and forth between vim mode and emacs mode in the shell would just slow me down and be infuriating each time I connect to a new box.

reply
I use vim a lot but not on the shell

A mistake 3 words earlier?

meta-bbbd (not as elegant, I admit)

delete the whole thing?

ctrl-ak (this is even quicker than vim, especially if capslock is mapped to ctrl)

the control-based emacs movements work system-wide on macos btw. I am using ctrl-p and ctrl-n to go up and down lines, ctrl-a and ctrl-e to go to beginning and end of lines while writing this comment in by browser (which has vimium extension)

Sometimes I wish vim just had full emacs bindings while in insert mode. But I don't like to mess with defaults too much.

I keep thinking I should give vim readline a try though, so maybe today. Thanks for the comment.

reply
I've never understood why emacs mode became the default. "set -o vi" is the _first_ command I type in a new shell.
reply
remap Caps Lock to Ctrl and see the light from home row
reply
Oh wow I didn't know about this, thank you. The underlying feature is called "readline vi-mode" for folks who want to search more about it.
reply
> <esc>cc

Doing control+o in insert mode temporarily places you into normal mode so that you can execute one normal-mode command, and then go back to insert mode again--no need to hit 'i' again.

So, instead of '<esc>cc', '<c-o>S'.

reply
The vim version is much easier, if you ask me: 3 strokes, 2 keys and 0 combinations.

The one you suggest however requires 4 strokes (ctrl then o then shift then s), 4 keys (ctrl, o, shift, s) and 2 combinations.

The "cc" sequence deletes the line and switches automatically to insert mode. To forgo the switch, the sequence then becomes "dd".

reply
Maybe I have my bash/readline vi mode configured specially to do this, but if I want to delete the entire line and type a new one (from anywhere in that line), I do something simpler than either of these alternatives:

<esc>S

Esc exits insert mode (of course) and capital S erases the line and puts you in insert mode at column 0 (just like in (n)vim, right?).

Like I said, maybe I configured that? But 'S' is standard vim-stuff... (I'm not able to double check my config at the moment).

[Edit: right after hitting submit I realized that my way is perhaps "arguably" simpler because I do have to hit shift to get capital S. So I'm also hitting three keys...]

reply
<c-o>S is also a vim sequence. The equivalent readline/emacs is <c-e><c-u> or <c-a><c-k>, or just <c-u> or <c-k> if you're already at the end/start of the line.
reply
Or just <C-u> in insert mode. <C-u> and <C-w> are standard Vim insert mode commands.

https://vimhelp.org/insert.txt.html#i_CTRL-U

reply
i went even further and use neovim as my multiplexer
reply
I've been a vim/nvim casual user for the past year or two, and I still feel as if I'm slightly less proficient in it for the amount of time that I put into it.

I really need to get around to playing with it more. I just hope that especially now with genAI that it's not too late for learning it further.

reply

   <esc>3bcw
What is your keyboard layout? This looks like a crime against humanity on a regular qwerty kb.
reply
I use qwerty and azerty, and in both I never felt typing the sequence was any harder than typing any other regular word. Generally speaking, I prefer sequential "shortcuts" then multikey bindings.
reply
Remap Capslock to Esc. Possible in every OS now.
reply
Instead of esc, type ctrl [
reply
Does it help a lot? You've still got a three to type which is a crime, plus some letters, only to move 3 words. My typing skills are not great, but that sounds like an awful lot of work(?)

If I hit CTRL + ARROW_LEFT 3 times, I am done a lot faster I guess. But I am open to learn, do people really use that and achieve the goal significantly faster?

reply
I don’t love vi-mode, but I’ll address your comment.

Many people these days, including yours truly, have caps-lock mapped to ctrl if held or esc if tapped. That’s good ergonomics and worth considering for any tech-savvy person.

Instead of the 3b I would type bbb (because I agree with you that typing numerals is a pain).

So (caps lock)bbbcw isn’t bad. It’s better than it looks, because if you’re a vim user then it’s just so automatic. “cw” feels like one atomic thing, not two keypresses.

And importantly, it doesn’t involve any chords.

reply
I think it’s a difference in how people think. I can’t remember hotkeys. It just doesn’t compute. But with vim style bindings it’s much closer to writing a sentence. `3`, number of times, `b`, beginning of word, `c`, change, `w`, word. Yea it’s a lot. I cannot explain why it’s simpler for me to learn that than emacs style bindings but it is.
reply
Obligatory:

Your Problem with vim is you don't grok vi

https://stackoverflow.com/questions/1218390/what-is-your-mos...

reply
We're basically playing a game: if you have to leave homerow hand position, you've lost
reply
The <esc>v has been such a lifesaver at times when having to execute/modify super complex commands!
reply