blob: d06824d34289180f24b0b34868e55c1f0fe6eff9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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
|