Syntastic NASM Checker
Asked Answered
T

4

7

So I've been doing some work in my Assembly class for college, and I use Vim as my primary code editor. I'm having a problem with Syntastic where I'm writing assembly for NASM, but Syntastic only wants to run the gcc error checker (which tells me all my code is wrong). I tried to run the NASM checker explicitly with SyntasticCheck nasm but that didn't seem to work. I also attempted to let g:syntastic_asm_checkers = ['nasm'] in my .vimrc but that didn't seem to do anything. How can I get Syntastic to run the NASM checker here?

As a note, I tested this by just writing something like mov eax, to get an error out of NASM.

Titlark answered 25/9, 2015 at 0:54 Comment(3)
:set ft? what it shows?Spastic
Did you look at the list of checkers? nasm is a checker for filetype nasm, not asm.Jeffersonjeffery
@HuStmpHrrr : Vim shows that it wasn't detecting the filetype when I was entering your command. I did some more research and apparently it's a known problem that Vim doesn't detect the .nasm filetype as detailed here. Everything worked again after I set filetype=nasm. Thanks! @SatoKatsura : You were right, nasm is a checker for filetype nasm. For some reason I was under the impression that I could still run it anyway. I'll have to look more into getting vim to recognize the nasm filetype...Titlark
T
-1

As mentioned in the comments above, it turns out nasm only works for files with a nasm file extension. After renaming my file to <file>.nasm I discovered that vim doesn't automatically detect the nasm filetype after running set ft?, so I'll have to modify my .vimrc to support the extension.

Titlark answered 25/9, 2015 at 15:42 Comment(1)
you can type :autocmd BufRead and :autocmd BufEnter and find filetypedetect section to check if your vim implementation recognize the file extension or it is a real bug.Spastic
F
4

You need to either

  • force the association between .asm with nasm. Just add this anywhere in your .vimrc

    autocmd BufNewFile,BufRead *.asm set filetype=nasm
    
  • use the .nasm extension. Then everything will just work.

Friedly answered 25/4, 2017 at 1:6 Comment(1)
Could you please edit in an explanation of why this code answers the question? Code-only answers are discouraged, because they don't teach the solution.Dune
H
0

I edited the file nasm.vim in ~/.vim/bundle/syntastic/syntax_checkers/nasm to work for asm and saved the edited file in ~/.vim/bundle/syntastic/syntax_checkers/asm with the same name nasm.vim. Doing so, you can put let g:syntastic_asm_checkers = ['nasm'] into your .vimrc configuration and it works just fine :)

You can find the edited file as well as some details on https://srv2.mysnet.me/casm/tutorial/vim-configuration.

Well, I know that it has been a few years old question, but it'll help others at east, I hope. (at least I was looking for an answer myself until I figured out tweaking the files might work out thanks to @netskink :D)

Heriot answered 1/8, 2018 at 10:19 Comment(0)
T
-1

As mentioned in the comments above, it turns out nasm only works for files with a nasm file extension. After renaming my file to <file>.nasm I discovered that vim doesn't automatically detect the nasm filetype after running set ft?, so I'll have to modify my .vimrc to support the extension.

Titlark answered 25/9, 2015 at 15:42 Comment(1)
you can type :autocmd BufRead and :autocmd BufEnter and find filetypedetect section to check if your vim implementation recognize the file extension or it is a real bug.Spastic
H
-1

For what its worth, I tried to dork with the files:

plugins/syntastic/registry.vim
syntax_checkers/nasm/nasm.vim
syntax_checkers/asm/gcc.vim

To disable .asm syntax and replace it with nasm syntax but it did not work. I could the errors to go away but I could not get the snytax coloring or checker to work automatically. I reverted my changes and just do this instead:

:SyntasticCheck nasm
:set filetype=nasm
:SyntasticCheck nasm

After the second syntasticcheck command, it will have syntax coloring and nasm syntax checking enabled. Not sure why it takes two passes.

Hospitalize answered 22/2, 2016 at 3:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.