add vim-yaml
This commit is contained in:
parent
fb348aa24b
commit
62fa7501cc
4
vim/bundle/vim-yaml/README.md
Normal file
4
vim/bundle/vim-yaml/README.md
Normal file
@ -0,0 +1,4 @@
|
||||
# For pathogen
|
||||
|
||||
Thanks: https://gist.github.com/871107
|
||||
|
37
vim/bundle/vim-yaml/after/ftplugin/yaml.vim
Normal file
37
vim/bundle/vim-yaml/after/ftplugin/yaml.vim
Normal 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:
|
Loading…
Reference in New Issue
Block a user