Thursday, January 26, 2012

Re: Retrieve the argument of a prior Ex mode command

Am 23.01.2012 21:12, schrieb Chris Jones:
> On Sat, Jan 21, 2012 at 09:37:14PM EST, John Little wrote:
>> On Jan 18, 3:04 pm, Chris Jones<cjns1...@gmail.com> wrote:
>
>>> At the bash prompt, I often use the [Alt+.] keyboard action to
>>> retrieve the argument of a prior command from the bash history
>>> list...
>
>> That key combination works in bash's emacs mode. If you use vim a
>> lot, you may find that
>>
>> set -o vi
>>
>> in your .bashrc (or whatever you have) lessens the harshness of the
>> context switch when using bash.
>
> I once tried to switch to vi-mode in bash and I rather liked it. Kept
> intruders in awe& stopped everybody trying to hijack my terminal/shells
> for one thing...
>
> What eventually made me go back to bash's default emacs-mode editing was
> that.. Vim's ex-mode doesn't have a vi-mode..!
>
> In other words, I was using vi-mode line editing in bash but when I was
> using Vim's command-line, I had to switch context, back to (a somewhat
> crippled) emacs-mode..
>
> Kinda silly, don't you think..?
>
> Of course, I proceeded to experiment with the 'q:' command-line window..
> and I still use it occasionally because it's really sweet when you're
> working with complex commands.. regex's and such... But way too slow for
> the trivial stuff.
>
> I eventually decided to switch back to bash's default emacs-mode line
> editing tactics and added the familiar mappings to enhance Vim's ex-mode
> editing:
>
> | cnoremap<C-O> <C-D>¹
> | cnoremap<C-D> <Del>¹
> | cnoremap<C-A> <Home>
> | cnoremap<C-B> <Left>
> | cnoremap<C-E> <End>
> | cnoremap<C-F> <Right>
> | cnoremap<C-N> <Down>
> | cnoremap<C-P> <Up>
> | cnoremap<Esc>b<S-Left>
> | cnoremap<Esc>f<S-Right>
>
> Come to think of it, it's rather odd that nobody ever thought it was
> worth their time writing a script that emulates bash's vi mode editing
> in Vim's ex-mode..
>
> Maybe someone did, and I never knew about it..?²

I did:

conomode.vim - Vi-style editing for the command line
http://vim.sf.net/scripts/script.php?script_id=2388

beware, it's experimental. help is contained in the header.

Any comments welcome ... I'm not a bash user.

> CJ
>
> ¹ Reassigning... Couldn't do without it..
>
> ² Another bash/vim consistency enhancement that comes to mind: cmap
> <C-R> to search the command history for the word under the cursor.
> Requires remapping<C-R> to something else, naturally..

--
Andy

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