lf icon indicating copy to clipboard operation
lf copied to clipboard

Documentation states cmap can only be used for "one of the builtin commands"

Open ferreum opened this issue 2 years ago • 1 comments

The documentation states:

Command 'cmap' is used to bind a key to a command line command which can only be one of the builtin commands:

cmap <c-g> cmd-escape

However, it happily accepts my custom mappings with composite commands like these, and they work as expected:

cmap <c-n> :set wrapscroll; down; set nowrapscroll
cmap <c-p> :set wrapscroll; up; set nowrapscroll

The docs also suggest mapping custom commands for search:

Alternatively, you can also map some other commands with 'cmap' to accept the search and execute the command immediately afterwards. [...] cmap <up> up cmap <down> down cmap <left> updir cmap <right> open

It doesn't state anything about builtin, custom or composite commands. The examples only use builtins, though open is probably overridden a lot.

My first thought was that the first section of the doc is outdated. It would be nice if the intended limitations of cmap could be clarified. Preferrably there wouldn't be any such limitations compared to map, since I already put these to good use by changing mappings on the fly to implement custom modes.

ferreum avatar Jul 23 '22 12:07 ferreum

I noticed in the changelog that these restrictions have been lifted in r25. I created #884 to update the text accordingly.

ferreum avatar Jul 27 '22 17:07 ferreum