Reputation: 1263
I have tried the autocmd way, not work for me.
Press i at begin of the line, then press #, the # and cursor auto indent.
Press I at begin of the line, the cursor auto indent; then press #.
---------------------Edit------------------------
-
The first block and the second block bahaves different.
Upvotes: 19
Views: 2961
Reputation: 633
This drove me nuts too! Thankfully the solution is pretty simple:
autocmd FileType yaml,yaml.ansible setlocal indentkeys-=0#
You need to use "yaml.ansible" if you use the ansible-vim plugin. Using "setlocal" instead of "set" is optional but after decades with Vim I've learned that it is a good idea to specify local when you know you only want it local to avoid nasty surprises.
Upvotes: 18