Description
I feel like the current filetype indent plugin for asm
files, which appears to have been added to the repo about a month ago, is not very helpful for assembly programming (located at runtime/indent/asm.vim
) and should be removed or modified.
The current indenting behavior is: every line is indented except for labels (keywords that end with a colon). IMO, this is pretty much useless (and actually a little annoying) for most assembly languages - this causes comments, labels (depending on the syntax being used), assembler directives, and preprocessor macros to all be incorrectly indented.
For example, here is something I think would be reasonable in a generic assembler syntax:
#define EIGHT (1 << 3)
.data
msg db "Hello, world!"
.code
; Some documentation for this function
; Some more documentation...
foo:
LDI R16, 0x80
ADD R16, R16
The current assembly indentation would turn this to: (assuming a shiftwidth of 4)
#define EIGHT (1 << 3)
.data
msg db "Hello, world!"
.code
; Some documentation for this function
; Some more documentation...
foo:
LDI R16, 0x80
ADD R16, R16
I don't think this is the way assembly code is typically indented...
I understand that you can easily turn this behavior off (I added autocmd FileType asm setlocal indentexpr=
to my .vimrc
), but I don't think it should be the default in the first place. Personally, I don't think there needs to be custom indentation behavior for asm
files at all -- just indenting manually when needed and then letting autoindent
figure it out is flexible and makes the most sense (and as far as I can tell, has been the default for a while). I would be interested in seeing what the general consensus is.
For context, my current use case is AVR assembly.