简体   繁体   中英

Vim autocmd E488: Trailing characters

This line in my vimrc produce the error in the title

autocmd CursorMovedI *.html :<C-x><C-u>

How I can make it to work?

:autocmd accepts commands for ex mode, don't try to feed it normal-mode commands. Correct syntax is probably

autocmd CursorMovedI *.html :execute "normal! \<C-x>\<C-u>"

or

autocmd CursorMovedI *.html :call feedkeys("\<C-x>\<C-u>", 'n')

( : is not really required, but I use it to separate executed commands from execution conditions). You need to remove ! from first command or , 'n' from the second if you intend to execute a mapping.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM