How can I make vim open certain types of files using special syntax highlighting?

I want vim to open all * .asm files with the syntax set to nasm, so I don’t have to type :set syntax=nasmevery time I run vim.

I'm sure there is something that I can attach to my .vimrc file?

+5
source share
2 answers

Add this to your vimrc file

au BufRead,BufNewFile *.asm set filetype=nasm

At any time, when the buffer reads or creates a new file with the extension .asm, it will format it with the file syntaxnasm

aushortened for autocmd, you can find out more using:h au

+7
source

Using:

let asmsyntax="nasm"

in your .vimrc

0
source

All Articles