Vim mapping works in command mode but not when used in autocmd
Question
I have this autocmd in my .vimrc
:
autocmd Filetype markdown inoremap <buffer> <CR> <C-o>:call AutoUMDList()<CR>
When I open a markdown file, enter Insert mode and press <CR>
, I get the following error:
E15: Invalid expression: ^O:call AutoUMDList()^M
E15: Invalid expression: ^O:call AutoUMDList()^M
Press ENTER or type command to continue
But if I go in Insert mode and type <C-o>:call AutoUMDList()<CR>
it works!
Also, if I type the following in Command mode it also works:
:inoremap <buffer> <CR> <C-o>:call AutoUMDList()<CR>
What is going on here please?! I don't understand why my autocmd won't work...
No correct solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow