Vim is not properly indenting assembly code, regardless of if I want it to do it automatically or if I try gg=G it'll just says ## lines indented even though it didn't change anything and all my text is still left-aligned.
Asked
Active
Viewed 4,750 times
5
garyjohn
- 36,494
user339365
- 195
4 Answers
1
It appears that Vim does not do indenting of assembly out of the box. Looking in the /usr/share/vim/vim74/indent directory of Vim 7.4.335, there are no file names containing "asm" and neither grep -i asm * nor grep -i assembl * return any matches.
You could write your own indent plugin. See :help indent-expression for a start.
garyjohn
- 36,494
0
Maybe vim didn't recognize filetype? Try
:set ft=nasm
and then run your indenting command.
or other options listed here https://stackoverflow.com/questions/782384/assembly-vim-syntax-highlighting
0
I know this method isn't perfect, but it may be useful to you:
cp /usr/share/vim/vim74/indent/python.vim ~/.vim/indent/nasm.vim
It will indent on a line after one that ends with :.
However, it won't unindent when you type a new label. Perhaps another syntax file would do the job.
antoyo
- 203