Quick notes for VIM scripts

Source: Internet
Author: User

Today, I studied the scripting knowledge of vim and tried to write a simple script. Of course, the script is simple and the method used is clumsy. However, this is only the beginning, and later with a deep understanding of the VIM syntax, will continue to optimize the script. Record them first.

"Annotation.vim"version:1.0ifExists ("G:zsl_loaded_annotation") | | &AMP;CP | | V:version < 700Finishendiflet g:zsl_loaded_annotation= 1 "For Java & c/c++function Annotationj () Call Annotationbase ("/*", "*/") Endfunction" forPerlfunctionAnnotationp () Call Annotationbase ("\#") Endfunction"For shellfunction AnnotationS () Call Annotationbase ('"‘) endfunction "for Xmlfunction Annotationx () Call Annotationbase (" \<--","!--\> ") endfunction" basic functions function  Annotationbase (...)  Let time = ' 2016-01-01 ' Let Anno = ' modify by zhangshui time begin ' Let CurLine = Line (".") echo a:1 If a:0 = = 1 Let anno = a:1. " ". Anno ElseIf a:0 = = 2 Let Anno = a:1." ". Anno." ". A:2 endif if exists (" *strftime ") Let time = Strftime ("%y-%m-%d ") endif Let Anno = Substitute (anno," Time ", Time, ‘‘Call append (CurLine, anno) call append (curline+1, Substitute (anno, "Begin", "End",‘‘)) +1endfunction

Quick notes for VIM scripts

Related Article

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.