-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove/modify filetype indent for asm files #14791
Comments
ping @philj56 |
I ran into this too: |
@zack466 Hey, sorry for the slow response. I think that's a pretty reasonable argument; this was a originally a very minimal-effort file for my personal use. It's included in vim because at least one other person wanted it (The original PR's at #14383). I don't have any particularly strong opinions on it staying in or not, so if it's annoying multiple people, it's probably best off removed. It could also be modified to be much less zealous in its indenting while still achieving my original goals, by changing the function! GetAsmIndent()
let line = getline(v:lnum)
" If the line is a label (starts with ':' terminated keyword),
" then don't indent
if line =~ '^\s*\k\+:'
let ind = 0
else
" If the previous line was a label, indent:
if getline(v:lnum - 1) =~ '^\s*\k\+:'
let ind = s:buffer_shiftwidth()
else
" Let autoindent handle everything else.
let ind = -1
endif
endif
return ind
endfunction This would mean basically nothing gets touched apart from labels and the lines directly after them. |
Hm, the |
…s too many issues fixes: vim/vim#14791 vim/vim@76174e7 Co-authored-by: Christian Brabandt <cb@256bit.org>
…s too many issues fixes: vim/vim#14791 vim/vim@76174e7 Co-authored-by: Christian Brabandt <cb@256bit.org>
…s too many issues fixes: vim/vim#14791 vim/vim@76174e7 Co-authored-by: Christian Brabandt <cb@256bit.org>
…s too many issues fixes: vim/vim#14791 vim/vim@76174e7 Co-authored-by: Christian Brabandt <cb@256bit.org>
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 atruntime/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:
The current assembly indentation would turn this to: (assuming a shiftwidth of 4)
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 forasm
files at all -- just indenting manually when needed and then lettingautoindent
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.
The text was updated successfully, but these errors were encountered: