add vim-yaml

This commit is contained in:
Flo 2019-04-15 23:19:34 +02:00
parent fb348aa24b
commit 62fa7501cc
2 changed files with 41 additions and 0 deletions

View File

@ -0,0 +1,4 @@
# For pathogen
Thanks: https://gist.github.com/871107

View File

@ -0,0 +1,37 @@
" Vim indent file
" Language: Yaml
" Author: Ian Young
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 prevlnum = v:lnum - 1
if prevlnum == 0
return 0
endif
let line = substitute(getline(v:lnum),'\s\+$','','')
let prevline = substitute(getline(prevlnum),'\s\+$','','')
let indent = indent(prevlnum)
let increase = indent + &sw
let decrease = indent - &sw
if prevline =~ ':$'
return increase
elseif prevline =~ '^\s\+\-' && line =~ '^\s\+[^-]\+:'
return decrease
else
return indent
endif
endfunction
" vim:set sw=2: