e-malito
e-malito

Reputation: 937

Reverse search completion of vim's command history without using direction keys

Is there an option to auto-complete a currently typed command with one from the history, without using the direction keys? This an extension to this question: How do you search through vim's command history?.

The answer was, after typing :somecommand to use the <up> key. I would think it is more vim-like not to have to lift the hand to go to the direction keys.

From :help cmdline-completion, I tried, Ctrl-N, Ctrl-P, Ctrl-D, Ctrl-L without success. Here's maybe a related part of my vimrc.

set completeopt=menu,longest,preview
set showcmd     
set wildchar=<Tab> wildmenu wildmode=longest,list,full
set wildcharm=<C-Z>

I'm aware of the command line window invoked with q: or :Ctrl-F and the Ctrl-N and Ctrl-P to go through the history linearly after typing :.

Upvotes: 4

Views: 892

Answers (1)

ZyX
ZyX

Reputation: 53674

You can always map this to something. I once tried using

cnoremap <C-p> <Up>

, but this will disable completion cycling so you should better deduce something else (there is no way like pumvisible() to determine whether completion is active in command mode).

Upvotes: 2

Related Questions