0

In the command minibuffer (Pardon my emacs, I don't know what it's actually called), C-p and C-n go to the previous and next command in my history. Is there a way to make them behave like M-n and M-p in tcsh? Those will take you to the previous and next commands matching the current prefix. (The prefix being everything before the current cursor position). If that isn't possible, can vim emulate the zsh behavior of scrolling through options beginning with the same command / word?

If I do:

:edit ~/.vimrc
:read !ls
:e

and then hit <c-p>, I'd like it to complete :edit ~/.vimrc not :read !ls

1 Answer 1

1

That would be <UP> and <Down> in cmdline-mode:

                        *c_<Up>* *c_Up*
<Up>  recall older command-line from history, whose beginning
      matches the current command-line (see below).
      {not available when compiled without the |+cmdline_hist|
      feature}
                            *c_<Down>* *c_Down*
<Down>  recall more recent command-line from history, whose beginning
        matches the current command-line (see below).
        {not available when compiled without the |+cmdline_hist|
        feature}

And you can remap those if you want:

cnoremap <C-p> <UP>
cnoremap <C-n> <Down>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.