urbit/extras/hoon.vim/indent/hoon.vim
benjamin-tlon 3c3f7e761e
Misc cleanup blocking CC-Release. (#1249)
* Move extraneous stuff out of pkg/urbit/*
* s/urb/herb/g
* Removed some boilerplate for `urbit` builds.
* Build urbit tests and run them in the nix build.
2019-04-24 17:27:27 -07:00

37 lines
563 B
VimL

" Public Domain
" Credit Goes to fode
"
" With contributions from Philip C Monk
if exists("b:did_indent")
finish
endif
let b:did_indent = 1
setlocal indentexpr=HoonIndent(v:lnum)
setlocal nolisp
setlocal autoindent
if exists("*HoonIndent")
finish
endif
function! HoonIndent(lnum)
let prevlnum = prevnonblank(a:lnum-1)
if prevlnum == 0
return 0
endif
let prevl = substitute(getline(prevlnum),'::.*$','','')
let ind = indent(prevlnum)
if prevl =~ '++\s*\w*\s*$'
" luslus operator
let ind += &sw
endif
return ind
endfunction