diff options
author | Cody Hiar <chiar@hybridforge.com> | 2015-08-12 11:51:04 -0600 |
---|---|---|
committer | Cody Hiar <chiar@hybridforge.com> | 2015-08-12 11:51:04 -0600 |
commit | 72d653e1e0cffe2e48bd7a393acf08c96d6db50a (patch) | |
tree | 6c870fd1fa4737103fe728b1438c27ac6863fc75 /indent |
Inidiat commit of working files
Diffstat (limited to 'indent')
-rw-r--r-- | indent/yaml.vim | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/indent/yaml.vim b/indent/yaml.vim new file mode 100644 index 0000000..1b1ded3 --- /dev/null +++ b/indent/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,*<Return>,!^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: |