Sunday, September 26, 2010

Re: Question on completion in vim command window

Thanks. That's exactly what I needed!!

On Mon, Sep 27, 2010 at 3:38 AM, Benjamin R. Haskell <vim@benizi.com> wrote:
On Sun, 26 Sep 2010, Eran Borovik wrote:

Hi Vim fanatics,
For the last year I've taken to vim more and more, and made it my main working environment for programming. Although I consider myself still a vim novice, there is a very big improvement with my work efficiency.
One of the basic principles that I try to maintain is that my fingers need to stay on keyboard all the time, and stretching my pinkies too much means I am doing something wrong as everything that is needed should be available within easy reach (e.g. use hjkl instead of arrow keys).
Now, I face this issue with vim command line mode when I want to auto-complete. In this mode, completion works great with the up down keys. However, those are very far for my fingers... I tried to find some shortcuts and saw ctrl-p, ctrl-n. But they are not good enough as they simply browse the history. I saw ctrl-a, but it shows all the matches while I want only the next one. I am sure there is a way to configure it, but I just cannot find it.
Any help with this is greatly appreciated.

You can map whatever keys you'd prefer to '<Up>' and '<Down>', if those keys have the functionality that comes closest to what you want.

e.g., if you never use ctrl-p or ctrl-n, replace them:

" in ~/.vimrc:
cnoremap <C-p> <Up>
cnoremap <C-n> <Down>

" I like:
cnoremap <C-j> <Down>
cnoremap <C-k> <Up>

If you find yourself making frequent, minor edits to long commands, you might also like 'q:'.  (As I mentioned recently, I used to abhor the cursed 'q:' window that would prevent my mistyped ':q' from exiting, but now I use it daily.)

:help :cnoremap
:help q:

--
Best,
Ben

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