diff options
| author | Anton Bobov <abobov@gmail.com> | 2013-01-10 04:31:43 +0000 |
|---|---|---|
| committer | Anton Bobov <abobov@gmail.com> | 2013-04-16 09:55:26 +0000 |
| commit | 0c08d59fae1e0b2c00af83c11298e15e06733af9 (patch) | |
| tree | 3cce1e8f62ef5d6862b8732d156274321bb4d8d4 /files/.vim/ftplugin/yaml.vim | |
| parent | c186c909c2b2ea6929d9a8cf8f935cb384ba4b6b (diff) | |
Vim plugins.
Diffstat (limited to 'files/.vim/ftplugin/yaml.vim')
| -rwxr-xr-x | files/.vim/ftplugin/yaml.vim | 32 |
1 files changed, 32 insertions, 0 deletions
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,*<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:
|
