pearofducks / ansible-vim

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

breaks AutoIndent and SmartIndent #52

Closed dminca closed 6 years ago

dminca commented 6 years ago

Having the following configs in ~/.vimrc

filetype plugin indent on
set ai
set si

Testing inside ansible task:

- name: deploy template
  template:
  src: foo.j2
  dest: /etc/foo

after hitting ENTER after template: it's not auto-indenting src: (and whatever comes next) with 2 spaces.

Compare this behavior between :set filetype=yaml and :set filetype=ansible

pearofducks commented 6 years ago

This is by design*. You should be able to overwrite this behavior with an autocommand as mentioned on the README.

pearofducks commented 6 years ago

Actually I'm not even able to reproduce this behavior when template: is blank.

This seems to be something inside your config function GetAnsibleIndent(lnum) is responsible for setting indent, and is working properly.

pearofducks commented 6 years ago

Let me know if you're able to provide a reproduction, I can't reproduce this against master or v2 using this vimrc. Tested against both latest Vim and Neovim.

set nocp
call plug#begin('~/.vim/plugged')
Plug 'pearofducks/ansible-vim'
call plug#end()
filetype plugin indent on
syntax on
set ai
set si
dminca commented 6 years ago

My full vimrc, I was able to reproduce the bug with this one. I'll need to test with plugins disabled as well