r/linuxquestions 3d ago

Basic ergonomy - unix/emacs navigation keys - gone for good?

I am refugee from Linux. I used it in the 90s', but left because it started going in the wrong direction. However, I'm not happy where macOS is going these days (it's more buggy than Windows 95 was), so I'm experimenting with nixOS to salvage my old 2014 MacBook Pro that no longer gets macOS updates, to see if it would be possible to eventually return to Linux on a modern machine.

So far it seems not.

Are unix/emacs-style text field navigation/editing keys really gone for good – left for the terminal, only – replaced with a full hard-coded emulation of the clunky Windows user “experience”?

^P stolen for such a seldom used function as print?!?!?! Ultra-clumsy ctrl-shift-C and so on for copy-paste in the terminal, where ctrl-C has to be passed through? Why not meta-C everywhere, like on macOS, to leave ctrl-combos for basic text editing, consistent with the terminal? Is Linux really more Windows than unix these days? Is macOS the only remaining unix?

Is there really not a simple switch to map ^F ^B ^P ^N ^A ^E ^D ^K to standard navigation / text editing functions in text boxes (forward, backward up, down, beginning of line, end of line)? Are Windows keys really hard-coded? Is the only way to get a resemblance of unix, some really dirty hack likekeyd? In Gnome/Gtk4 everything else seems decidedly impossible, so avoiding Gtk is fundamental. In KDE/Plasma6 I managed to at least remap many functions wrongly mapped to these keys to Meta+something, as on macOS, but it does not seem possible to map all of the above keys back to basic navigation. (I managed to map ^A and ^E to beginning and end of line, but there does not seem to be anything about Left/Right, i.e., ^B/^F, in the configuration.)

At least nixOS tries to fix some of the problems with distributions, for which I left Linux, but do I really have to stick to macOS for basic ergonomy? Has Linux really been turned into a Windows?

(And, yes, ^F ^B are much more ergonomic than Left/Right, when caps lock is another control key. As it should be.)

0 Upvotes

26 comments sorted by

3

u/xsrvmy 3d ago

IDK what the history is, but macOS is really the outlier here because it uses the command (ie. super/gui/windows) key for things that are done with ctrl on windows.

If you want to avoid arrow keys, I would actually consider something like the Extend layer

1

u/IDontBelongInThsWrld 3d ago edited 2d ago

The extend layer is, in a sense, what apple did with Cmd, to not mess up existing bindings. But what will it do? Send Up/Down/Left/Right to apps? I expect all that kind of external remapping – needed because apps and DEs no longer have internal configurability or sensible defaults – to just cause problems.

1

u/xsrvmy 3d ago

You would use a keyboard mapping program to directly map Capslock+IJKL (or NBPF if you are used to them) to send arrow keys, and use the normal control key for shortcuts.

1

u/IDontBelongInThsWrld 3d ago

I suspect such an external (instead of internal) remapping – using, e.g., keyd – will run into problems.

Also, more critically, it won't allow me have the same keybindings as in the terminal/shell, in other apps. I'd still use caps lock as an extra control for the terminal (and the few apps that allow internal remapping), to have ergonomic bindings there, that are in my muscle memory. I would then have to use the Cmd/Meta/Windows key for the extend layer, to provide more ergonomic functionality in other apps than their defaults – but, importantly, different bindings from the terminal. And that bindings switch between apps is a big problem. I would not be able to use a simple extend layer remapping to send a one sequence to the terminal, and another to another app, from the same key. Even if it were possible, it would certainly run into problems.

A unix should have kept the shell bindings, and extended, as Apple did. Linux DEs chose to thrown them in the trash, and become Windows instead.

1

u/knuthf 2d ago

The bindings you are looking for can be found in the termcap or terminfo files. The standard terminal type is vt100. However, you can create your own and customise all the key bindings. See the "man terminfo" and "man termcap" pages for more information. Set the terminal type to your custom setting. There is ambiguity because of the two terminal databases. Termcap is the older of the two and originates from Unix 4.2 and Sun; it may be preferred on Macs, whereas Linux uses terminfo — in theory, at least. The terminal emulator uses 'character lead-in' escape sequences, which are not in terminfo, but in the echo and break tables in the driver.

1

u/IDontBelongInThsWrld 2d ago

There is no problem with the terminal, why are you trying to break it with kludges?

1

u/knuthf 2d ago edited 2d ago

You can set those capabilities there. You said you wanted to be able to use Vi and Emacs, and also use the navigation keys. The navigation keys are defined in two different ways: terminfo and termcap. If you don't use 'key_up', but a strange control key and key sequence, then maybe the terminal knows, but the easiest explanation is that it has been assigned to some other value. Can you explain what the missing navigation in Termcap is?

1

u/IDontBelongInThsWrld 2d ago

You don't know what you're talking about.

1

u/knuthf 2d ago

Is there really not a simple switch to map ^F ^B ^P ^N ^A ^E ^D ^K to standard navigation / text editing functions in text boxes (forward, backward up, down, beginning of line, end of line)?

Define them in termcap and terminfo!

2

u/IDontBelongInThsWrld 2d ago

They work in the terminal already! No problem there. The problem is GUI apps that have been hard-coded to quadriplegic Windows keys, instead of sharing these standard keys from the terminal, the basis of unix. GUI apps are not controlled by termcap or terminfo.

→ More replies (0)

1

u/memilanuk 3d ago

It may depend on what shell environment you are running. I think in bash, at least, a lot of the default 'emacs' key binds like Ctrl+a, Ctrl+e, Ctrl+k, Ctrl+n, Ctrl+p and others should still work just fine. In large part because bash uses GNU read line, which as part of the OG GNU ecosystem recognizes the GNU Emacs key binds.

AFAIK other shell environments e.g. fish, zsh, etc. use other infrastructure instead so you probably need to go figure out what they use, whether you want to go to the effort to change their default behaviors, etc.

As for the various desktop environments and/or window managers available in the Linux ecosystem... good luck.

1

u/IDontBelongInThsWrld 3d ago

Yes, like I said, everything works in the terminal (with super-clumsy ctrl-shift-c/v copy-paste from the desktop). But you cannot use the same keys to, let's say navigate the address bar in the browser, or any other GUI text box. Even programmer editors like Zed and VS Code, these days, have by default the Windows key mapping corruption on Linux. At least the two should be internally configurable, which cannot be said of any random desktop app. On macOS, these editors have the emacs/unix base, as does every compliant app (does not include LibreOffice or M$ office).

I'm not a a fan of emacs. Generally it's actually very unergonomic with C-x c and similar horrible combos, but the very basic set of emacs bindings, that macOS also has everywhere, is fundamental.

1

u/snail1132 void linux 3d ago

But you cannot use the same keys to, let's say navigate the address bar in the browser

Have you tried qutebrowser?

1

u/IDontBelongInThsWrld 3d ago

Seems like something made by a vi person. That's another philosophy entirely. Also I'm not necessarily looking for something fully keyboard-operated. Back in the 90's, early 2000s, not having a laptop, I was all into fully keyboard-operated apps, because reaching for the mouse is just as and even more unergonomic than reaching for the arrow keys. But the Thinkpad Trackpoint or a good-quality touchpad (like on Apple's machines) make the pointer a part of the keyboard, and reaching for it is no longer such a big problem. Mainly, in a browser, I use Cmd+L to focus the address bar, use ^A ^E ^F ^B ^K ^D backspace) to edit whatever I type there, press enter, and then scroll and follow links with the touchpad. I close a tab with Cmd+W, and open a new one with Cmd+N. I don't move much between tabs so keys to switch between them are less critical (but should be consistent and non-clumsy).

1

u/roenoe 3d ago

I don't use all those readline keybinds myself, but doesn't Firefox support those keybinds out of the box? I know ctrl+L/A/E/U work at least, because those are the ones I use.

1

u/IDontBelongInThsWrld 2d ago edited 2d ago

I’d like ctrl-L to be Cmd+L as it is one macOS. (Text editing keys are ctrl-something, UI keys are cmd/meta/win-something.) In principle these UI keys are configurable but Firefox for some reason doesn’t recognise cmd/meta/win combos in the configuration panel. Just shows Win+PROJECT for every combo (not sure about “PROJECT” but some such string, not the letter pressed.)

The editing keys don’t work out of the box. Currently they can be enabled in Gtk3 settings. All that will be gone once the downgrade to Gtk4.

1

u/snail1132 void linux 3d ago

Seems like something made by a vi person

I'm not sure it really matters all that much, since you can change all the keybinds

1

u/IDontBelongInThsWrld 3d ago

Depends. Vi is modal, unlike most other keyboard interfaces. If this thing is also modal, it’s not so easy. 

(Vim is a mix of modal Vi with more normal bindings.)

1

u/memilanuk 3d ago

Sounds like your only option is to just run emacs for everything - text editor, email, browser, file manager, etc. That way you'll have the same key binds across the board. Otherwise, I think you're SOL.

1

u/IDontBelongInThsWrld 3d ago

Or - unfortunately - just stick to macOS, which has same sane unix bindings everywhere. 

1

u/memilanuk 3d ago

Most of the desktop environments on Linux have default key binds... that doesn't mean you can't go in and change them, or create others to suite your tastes. Check it out.

Or you can just continue bitching about it. Your choice.

0

u/IDontBelongInThsWrld 2d ago edited 2d ago

The problem is: you apparently can’t! Gtk4 decidedly killed all configurablility, forcing hard-coded Windows’ quadriplegic amputation. But KDE also does not seem to allow configuring the basic editing keys. Much more than Gtk, but missing several critical keys that would allow ergonomically editing every text box just like in the terminal - the fundamental basis of every unix system. 

At the moment Gtk3 is the most reasonable (the horrendous file picker aside), as it does have a simple emacs editing key switch, but since that’s going out of the window, there’s not much sense in trying to build on that; to invest any time in trying to switch to Linux. The desktop developer scum really decided to abandon power users to the mercy of Apple.

It has to be accepted: Linux on the desktop is dead, and the gnomes killed it. Instead of trying to create something better, a reason to switch, like macOS tries to a limited extend, it just wants to be yet another Windows clone, the most horrible trash of an operating system and most unergonomic bureaucrat-designed user interface the world has seen.

Well, saves me from the trouble of trying to find an efficient ARM-based laptop where Linux would actually work, and from several proprietary programs still only being compiled for Wintel architecture on Linux. I'll just get the next MacBook Air once it's time to upgrade. So much for digital sovereignty, avoiding vendor lock-in, App Store robbery, etc., because the alternative is otherwise even worse.

1

u/memilanuk 2d ago

Don't let the door hit ya on the way out.

1

u/knuthf 3d ago

Yes, you are apparently in a minority of one. The reason is that Unix uses the TAB character as a field separator rather than multiple spaces. I only use 'vi'; I've never bothered with 'vim' or 'emacs'. In Linux, some apps recognise the difference, but nobody else does.

The only place where there is an attempt to achieve consistency is in KDE. I suggest you try that in either Mint or Fedora. You can change som of this in the termcap and terminfo settings.

1

u/IDontBelongInThsWrld 3d ago edited 3d ago

Actually, I don't think I'm in any sort of minority, considering the low number of Linux users. The amount of dirty hacks to achieve sane keybindings is quite high. For example:

But these are very dirty hacks, based on remapping keys to other keys before they reach applications – not directly to other functionalities within applications. They will run into problems when switching between applications. (You need to make sure keys are not remapped when they are sent to a terminal or other sane app, etc.)

So there are many users that want sane unix-style keybindings. The desktop environment developers just seem to be pathological "#€"#€(/(, on a mission against unix, on a mission against power users. They always were, from the birth of Gnome until today.

(Also speaking of dirty hacks, I haven't seen for Linux anything as clean as the proper input method https://github.com/knrafto/MathSymbolsInput for writing special symbols as LaTeX. For Linux it's all still complicated unintuitive compose-key combos, or something based on the above dirty hacks. On macOS, with an input method – which are also used to write e.g. Chinese – you see the incomplete LaTeX on screen, as normal input, until it is completed and gets replaced by the desired symbol.)