Search code examples
vimmappingkey-bindingsctrl

How to map ":f" to "1<c-g>"?


:f[ile] has similar feature as <c-g>. However, I want :f to print the full path of the current file which is 1<c-g>'s job. The following config doesn't work: nnoremap :f 1<c-g>, the count 1 just ignored by vim and :f has nothing changed.


Solution

  • To map from command line to normal mode you can use:

    cmap f normal 1<c-g>