Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add syntax highlighting to certain file extensions for VIM or GVIM by default

In my Linux machine files with the .sv extension opens up by default with the verilog syntax highlighting scheme, however extension with .vor .vs don't. I have to manually in gvim do a :set syntax=verilog every time I open one of these files.

How do I make those file extensions .v or .vs open up in a verilog syntax highlighting by default ?

Thanks

like image 380
TheSprintingEngineer Avatar asked Jun 18 '17 14:06

TheSprintingEngineer


People also ask

How do I enable syntax highlighting in Gvim?

After opening login.sh file in vim editor, press ESC key and type ':syntax on' to enable syntax highlighting. The file will look like the following image if syntax highlighting is on. Press ESC key and type, “syntax off” to disable syntax highlighting.

Does vim have syntax highlighting?

VIM is an alternative and advanced version of VI editor that enables Syntax highlighting feature in VI. Syntax highlighting means it can show some parts of text in another fonts and colors. VIM doesn't show whole file but have some limitations in highlighting particular keywords or text matching a pattern in a file.

How do I enable Python syntax highlighting in vim?

The command to enable syntax highlighting in vim is :syntax on , if you want it to be active everytime you launch vim, just add a line containing syntax on in your . vimrc file. maybe your vim doesn't have filetype detection enabled, try adding filetype on to your .

How do you highlight in vim?

If you want to select the entire line in a file, press V. Now when you press k or j to go up and down, vim will select the entire line above and below your cursor. Finally, you can select text in columns by pressing ctrl+v and moving up or down the block.


1 Answers

Add an auto-command to your .vimrc to do that for you:

autocmd BufNewFile,BufRead *.v,*.vs set syntax=verilog
like image 159
sidyll Avatar answered Sep 20 '22 13:09

sidyll