You just need to add <CR>
at the end of your mapping:
map <F4> :q<CR>
See :help key-notation
.
Question
I found this cool exrc file to make the F-Keys to things, e.g. map #2 :set number
, which puts just that in that ex command thingy, and lets me press enter to confirm. However, I made one to close (map #4 :q
) and I would like it if it automatically added an enter, so it just closes without me having to press enter first. Then I would just hit and it closes.
How do I add that enter character?
Solution
You just need to add <CR>
at the end of your mapping:
map <F4> :q<CR>
See :help key-notation
.