I'm using zsh + rxvt-unicode as a terminal simulator in Archlinux. I've successfully setup navigation in the terminal using Ctrl+Arrow keys, but I can't setup the terminal to be able to select text when pressing Shift + Arrow (or Ctrl + Shift + Arrow to select the whole word). After several days of searching for solution I couldn't find one. Enabling keyboard-select in .Xresources didn't do the trick. So I'm interested in what should I do to be able to select text in the console without using the mouse just like it is done in all text editors?
|
|
||||
| show 2 more comments |
|
This is in three steps how I made it work for me: Step 1. Getting the meta key working: Put For xterm, in For rxvt, my intuition tells me it looks identical or very similar. Step 2. Patching cursor movement This will give you the Emacs meta key, so you won't have to reach for Escape. I set this up when using bash, and got it to work, and then switched to zsh; it still worked, but, as for word movement with the Emacs keybindings, it seems zsh and bash are somewhat different: the closest I got to Emacs behaviour, I got with this patch. If you're used to Emacs, it is very handy to have the same cursor movement in the shell. Now, for example, set the mark with C-SPC, mark the previously typed word with M-b, kill it with C-w (or, without erasing it, with M-w), yank it with C-y, and so on. OK, I know you wanted Ctrl-Left and so on, but that is a huge downtrade: that way, you have to reach for every cursor movement, and reach back to resume typing. There is a big annoyance and productivity drop! The "new" (but better) shortcuts are stiff in the beginning, but I'd advice anyone, just force yourself to use them, in no time (as you type all the time!), they'll come naturally. Step 3. To copy to the X clipboard, I setup this (in
Now, you can pipe output to To use it in Emacs (running in a tty), I had to make a script duplicating the functionality of the
And then, in
The reason for this is, I couldn't find a way to hook Emacs to a zsh alias, although I suspect that is possible. Anyhow, invoke with EDIT I added this workaround to make Emacs
|
||||
|
|

^[Od- Ctrl + Left^[[d- Ctrl + Shift + Left^[Oc- Ctrl + Right^[[c- Ctrl + Shift + Right – innocent_rifle Jan 14 at 0:34