blob: 4efa766d4d609da5129bd983731b891927a75fde [file] [log] [blame]
Wu, Zhenyu27f17a62024-04-10 22:48:57 +02001" Vim indent file
Christian Brabandt98b12ed2024-04-25 22:42:05 +02002" Language: asm
3" Maintainer: Philip Jones <philj56@gmail.com>
4" Upstream: https://github.com/philj56/vim-asm-indent
5" Last Change: 2017-Jul-01
6" 2024 Apr 25 by Vim Project (undo_indent)
Wu, Zhenyu27f17a62024-04-10 22:48:57 +02007
8if exists("b:did_indent")
9 finish
10endif
11let b:did_indent = 1
12
13setlocal indentexpr=s:getAsmIndent()
14setlocal indentkeys=<:>,!^F,o,O
15
Christian Brabandt98b12ed2024-04-25 22:42:05 +020016let b:undo_indent = "indentexpr< indentkeys<"
Wu, Zhenyu27f17a62024-04-10 22:48:57 +020017
18function! s:getAsmIndent()
19 let line = getline(v:lnum)
20 let ind = shiftwidth()
21
22 " If the line is a label (starts with ':' terminated keyword),
23 " then don't indent
24 if line =~ '^\s*\k\+:'
25 let ind = 0
26 endif
27
28 return ind
29endfunction