Tuesday, March 27, 2012

Re: Bash's vi command line editing mode

On 03/27/2012 12:27 PM, Charles Campbell wrote:
> AK wrote:
>> On 03/27/2012 12:03 PM, Charles Campbell wrote:
>>> Ven Tadipatri wrote:
>>>> Well...duh..there's an easy fix for this. Just prefix the command with
>>>> '#'
>>>> Then hit :wq to save it and "run" it. Still...why does it behave this
>>>> way?
>>>> Shouldn't I be able to choose not to run the command when I exit
>>>> from Bash's vi editing mode?
>>>> This is on a Centos 5 machine, and the terminal is a Gnome terminal.
>>>>
>>> It looks like several of the answers presume you're using vim/gvim
>>> rather than the bash shell's vi-mode (ie. :cq, which doesn't work under
>>> bash shell). Assuming that you actually meant to ask what should you
>>> type while in the shell, not while in vim:
>>>
>>> Try 0D
>>>
>>> (move cursor to beginning of line, delete contents from cursor to
>>> end-ofline)
>>>
>>> Regards,
>>> Chip Campbell
>>>
>>
>>
>> I think dd is easier, too. The OP said, though, that he is talking about
>> vim launched from command line. -ak
> Yes, dd will also work; and I agree that its easier to type.
>
> I'm afraid that I've looked over the OP's first two messages and don't
> see where vim was launched, though:
>
> Title: Bash's vi command line editing mode
> Excerpt: ...but when I do the "set -o vi" in the bash command line
> shell,...
> Excerpt: ...if I hit <Esc> and v on the command line, it goes into vi
> editing mode...
> Excerpt: ...when I exit the editor it runs the command... (when one
> exits Vim, typically it doesn't cause any commands to run)
>
> Regards,
> Chip Campbell


When you hit Esc and v in bash (or zsh), it does start the vim
editor, and when you exit it, it puts the buffer in command line,
it doesn't run it immediately but waits for you to press Enter.

-ak

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

Post a Comment