[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: how to start in "overwrite-mode"
From: |
Dave Rutherford |
Subject: |
Re: how to start in "overwrite-mode" |
Date: |
Wed, 28 Oct 2009 20:28:27 -0400 |
On Tue, Oct 27, 2009 at 16:29, Jim Lawson <jtl+bug-bash@uvm.edu> wrote:
> I have a user we're trying to encourage to migrate from tcsh to bash,
> who is used to his shell starting up in overwrite mode (as opposed to
> the default Insert mode.)
>
> Long story short, while I can easily bind a key to the "overwrite-mode"
> readline function, I can't figure out how to make bind start up that way
> as I can't find an "overwrite" readline variable which I can manipulate.
> And the user doesn't want to hit "Ins" every time he starts a shell.
>
> Anyone know how to do this?
With the caveats that this is an awful solution, and it requires
that the user be willing to commit to one or two terminal types
(say, Xterm), I found a horrible way to do this.
The control characters below are literal in the real files.
Assuming the insert key on your keyboard is ^[[2~ :
Add to .Xdefaults: XTerm*answerbackString: ^[[2~
Add to .bashrc (and .profile if it doesn't source .bashrc):
bind '"^[[2~": overwrite-mode'
PROMPT_COMMAND='echo -n ^E'
This causes xterm to respond by simulating a pressing
of the insert key before each PS1 prompt, putting that
line into overwrite. If the user drops down to a PS2, etc.
prompt, that line will be in insert mode. I didn't solve that;
putting a ^E into PS* didn't work for some reason. (Why?)
Dave