How to? Control-U alias for Escape (command line editing)

  • This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
#1
In my bash/zsh alternate universe, and in a lifetime of VMS and UNIX use before that, I grew so accustomed to typing ^U to delete the entire command line (what ESC does in TCC).

I did manage to come up with a working alias some time ago, but a hard crash and a flawed recovery later I have lost that alias, and despite my renewed attempts to figure it out a second time I remain stymied.

How can I alias <C-u> to <Esc>?
 
May 29, 2008
521
3
Groton, CT
#2
In my bash/zsh alternate universe, and in a lifetime of VMS and UNIX use before that, I grew so accustomed to typing ^U to delete the entire command line (what ESC does in TCC).

I did manage to come up with a working alias some time ago, but a hard crash and a flawed recovery later I have lost that alias, and despite my renewed attempts to figure it out a second time I remain stymied.

How can I alias <C-u> to <Esc>?
In your .INI file ("%_ininame"), in the [4NT] section, add this line:
Code:
DelToBeginning=Ctrl-U
I've used this for years, due to decades of using it the same way you did, from half a lifetime of working with (and for) VMS.

You might also like:
Code:
DelWordLeft=Ctrl-J
EndLine=Ctrl-E
 
#3
In your .INI file ("%_ininame"), in the [4NT] section, add...DelToBeginning=Ctrl-U
Hot dang! That's it exactly. Thank you for that. Although I used ASR-33, ADM-3a, VT-52 and VT-100 terminals in the beginning, I became quite accustomed to the VT-220 (amber, no less), so the others will be less helpful ... but I may try mapping a few Vim keybindings that way, since they fall naturally under my fingers these days.

Much appreciated: I would likely never have found that tip again, and I was driving myself crazy in the interim. My sanity and I salute you, sir.
 
Last edited:
#4
Each key can be assigned ("mapped") for a different purpose in each of the input modes: (command line) edit, list, popup, and general input. If you try to assign a key in a specific mode for which it has a different default assignment, you must first remove the default assignment by the appropriate normal key directive. The list of actions for default keys is in the HELP pages for each mode, but you need an eagle eye to find it by key names. But never fear, there is a simple experiment you can do. Add the desired assignment to your .INI file. If it does what it did before - you need the normal key directive. If it works as you want it, no normal key is needed.
 
#5
Each key can be assigned ("mapped") for a different purpose in each of the input modes
Gosh, I don't even understand what your answer means! (Well, I do understand it, but I'm unsure if I appreciate it ... or if I actually need that level of tweaking.)

I don't care if <ESC> still also clears the input line since I'll never reach for it accidentally (or deliberately, for that matter). C-u does that, even in parallel with the original binding, and that's enough for my purposes. Still, you have installed that concept in my mind, and if I ever do actually need to rebind the same key in a different mode, it will surely come in handy! So thank you for that.

In fact, I think I'll peruse the Help pages just to see what goodies I could concoct, even if at this point I'm unlikely to perform any
 
#6
If your interest is limited to the issue in your OP, my post is definitely overkill. However, if you care to duplicate other 'nixisms it may be of interest. It was intended as information which is not necessarily obvious from HELP.