问答详情
源自:1-6 VIM编辑器基本设置(下)

关于自动加入头文件的问题

老师关于添加那一段自动添加头文件的东西,放在  /etc/vimrc  最后可以吗, 还是要放到 指定的位置。

提问者:慕粉3321357 2016-09-28 11:01

个回答

  • _潇潇暮雨
    2016-12-12 22:18:15

    set number
    set autoindent
    set cindent
    
    let $author_name="consoles"
    let $author_email="consoles.me@gmail.com"
    
    function! AutoSetShFileHead()
    if &filetype == 'sh'
    call setline(1, "\#!/bin/bash")
    call append(line("."),"\# filename: ".expand("%"))
    call append(line(".")+1,"\# author: ".$author_name)
    call append(line(".")+2,"\# email: ".$author_email)
    call append(line(".")+3,"\# created time: ".strftime("%c"))
    endif
    
    normal G
    normal o
    normal o
    endfunc

    这个是我的vimrc文件,你可以参考下。我是按照这个教程设置的。

  • big杨
    2016-10-04 17:35:37

    可以放最后