I want the key combination <C-X> to run the command :! python application.py. From all my understanding of mapping, I tried the following: :map <C-X> :! python application.py which almost works. It just opens the command line and types the command in, but I still have to press return for the command to launch.
Is there any way I can get it to run the command as well?
I found an answer in an unrelated post while doing my last searches before posting the question. It seems that putting
<CR>behind the command executes it, making this do what I wanted:According to the comments (thanks to melpomene)
<CR>means “carriage return”, which in effect means “press enter” and is just what I needed in this case.Slightly related, I also found out that
:!!repeats the last shell command executed, making my map somewhat superfluous.