Looking for the name of a vim plug-in that automatically adds file headers (picture included)
大家讲道理
大家讲道理 2017-05-16 16:40:17
0
3
850

As shown in the figure, when using vim to open a new file (such as a.cpp), the file header is automatically added. I would like to ask which plugin can do this. Thanks.

大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

reply all(3)
曾经蜡笔没有小新

c.vim

漂亮男人

No plug-ins are required, just configure it, such as this article (Configuring vim to automatically add author information in the source code)
If you want to create a file to add automatically, you can first save the default file in a file, and then add code similar to the following in .vimrc:

au BufNewFile *.xml 0r ~/.vim/xml.skel | let IndentStyle = "xml"
au BufNewFile *.html 0r ~/.vim/html.skel | let IndentStyle = "html"

For plug-ins, try the ones listed on this page.


Source

为情所困
    function MyCopy(type, position) 
    if a:position == 'start'
        let line_num = line(".")
    else
        let line_num = a:position
    endif
    if a:type == "class" 
        call setline(line_num,"/**") 
        call append(line_num+0," * $RCSfile$ ".expand("%")) 
        call append(line_num+1," * @touch date ".strftime("%c")) 
        call append(line_num+2," * @author Rambo Lee <blabalbal#babab>") 
        call append(line_num+3," * @package ") 
        call append(line_num+4," * @link http://lanbolee.com/") 
        call append(line_num+5," * @Copyright © ".strftime("%Y")." All rights reserved.") 
        call append(line_num+6," * @license http://www.zend.com/license/3_0.txt PHP License 3.0") 
        call append(line_num+7," * @version $Id$ ") 
        call append(line_num+8," * @filesource ") 
        call append(line_num+9," */") 
    else 
        if a:type == "func" 
            call setline(line_num," /**") 
            call append(line_num+0," * @access ") 
            call append(line_num+1," * @author Rambo Lee <blabalbal#babab>") 
            call append(line_num+2," * @param") 
            call append(line_num+3," * @return") 
            call append(line_num+4," */") 
        else 
            call setline(line_num," /**") 
            call append(line_num+0," * @access ") 
            call append(line_num+1," * @var ") 
            call append(line_num+2," */") 
        endif 
    endif
endfunction

map <C-I> <Esc>:call MyCopy("class",'start')<CR><Esc>10j$a
map df <Esc>:call MyCopy("func", 'start')<CR><Esc>
map dv <Esc>:call MyCopy("var", 'start')<CR><Esc>

Share .vimrc. I watched others implement it this way, and then I slightly innovated it myself.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!