Improve "cnoremap <c-n>" mapping

Closes https://github.com/mhinz/vim-galore/issues/148
This commit is contained in:
Marco Hinz 2021-04-13 15:47:24 +02:00
parent 5021813f96
commit ffd73c57c1
No known key found for this signature in database
GPG Key ID: 1C980A1B657B4A4F

View File

@ -2020,13 +2020,16 @@ So far, so good. But `<up>` and `<down>` are even smarter! They recall the
command-line whose beginning matches the current command-line. E.g. `:echo <up>` command-line whose beginning matches the current command-line. E.g. `:echo <up>`
may change to `:echo "Vim rocks!"`. may change to `:echo "Vim rocks!"`.
Of course, I don't want you to reach to the arrow keys, just map it instead: Of course, I don't want you to reach for the arrow keys:
```vim ```vim
cnoremap <c-n> <down> cnoremap <expr> <c-n> wildmenumode() ? "\<c-n>" : "\<down>"
cnoremap <c-p> <up> cnoremap <expr> <c-p> wildmenumode() ? "\<c-p>" : "\<up>"
``` ```
Here we also distinguish between command-line history and the wildmenu. See `:h
'wildmenu'`.
I depend on this behaviour several times a day. I depend on this behaviour several times a day.
## Saner CTRL-L ## Saner CTRL-L