Reputation: 24344
This may be trivial but I couldn't find a way to make this mapping work.
I have the following mapping in my .vimrc
to compile a file using clang
and run it afterwards:
map <F5> :wa \| !clang++ -g -std=c++11 % -o test && ./test : <CR>
I want to add the same mapping in insert mode but I doesn't seem to work. One of the many things I've tried (including wrapping the mapping in a separate function) was:
imap <F5> <C-o> <F5>
How can I make this mapping work in insert mode?
Upvotes: 0
Views: 55
Reputation: 2053
Remove the space after <C-o>
. To get it work, I also needed to use nnoremap
instead of map
. So this should work:
nnoremap <F5> :wa \| !clang++ -g -std=c++11 % -o test && ./test : <CR>
imap <F5> <C-o><F5>
Upvotes: 1