Gvim Usage for systemverilog__environment

Source: Internet
Author: User
Tags define function
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\&gt, '.
\ ' \<if\>:\<else\&gt, '.
\ ' \<module\>:\<endmodule\&gt, '.
\ ' \<class\>:\<endclass\&gt, '.
\ ' \<program\>:\<endprogram\&gt, '.
\ ' \<clocking\>:\<endclocking\&gt, '.
\ ' \<property\>:\<endproperty\&gt, '.
\ ' \<sequence\>:\<endsequence\&gt, '.
\ ' \<package\>:\<endpackage\&gt, '.
\ ' \<covergroup\>:\<endgroup\&gt, '.
\ ' \<primitive\>:\<endprimitive\&gt, '.
\ ' \<specify\>:\<endspecify\&gt, '.
\ ' \<generate\>:\<endgenerate\&gt, '.
\ ' \<interface\>:\<endinterface\&gt, '.
\ ' \<function\>:\<endfunction\&gt, '.
\ ' \<task\>:\<endtask\&gt, '.
\ ' \<case\>\|\<casex\>\|\<casez\>:\<endcase\&gt, '.
\ ' \<fork\>:\<join\>\|\<join_any\>\|\<join_none\&gt, '.
\ ' 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


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.