[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-readline] Readline starts vi editting mode in insert mode
From: |
J Alan Brogan |
Subject: |
[Bug-readline] Readline starts vi editting mode in insert mode |
Date: |
Fri, 10 Oct 2014 16:17:03 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.1.2 |
Whereas vi and vim both start in "Normal" mode.
I think that readline's vi mode should also start in "Normal" mode, and
started asking on Stack Overflow:
http://stackoverflow.com/questions/26277585/how-can-i-start-in-command-mode-not-insert-mode-in-readlines-vi-editting-mode
OTOH: I can understand that starting in insert mode gives less of a
learning curve to those unfamiliar with readline's vi editting mode, but
would suggest that anyone who wants to turn on readline's vi editting
mode is already expecting the "vim way of doing things" and would not be
unduly perturbed to find themselves in the same (similar) mode as when
vi starts.
I cannot find any configuration settings to change that behaviour, but
think I have the right place in to code: line 414 of readline.c (from
current, 6.3, version of the code) where it has:
#if defined (VI_MODE)
if (rl_editing_mode == vi_mode)
rl_vi_insertion_mode (1, 'i'); /* don't want to reset last */
#endif /* VI_MODE */
My guess is that changing that call to rl_vi_insertion_mode() with
rl_vi_movement_mode(), then readline will start in "Normal" mode.
Line 180 of vi_mode.c, line 180:
void
rl_vi_start_inserting (key, repeat, sign)
int key, repeat, sign;
{
_rl_vi_set_last (key, repeat, sign);
rl_vi_insertion_mode (1, key);
}
My guess is that changing that similarly will put me into Normal mode
after I hit return for a command.
Any suggestions on what the key parameter into rl_vi_movement_mode()
should be? 'i' is reasonable for insert mode, maybe '0' for movement mode?
Any suggestions on how to hook in to the config system (I'd like to
change the default for me, but assume others won't like it)?
--
Alan Brogan
-----
The information contained in this e-mail and in any attachments is confidential
and is designated solely for the attention of the intended recipient(s). If you
are not an intended recipient, you must not use, disclose, copy, distribute or
retain this e-mail or any part thereof. If you have received this e-mail in
error, please notify the sender by return e-mail and delete all copies of this
e-mail from your computer system(s). Please direct any additional queries to:
address@hidden Thank You. Silicon and Software Systems Limited (S3 Group).
Registered in Ireland no. 378073. Registered Office: South County Business
Park, Leopardstown, Dublin 18.
- [Bug-readline] Readline starts vi editting mode in insert mode,
J Alan Brogan <=