栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > C/C++/C#

vimrc配置,包含.c文件&.h头文件&.sh壳文件

C/C++/C# 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

vimrc配置,包含.c文件&.h头文件&.sh壳文件

在linux终端下敲入        vi ~/.vimrc        即可进入vimrc配置文件

以下内容复制粘贴在vimrc配置文件最后一行即可使用

可以帮你节省时间

autocmd BufNewFile *.py,*.cpp,*.[ch],*.sh,*.java exec ":call SetTitle()" 
func SetTitle()     
    if &filetype == 'c' 
        call append(0, "")
        call append(7, "#include")
        call append(8, "")
        call append(9, "int main(int argc,char *argv[])")
        call append(10, "{")
        call append(12, "    return 0;")
        call append(13, "}")
     endif

      if expand("%:e") == 'h'
       call append(0, "#ifndef _".toupper(expand("%:r"))."_H")
       call append(1, "#define _".toupper(expand("%:r"))."_H")
       call append(3, "")
       call append(4, "#endif")
       endif

     if &filetype == 'sh' 
     call setline(1,"#****************************************************************************************") 
      call append(line("."), "# File Name: ".expand("%")) 
     call append(line(".")+1, "# Author: hxy") 
     call append(line(".")+2, "# mail: ") 
     call append(line(".")+3, "# Created Time:".strftime("%c")) 
     call append(line(".")+4, "#************************************************************************************") 
     call append(line(".")+5, "#!/bin/bash") 
     call append(line(".")+6, "") 
      call append(line(".")+7, "") 
     endif
endfunc
 

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/1017903.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号