Vim Automatic generation

Source: Internet
Author: User

"Files && folders in the current directory

Let g:netrw_winsize=35

Let g:netrw_liststyle=1
Nmap <silent> <S-l>:sexplore!<cr>


The Generate class

function! Lu_class ()
Call Append (0, "<?php")
Call Append (1, "")
Call Append (2, "/**")
Call Append (3, "* File:". Expand ("%:t"). " Date: ". Strftime ("%y/%m/%d "))
Call Append (4, "* @author Lucifer <[email protected]>")
Call Append (5, "*/")
Call Append (6, "class A extends B {")
Call Append (7, "")
Call Append (8, "/** */")
Call Append (9, "Public function __construct ($id, $module =null) {")
Call Append (10, "")
Call Append (11, "")
Call Append (12, "")
|...call Append (13, "}")
Call Append (14, "")
Call Append (15, "}")

Endfunction


The Build method

function! Lu_func ()
Let L = Line (".")
Call Append (l+0, "/**")
Call Append (l+1, "* note")
Call Append (l+2, "*")
Call Append (l+3, "* @param ...")
Call Append (L+4, "* @author Lucifer <[email protected]>")
Call Append (l+5, "* @return void")
Call Append (L+6, "*/")
Call Append (l+7, "Public function f () {")
Call Append (L+8, "")
Call Append (L+9, "")
Call Append (L+10, "")
Call Append (l+11, "}")
Call Append (l+12, "")
Endfunction


function! Lu_single ()
Let L = Line (".")
Call Append (L, "/** Note * * *")
Call Append (L+1, "")
Endfunction


function! Lu_var ()
Let L = Line (".")
Call Append (l+0, "/**")
Call Append (l+1, "* note")
Call Append (l+2, "* @var type")
Call Append (l+3, "*/")
Call Append (L+4, "")
Endfunction


Map <S-f>: Call Lu_func () <CR>
Map <S-c>: Call Lu_class () <CR>
Map <S-v>: Call Lu_var () <CR>

Vim Automatic generation

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.