diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2017-11-07 03:16:52 +0100 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2017-11-07 03:23:37 +0100 |
commit | 8c3377ee76e5cc4f5a4228f216bde1d03b496d69 (patch) | |
tree | e183185d55b8ff85aad5e305a7895109562159ee /runtime/indent/verilog.vim | |
parent | 1a3e54231ab8b2fc29f5a37931713061ac400faa (diff) | |
download | rneovim-8c3377ee76e5cc4f5a4228f216bde1d03b496d69.tar.gz rneovim-8c3377ee76e5cc4f5a4228f216bde1d03b496d69.tar.bz2 rneovim-8c3377ee76e5cc4f5a4228f216bde1d03b496d69.zip |
vim-patch:c572da5f67aa
Update runtime files
https://github.com/vim/vim/commit/c572da5f67aa5cdbbc127fc6f1d0a42e38468325
Diffstat (limited to 'runtime/indent/verilog.vim')
-rw-r--r-- | runtime/indent/verilog.vim | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/runtime/indent/verilog.vim b/runtime/indent/verilog.vim index 6222dc341f..ab3d0ba3e0 100644 --- a/runtime/indent/verilog.vim +++ b/runtime/indent/verilog.vim @@ -1,6 +1,6 @@ " Language: Verilog HDL " Maintainer: Chih-Tsun Huang <cthuang@cs.nthu.edu.tw> -" Last Change: 2017 Feb 24 by Chih-Tsun Huang +" Last Change: 2017 Aug 25 by Chih-Tsun Huang " URL: http://www.cs.nthu.edu.tw/~cthuang/vim/indent/verilog.vim " " Credits: @@ -25,7 +25,8 @@ let b:did_indent = 1 setlocal indentexpr=GetVerilogIndent() setlocal indentkeys=!^F,o,O,0),=begin,=end,=join,=endcase setlocal indentkeys+==endmodule,=endfunction,=endtask,=endspecify -setlocal indentkeys+==`else,=`endif +setlocal indentkeys+==endconfig,=endgenerate,=endprimitive,=endtable +setlocal indentkeys+==`else,=`elsif,=`endif " Only define the function once. if exists("*GetVerilogIndent") @@ -84,7 +85,9 @@ function GetVerilogIndent() endif " Indent after if/else/for/case/always/initial/specify/fork blocks - elseif last_line =~ '`\@<!\<\(if\|else\)\>' || + " Note: We exclude '`if' or '`else' and consider 'end else' + " 'end if' is redundant here + elseif last_line =~ '^\s*\(end\)\=\s*`\@<!\<\(if\|else\)\>' || \ last_line =~ '^\s*\<\(for\|case\%[[zx]]\)\>' || \ last_line =~ '^\s*\<\(always\|initial\)\>' || \ last_line =~ '^\s*\<\(specify\|fork\)\>' @@ -93,8 +96,8 @@ function GetVerilogIndent() let ind = ind + offset if vverb | echo vverb_str "Indent after a block statement." | endif endif - " Indent after function/task blocks - elseif last_line =~ '^\s*\<\(function\|task\)\>' + " Indent after function/task/config/generate/primitive/table blocks + elseif last_line =~ '^\s*\<\(function\|task\|config\|generate\|primitive\|table\)\>' if last_line !~ '\<end\>\s*' . vlog_comment . '*$' || \ last_line =~ '\(//\|/\*\).*\(;\|\<end\>\)\s*' . vlog_comment . '*$' let ind = ind + offset @@ -161,11 +164,11 @@ function GetVerilogIndent() let ind = ind - offset if vverb | echo vverb_str "De-indent after a close statement." | endif - " `ifdef and `else - elseif last_line =~ '^\s*`\<\(ifdef\|else\)\>' + " `ifdef or `ifndef or `elsif or `else + elseif last_line =~ '^\s*`\<\(ifn\?def\|elsif\|else\)\>' let ind = ind + offset if vverb - echo vverb_str "Indent after a `ifdef or `else statement." + echo vverb_str "Indent after a `ifdef or `ifndef or `elsif or `else statement." endif endif @@ -175,7 +178,8 @@ function GetVerilogIndent() " De-indent on the end of the block " join/end/endcase/endfunction/endtask/endspecify if curr_line =~ '^\s*\<\(join\|end\|endcase\)\>' || - \ curr_line =~ '^\s*\<\(endfunction\|endtask\|endspecify\)\>' + \ curr_line =~ '^\s*\<\(endfunction\|endtask\|endspecify\)\>' || + \ curr_line =~ '^\s*\<\(endconfig\|endgenerate\|endprimitive\|endtable\)\>' let ind = ind - offset if vverb | echo vverb_str "De-indent the end of a block." | endif elseif curr_line =~ '^\s*\<endmodule\>' @@ -186,7 +190,7 @@ function GetVerilogIndent() " De-indent on a stand-alone 'begin' elseif curr_line =~ '^\s*\<begin\>' - if last_line !~ '^\s*\<\(function\|task\|specify\|module\)\>' && + if last_line !~ '^\s*\<\(function\|task\|specify\|module\|config\|generate\|primitive\|table\)\>' && \ last_line !~ '^\s*\()*\s*;\|)\+\)\s*' . vlog_comment . '*$' && \ ( last_line =~ \ '\<\(`\@<!if\|`\@<!else\|for\|case\%[[zx]]\|always\|initial\)\>' || @@ -208,10 +212,10 @@ function GetVerilogIndent() echo vverb_str "De-indent the end of a multiple statement." endif - " De-indent `else and `endif - elseif curr_line =~ '^\s*`\<\(else\|endif\)\>' + " De-indent `elsif or `else or `endif + elseif curr_line =~ '^\s*`\<\(elsif\|else\|endif\)\>' let ind = ind - offset - if vverb | echo vverb_str "De-indent `else and `endif statement." | endif + if vverb | echo vverb_str "De-indent `elsif or `else or `endif statement." | endif endif |