Friday, March 23, 2012

Re: Bash's vi command line editing mode

On Saturday, March 24, 2012 4:05:34 AM UTC+13, vtadipatri wrote:
> ... when I do the "set -o vi" in the bash command line shell, if I hit <Esc> and v on the command line, it goes into vi editing mode. This is kind of cool, as I can exercise the full editing power of vi, and when I exit the editor it runs the command.   Unfortunately, sometimes I may have a really powerful/dangerous/unnecessary command that I've typed, and all I want to do is just cancel, not execute the command.

If it really is dangerous, I empty the buffer with ggVGd, in case something has slipped off the top of the screen.

BTW, you don't need set -o vi to be able to invoke vim on bash's command line. Even with set -o emacs, "fc" starts vim for me, (because my /usr/bin/editor is linked to /etc/alternatives/editor which links to /usr/bin/vim.gtk), as does <ctrl-x><ctrl-e>. Hmm, I think I'll export EDITOR="gvim -f" in my .bashrc to get my vim version and also be able to copy and paste from the terminal window.

Also set -o vi enables a lot of simple vi-like stuff (f.ex., <esc> kkkk gets you to the fourth previous command).

Regards, John

--
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

No comments: