From 0c08d59fae1e0b2c00af83c11298e15e06733af9 Mon Sep 17 00:00:00 2001 From: Anton Bobov Date: Thu, 10 Jan 2013 04:31:43 +0000 Subject: Vim plugins. --- files/.vim/ftplugin/yaml.vim | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100755 files/.vim/ftplugin/yaml.vim (limited to 'files/.vim/ftplugin') diff --git a/files/.vim/ftplugin/yaml.vim b/files/.vim/ftplugin/yaml.vim new file mode 100755 index 0000000..ca3abe2 --- /dev/null +++ b/files/.vim/ftplugin/yaml.vim @@ -0,0 +1,32 @@ +" Vim indent file +" Language: Yaml +" Author: Ian Young +" Get it bundled for pathogen: https://github.com/avakhov/vim-yaml + +if exists("b:did_indent") + finish +endif +"runtime! indent/ruby.vim +"unlet! b:did_indent +let b:did_indent = 1 + +setlocal autoindent sw=2 et +setlocal indentexpr=GetYamlIndent() +setlocal indentkeys=o,O,*,!^F + +function! GetYamlIndent() + let lnum = v:lnum - 1 + if lnum == 0 + return 0 + endif + let line = substitute(getline(lnum),'\s\+$','','') + let indent = indent(lnum) + let increase = indent + &sw + if line =~ ':$' + return increase + else + return indent + endif +endfunction + +" vim:set sw=2: -- cgit v1.2.3