VIM has a beautiful feature of converting the code into a html formatted code. When you apply syntax highlighting, the code gets beautified. But when you need to copy and visualize the code some where else.. the copy does not actually copy the formatting along with it.
Vim has a menu option of converting the code into html syntax.
Syntax -> Convert to HTML.
This looks cool, but if you have some bunch of files and you have to convert them to html..
The savior is writing some script to automate this
The tag that does HTML conversion is this:
:.,$TOhtml
Now you can automate this:
Write this in a vim script. Lets name it as "test.vim"
zR
:set autochdir
:.,$TOhtml
:wqa
:set autochdir
:.,$TOhtml
:wqa
How to run over a file:
vim -s test.vim test.sv
Now this will generate test.sv.html file in the file directory.
Point to note: Your .vimrc should contain the setting the automatic file type.
Now i took the file name as "sv". When i open GVIM/VIM, the sv (system verilog) syntax gets automatically highlighted.
Point to note: Your .vimrc should contain the setting the automatic file type.
Now i took the file name as "sv". When i open GVIM/VIM, the sv (system verilog) syntax gets automatically highlighted.
Comments
Post a Comment