diff options
Diffstat (limited to 'config/old/vim/indent/z80.vim')
-rw-r--r-- | config/old/vim/indent/z80.vim | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/config/old/vim/indent/z80.vim b/config/old/vim/indent/z80.vim new file mode 100644 index 0000000..d06824d --- /dev/null +++ b/config/old/vim/indent/z80.vim @@ -0,0 +1,35 @@ +" borrowed from https://github.com/philj56/vim-asm-indent/blob/master/indent/asm.vim +if exists("b:did_indent") + finish +endif +let b:did_indent = 1 + +setlocal indentexpr=GetAsmIndent() +setlocal indentkeys=<:>,!^F,o,O + +let s:cpo_save = &cpo +set cpo&vim + +function s:buffer_shiftwidth() + return shiftwidth() +endfunction + +function! GetAsmIndent() + let line = getline(v:lnum) + let ind = s:buffer_shiftwidth() + let line_num = v:lnum + + if line_num == 0 + let ind = 0 + endif + " If the line is a label (starts with ':' terminated keyword), + " then don't indent + if line =~ '^\s*\k\+:' + let ind = 0 + endif + return ind +endfunction + +let &cpo = s:cpo_save +unlet s:cpo_save + |