Vim. How can I make a map: r! <script> run right now?

I have a python script called showdate.py that I want to map to

I'm doing it:

map <F2> :r! showdate.py

in my _gvimrc file.

The problem is that I have to press enter when I press F2 to execute instead of immediately executing. Any ideas?

Thanks!

+5
source share
2 answers

Add a new line at the end of the display:

map <F2> :r! showdate.py<CR>
+5
source

I'm not sure if this will work in your case, but I remember how I used '' to simulate a carriage return. So your line will look like this:

map <F2> :r! showdate.py <CR>
+1
source

All Articles