Merge branch 'hack/autopaste'
[vim-kana.git] / runtime / indent / readline.vim
blob6ac2185bdc6aa1028c764e4f762664f3ef7eb24b
1 " Vim indent file
2 " Language:         readline configuration file
3 " Maintainer:       Nikolai Weibull <now@bitwi.se>
4 " Latest Revision:  2006-12-20
6 if exists("b:did_indent")
7   finish
8 endif
9 let b:did_indent = 1
11 setlocal indentexpr=GetReadlineIndent()
12 setlocal indentkeys=!^F,o,O,=$else,=$endif
13 setlocal nosmartindent
15 if exists("*GetReadlineIndent")
16   finish
17 endif
19 function GetReadlineIndent()
20   let lnum = prevnonblank(v:lnum - 1)
21   if lnum == 0
22     return 0
23   endif
25   let ind = indent(lnum)
27   if getline(lnum) =~ '^\s*$\(if\|else\)\>'
28     let ind = ind + &sw
29   endif
31   if getline(v:lnum) =~ '^\s*$\(else\|endif\)\>'
32     let ind = ind - &sw
33   endif
35   return ind
36 endfunction