I’m fine, I got what I wanted. Apparently, it isn’t un-feature of Linux, it’s un-feature of ReadLine which is shipped with Bash.
I’m fine, I got what I wanted. Apparently, it isn’t un-feature of Linux, it’s un-feature of ReadLine which is shipped with Bash.
I’ve got what I wanted, but I’m a powershell user. For Bash, blesh looks very promising - it’s functionally same component as PSReadLine which makes all this stuff possible in pwsh.
one of many un-features in Linux
What exactly? Shift-selection is already possible with Blesh. I think I’ve seen scripts for synchronizing buffer with clipboard. And everything else is a matter of redefining existing shortcuts.
I’ve heard about Linux being highly customizable and decentralized OS, and suddenly I can’t define my own shortcuts because there is a list of un-features?
I don’t care about Vi and Emacs, I already have my workflow and I’m trying to transfer it to Linux. When I will succeed, then (maybe) I will spend some time to explore other ways of interacting with terminal. Otherwise, it’s not freedom, it’s becoming a victim of OS.
I was able to test out what you’re looking for on macos and its default out of the box
This is so cool. Unfortunately, macos isn’t an option for me and never had been (for common reasons why people usually switch to linux).
I’ve got what I wanted with wezterm + powershell. I can edit my commands the same way I edit any text anywhere in the system, both in Windows and Linux, and I can copy-paste back and forth between terminal and any other app. This is awesome. This is freedom. This is UX done right.
I will paste below some observations I’ve made.
https://github.com/akinomyoga/ble.sh/wiki/Manual-§4-Editing
cannot install package alacritty 0.16.1, it requires rustc 1.85.0 or newer, while the currently active rustc version is 1.75.0 Fail. Will use Gnome Terminal instead.gnome-shell crashed with SIGSEGV..zshrcPSReadLine starts with EditMode = Emacs by default.
Set-PSReadLineOption -EditMode Windows Fixes Ctrl+arrows, Ctrl+backspace, Shift+Ctrl+arrows.
Set-PSReadLineKeyHandler -Chord Ctrl+Delete -Function KillWord - Fixes Ctrl+Delete.
Set-PSReadLineKeyHandler -Chord Ctrl+o -Function AddLine - allows Ctrl+o instead of Shift+Enter to create a new line without trying to execute. Shift+Enter is not possible in Linux.
Reassigning Shift+Home/End in Gnome Terminal from scrolling viewport to something else is a rabbit hole, so I switched to wezterm, which fixed Shift+Home/End, and apparently also fixed a bug of Shift+arrows printing D;D;D; instead of selecting. But broke Shift+Ctrl+arrows. But you can fix it back by disabling this assignment in lua config.
Ctrl+C/V/X work fine, but without system clipboard synchronization. To fix it, install xclip. If it makes terminal freeze on Ctrl+C/X, update PSReadLine module.
PSReadLine starts with EditMode = Windows by default.
Macintosh has nothing to do with it. Maybe I want to grow selection to the left with E and to the right with R - they are not Macintosh keys, but still I will have a hard time trying to get what I want.
Do you mean this whole concept of growing selection from the same cursor you type with and performing operations on this selected area as a single entity is a Macintosh-way, originated in GUI? And its foreign to terminals and terminals developed a different way of editing text and you propose learning this native text-editing without using foreign techniques like cursor-based text selection… This makes sense. And sure it’s possible to be effective in terminal while using it traditional way. If this is what you mean, now I understand.
I made a glimpse on the world where this shift-selection doesn’t exist and got excited about this feature even more, and I even think it’s genius.
System-wide clipboard is probably not the “traditional way” either, and it doesn’t work quite well in Linux terminals too.
A couple of years ago I invested some time into Vim and it was a pleasant experience, but it was detached from all other experiences I had on my PC. Mentally switching between different text editing modes is disgusting, I hate it so much. I don’t want a new one. I’m fine with the one I have.
Linux and its terminals are meaningful only as long as they do what I want them to do. I don’t care if some of my activities are “not Linux-way”.
In Gnome Terminal: Ctrl+arrows work, Ctrl+delete work, home/end work, Ctrl+backspace — not, and there is no text selection, of course. So, something is working as expected without config at all, and for what isn’t working, config will not help.
I feel like you’re just defending the final state you observe. E.g. why do you hate shift+arrows for text selection but not arrows themselves for moving a cursor? And how selecting text with a mouse is better? I find it even funny to think one of these techniques is cursed and other are blessed. Never I could imagine selecting text with Shift can encounter such opposition.
It’s nice to see you think of it as of movement towards consistency. I also look at it this way.
But what is it about Ctrl? Text editing is historically the main task of computers, and Ctrl is the main “modifier” key. To me it seems fair it’s dedicated for some text editing shortcuts. Probably they are consistent since 1980’s.
What terminal emulator are you using where ctrl-c copies instead of sending SIGINT when text is selected?
This is what I experienced in conhost.exe (legacy windows console experience, predecessor of Windows Terminal) + Powershell. In windows terminal it works this way too. This is why I suspect it’s related not to terminal itself (conhost.exe/wt.exe/gnome terminal etc), and not to specific shell (bash/powershell), but to an extension for shell (ReadLine,PSReadLine).
As for various types of buffers and clipboards, I always felt like one system-wide clipboard with clipboard history is enough. When I cut something from terminal, quite often I paste it into another app, and not back to terminal.
Than you for the link, it looks like a very close match, even though I don’t quite understand how it is related to eMacs.
About what I’m trying to do being stupid — very interesting. What about learning vim only to notice you can’t use this skill in 70% text editing areas you interact with, and searching for firefox vi extension afterwards and trying to apply .vimconfig to it, is it stupid? Probably not. But trying to select, copy and paste text in a text-based program — that is stupid. I got it.
For more sophisticated text selection
Here it is. What I’m asking for is not sophisticated at all, quite the opposite. I ask for keybindings which work in almost all text editing areas, in all applications, all operating systems. Vi and eMacs are steps in opposite direction. I think I even used a vi-mode in terminal a couple of years ago. I doubt it’s possible to simplify command editing with it.
I’ve seen this and several others SO topics before posting. Some even recommend emulating a mouse with numpad. It’s like everyone suddenly start pretending not to know how text selection usually works.
For Bash - try blesh, it will enable some of common controls by default, and probably you will be able to manually enable other shortcuts. PSReadLine is calling
xclipeach time for copy/paste action for clipboard sync, probably it will be possible with Blesh too.