robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
4ad30f775e
master
1" Vim indent file 2" Language: ssh config file 3" Maintainer: JasonKim <git@jasonk.me> 4" Last Change: 2020 May 16 5 6if exists ( "b:did_indent" ) 7finish 8endif 9let b: did_indent = 1 10 11setlocal autoindent 12setlocal indentexpr = GetSshconfigIndent (v:lnum) 13setlocal indentkeys = o,O,*<Return>,0=~host\ ,0=~match\ ,0#,!^F 14 15let b: undo_indent = "setlocal autoindent< indentexpr< indentkeys<" 16 17if exists ( "*GetSshconfigIndent" ) 18finish 19endif 20 21function GetSshconfigIndent ( lnum ) 22let sw = shiftwidth () 23let prev_lnum = prevnonblank ( a: lnum - 1 ) 24let curr_lnum = a: lnum 25let prev_line = getline ( prev_lnum ) 26let curr_line = getline ( curr_lnum ) 27if curr_line =~? '^\s*\(host\|match\)\s' 28return 0 29elseif prev_line =~? '^\s*\(host\|match\)\s' 30return sw 31else 32return indent ( prev_lnum ) 33endif 34endfunction