Commit: runtime(asm): add basic indent support

4 views
Skip to first unread message

Christian Brabandt

unread,
Apr 10, 2024, 5:00:09 PM4/10/24
to vim...@googlegroups.com
runtime(asm): add basic indent support

Commit: https://github.com/vim/vim/commit/27f17a6d3493f611f5bdc376217535f9c49b479b
Author: Wu, Zhenyu <wuzh...@ustc.edu>
Date: Wed Apr 10 22:48:57 2024 +0200

runtime(asm): add basic indent support

closes: https://github.com/vim/vim/issues/14383

Signed-off-by: Wu, Zhenyu <wuzh...@ustc.edu>
Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/runtime/indent/asm.vim b/runtime/indent/asm.vim
new file mode 100644
index 000000000..7f848c7b5
--- /dev/null
+++ b/runtime/indent/asm.vim
@@ -0,0 +1,28 @@
+" Vim indent file
+" Language: asm
+" Maintainer: Philip Jones <phi...@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
Reply all
Reply to author
Forward
0 new messages