Automatically write to tile
Autocmd bufnewfile *.py,*.pl Exec ": Call Settitle ()"
The new Python
"Define function Settitle, insert file headers automatically
Func Settitle ()
"If the file type is. python file
if &filetype = = ' Python '
Call Setline (1, "\#!/usr/bin/env python")
Call Append ("."), "\#-*-Coding=utf8-*-")
endif
if &filetype = = ' Perl '
Call Setline (1, "\#!/usr/bin/env Perl")
Call Append (Line ("."), "##################################")
endif
Call Append (Line (".") +1, "\# Author:vinson")
Call Append (Line (".") +2, "\# Created Time:". Strftime ("%c"))
Call Append (Line (".") +3, "\# File Name:". Expand ("%")
Call Append (Line (".") +4, "\# Description:")
Call Append (Line (".") +5, "##################################")
Endfunc
Comment
You can view the current file type by: Set filetypeMatching Begin/endYou can see runtime macros/matchit.vim add "let the Matchit plugin know what items can be matched in. vimrc."
"
runtime! Macro/matchit.vim
if exists (' Loaded_matchit ')
Let B:match_ignorecase=0
Let b:match_words=
\ ' \<begin\>:\<end\>, '.
\ ' \<if\>:\<else\>, '.
\ ' \<module\>:\<endmodule\>, '.
\ ' \<class\>:\<endclass\>, '.
\ ' \<program\>:\<endprogram\>, '.
\ ' \<clocking\>:\<endclocking\>, '.
\ ' \<property\>:\<endproperty\>, '.
\ ' \<sequence\>:\<endsequence\>, '.
\ ' \<package\>:\<endpackage\>, '.
\ ' \<covergroup\>:\<endgroup\>, '.
\ ' \<primitive\>:\<endprimitive\>, '.
\ ' \<specify\>:\<endspecify\>, '.
\ ' \<generate\>:\<endgenerate\>, '.
\ ' \<interface\>:\<endinterface\>, '.
\ ' \<function\>:\<endfunction\>, '.
\ ' \<task\>:\<endtask\>, '.
\ ' \<case\>\|\<casex\>\|\<casez\>:\<endcase\>, '.
\ ' \<fork\>:\<join\>\|\<join_any\>\|\<join_none\>, '.
\ ' Ifdef\>: ' Else\>: ' Endif\>, '.
\ ' \<generate\>:\<endgenerate\>, '
endif
SystemVerilog Gvim Folding
Setlocal foldmethod=expr
Set foldexpr=myfoldexpr (V:lnum)
function! MYFOLDEXPR (line)
Let str = getline (a:line)
If str =~ ' ^\s*task\s ' | | Str =~ ' ^\s*function\s '
Return ' A1 '
ElseIf str =~ ' ^\s*endtask ' | | Str =~ ' ^\s*endfunction '
Return ' s1 '
ElseIf str=~ ' Uvm_\w*_utils_begin '
Return ' A1 '
ElseIf str=~ ' Uvm_\w*_utils_end '
Return ' s1 '
ElseIf str =~ ' \sbegin\s* '
Return ' A2 '
ElseIf str =~ ' \send\s* '
Return ' s2 '
Else
Return-1
endif
Endfunction