commit d2d4ad4b32d6444cb50677ce75342273632a44fc
parent 245745f9f0d2efe261970c711d80ee0727983b59
Author: zeertzjq <zeertzjq@outlook.com>
Date: Thu, 11 Apr 2024 18:22:41 +0800
vim-patch:27f17a6d3493
runtime(asm): add basic indent support
closes: vim/vim#14383
https://github.com/vim/vim/commit/27f17a6d3493f611f5bdc376217535f9c49b479b
Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
Diffstat:
1 file changed, 28 insertions(+), 0 deletions(-)
diff --git a/runtime/indent/asm.vim b/runtime/indent/asm.vim
@@ -0,0 +1,28 @@
+" Vim indent file
+" Language: asm
+" Maintainer: Philip Jones <philj56@gmail.com>
+" Upstream: https://github.com/philj56/vim-asm-indent
+" Latest Revision: 2017-07-01
+
+if exists("b:did_indent")
+ finish
+endif
+let b:did_indent = 1
+
+setlocal indentexpr=s:getAsmIndent()
+setlocal indentkeys=<:>,!^F,o,O
+
+let b:undo_ftplugin .= "indentexpr< indentkeys<"
+
+function! s:getAsmIndent()
+ let line = getline(v:lnum)
+ let ind = shiftwidth()
+
+ " 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