Mercurial > vim
changeset 34876:387127d40fa2
runtime(asm): add basic indent support
Commit: https://github.com/vim/vim/commit/27f17a6d3493f611f5bdc376217535f9c49b479b
Author: Wu, Zhenyu <wuzhenyu@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 <wuzhenyu@ustc.edu>
Signed-off-by: Christian Brabandt <cb@256bit.org>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Wed, 10 Apr 2024 23:00:02 +0200 |
parents | 6231e29aec3d |
children | af649de78695 |
files | runtime/indent/asm.vim |
diffstat | 1 files changed, 28 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
new file mode 100644 --- /dev/null +++ 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