Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

vim

mapping

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!

like image 446
Luis Avatar asked Apr 09 '09 21:04

Luis


2 Answers

Add a newline to the end of the mapping:

map <F2> :r! showdate.py<CR>
like image 78
Brian Carper Avatar answered Oct 20 '22 08:10

Brian Carper


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>
like image 1
Marcel Guzman Avatar answered Oct 20 '22 07:10

Marcel Guzman