Reputation: 27
autocmd BufWritePost vimrc :source %<CR>
this is my config i want auto source my vimrc after vimrc has written
but some error came out
Error detected while processing BufWritePost Autocommands for "vimrc":
E484: Can't open file /Users/xxx/.vim/vimrc<CR>
E484: Can't open file /Users/xxx/.vim/vimrc<CR>
I tried many methods but all failed ,please help me
Upvotes: 0
Views: 249
Reputation: 2884
The problem is <CR>
at the end.
You use it with key mappings, to simulate Enter key.
Autocommands use commands normally, you don't need to "press enter" in your config file.
Upvotes: 2