News for hackers. Stuff that matters.
Re:Keyboard Shortcuts every Command Line Hacker should know ... by alexdme on Tuesday November 29, 2022 @11:21AM (#33789513)
Ugh this destroyed my productivity too for a while. I even wrote an entire blog post about my woes and different experiments to get back to getting consistent shortcuts across terminal and GUI apps here: https://alexdav.id/2020/07/12/text-manipulation-and-modifier.... GTK key themes didn't end up working out for me, and I ended up with a custom QMK solution, but it's not great.

Note for people still using macos, you can enable many more readline shortcuts by creating a special file at ~/Library/KeyBindings/DefaultKeyBinding.dict. I made a repo that simplifies the process to just a single git clone when setting up a new machine: https://github.com/alexdavid/keybindings

Re:Keyboard Shortcuts every Command Line Hacker should know ... by bloopernova on Tuesday November 29, 2022 @11:29AM (#33789624)
Very cool!

What keys do ~ and ^ represent?

    {
      "^w" = "deleteWordBackward:";
      "~f" = "moveWordForward:";
      "~b" = "moveWordBackward:";
      "~d" = "deleteWordForward:";
      "~<" = "moveToBeginningOfDocument:";
      "~>" = "moveToEndOfDocument:";
      "~w" = "copy:";
      "^y" = "yank:";
      "^t" = "transpose:";
      "^p" = "moveUp:";
      "^n" = "moveDown:";
      "^u" = "deleteToBeginningOfLine:";
    }
Re:Keyboard Shortcuts every Command Line Hacker should know ... by beembeem on Tuesday November 29, 2022 @11:34AM (#33789688)
If it's anything like readline/Emacs, then:

^ = Control

~ = Escape

Re:Keyboard Shortcuts every Command Line Hacker should know ... by alexdme on Tuesday November 29, 2022 @01:38PM (#33791379)
In this file `~` is meta (option key on macs). Not sure why it's not escape like it is in emacs.
Re:Keyboard Shortcuts every Command Line Hacker should know ... by dotancohen on Tuesday November 29, 2022 @04:29PM (#33793586)
On Linux, Meta is activated on modern keyboards by both ESC and ALT.
Re:Keyboard Shortcuts every Command Line Hacker should know ... by Jtsummers on Tuesday November 29, 2022 @04:58PM (#33793947)
Also on macOS and (at least within emacs) Windows.
Re:Keyboard Shortcuts every Command Line Hacker should know ... by a1369209993 on Tuesday November 29, 2022 @08:19PM (#33795706)
Because on a particular three/four-decade-old physical terminal[0], Alt-$KEY was transmitted as "1B [sequence for $KEY]". Eg, Alt-X was "1B 58"[1]. The escape key happened to also transmit "1B" on its own. Consequently, "Alt-$KEY" and "Esc, $KEY" were indistinguishable unless you went out of your way to engineer a race condition. This has never really been fixed, despite intermittent attempts.

0: I think VT100, but don't quote me on that

1: or possibly "1B 78", depending on how it handled shift; I don't remember exactly.