I'm now using gvim to write verilog code. When i use the auto indent full text function (command: gg=G), gvim starts to auto indent the full text. However, gvim can recognize "// begin" but can not recognize "// end", which leads to wrong code indents. e.g.(after input command gg=G):
always@(posedge iClk) begin
some codes.....
if(condition....) begin
some codes....
end
//if(condition..) begin
//some commented out codes...
//end
if(condition...) begin
some codes...
end
end
Gvim can recognize the begin in //if(condition) begin, and auto indents the next line //some commented out code.... But when comes to //end, gvim falls to recognize and makes wrong code indents to all the codes below the //end.
Could someone tell me how to solve this problem, please?
This looks like a bug with the standard verilog indent function, part of the standard vim distribution at runtime/indent/verilog.vim
.
A search for verilog indent files on www.vim.org shows four options, including one labeled "bugfixes to vim indent for verilog : bugfixes: previous version was evaluating expressions inside comments". You could try that one, but it is the lowest-rated of the options. You could also try GitHub.