Wednesday, April 20, 2011

vim mapping question. How can I make a map to :r! <script> execute right away?

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

I do this by:

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 executing immediately. Any ideas?

Thanks!

From stackoverflow
  • Add a newline to the end of the mapping:

    map <F2> :r! showdate.py<CR>
    
  • I'm not sure if this will work in your case but I remember using '' to simulate a carriage return. So your line will look like:

    map <F2> :r! showdate.py <CR>
    

0 comments:

Post a Comment