pearofducks / ansible-vim

A vim plugin for syntax highlighting Ansible's common filetypes
MIT License
796 stars 98 forks source link

the identing breaks when commenging lines in block mode #46

Closed dimovnike closed 6 years ago

dimovnike commented 6 years ago

When I comment a block of lines in visual block mode (ctrl-V, jjjj, I, then enter #) the identation jumps to right, after i hit escape - all selected lines are indented. For example take this code:

  • name: test comment copy: content: blabla dest: somewhere mode: 0666

If u I select from first to last lines (the first column) and hit "I", enter the # and hit escape, it becomes:

#- name: test comment
#  copy:
#    content: blabla
#    dest: somewhere
#    mode: 0666

sometimes it breaks even more, the dash character is ending up between letters. I tried with a totally clean .vimrc file and the problem is still there.

dimovnike commented 6 years ago

it seems that the plugin itself is not causing this, but the vimplug itself... Adding only these lines in .vimrc

call plug#begin('~/.vim/plugged') call plug#end()

is enough for the bug to appear. Also i remember trying different plugin systems in the past (pathogen, etc) but the problem was still there. I will close the bug since its not related to this plugin but any suggestion is appreciated.....

kustodian commented 6 years ago

I fixed this issue by appending cinkeys-=0# indentkeys-=0# to the yaml.ansible file type line in ~/.vimrc, for example:

autocmd Filetype yaml.ansible setlocal tabstop=2 shiftwidth=2 expandtab cinkeys-=0# indentkeys-=0#