Saturday, November 9, 2013

Re: Bash's vi command line editing mode

On 8 November 2013, Tony Mechelynck <antoine.mechelynck@gmail.com>
wrote:
[...]
> I tried ESC v in bash, and to my surprise, the command-line was opened
> in Vim as a file in /tmp/ with a name starting with "bash-fc-".

That's actually a feature of readline, not bash itself (but bash is
usually linked against readline). If you set "editing-mode" to "vi" in
your inputrc you can do line editing like this (the default is "emacs").

[...]
> After :wq or even after :q! bash tried to execute the command (and
> complained, because it was a nonsense command). However, the command
> which bash tried to execute was the *unmodified* command-line, not the
> result of any edits.

Use :cq to abort the command. As you found out, :wq executes the
modified command, and :q! executes the unmodified one.

[...]
> Another thing that I notice is that on return from this Vim
> commnd-line editor, Bash finds itself (apparently) in vim-like "normal
> mode" so that letters typed at the keyboard in bash seem to have no
> effect until one of them is a or i. Then bash "starts working again".

If you don't care about command line being modal, set "editing-mode"
to "emacs". You can still edit the command line with "fc" (a bash
internal command), or with C-x C-e. The program pointed to by $EDITOR
is run for that purpose.

/lcd

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: