码迷,mamicode.com
首页 > 其他好文 > 详细

个人vim配置文件

时间:2014-06-08 09:45:09      阅读:286      评论:0      收藏:0      [点我收藏+]

标签:acm   acm-icpc   vim   配置文件   

  acm菜鸡必备
  1 runtime! debian.vim
  2 if has("syntax")
  3   syntax on
  4 endif
  5 if filereadable("/etc/vim/vimrc.local")
  6   source /etc/vim/vimrc.local
  7 endif
  8 "syntax high light
  9 syntax on
 10 "show the line number
 11 set nu
 12 "为c程序提供自动缩进
 13 set smartindent
 14 "使用c程序的自动缩进
 15 set cindent
 16 "设置缩进的空格数为4
 17 set shiftwidth=4
 18 "设置制表符
 19 set tabstop=4
 20 set softtabstop=4
 21 "匹配模式()
 22 set showmatch
 23 "不保留备份文件
 24 set nobackup
 25 "配色方案
 26 colorscheme slate
 27 "中文显示
 28 set fileencodings=utf-8,gb2312,gbk,gb18030
 29 set termencoding=utf-8
 30 set encoding=prc
 31 "字体
 32 "自动插入头文件
 33 autocmd BufNewFile *.cpp exec ":call SetTitle()"
 34 func SetTitle()
 35     if &filetype =='cpp'
 36     call setline(1,"// file name: ".expand("%")."                               //")
 37     call append(line("."),"// author: huangjipeng                               //")
 38     call append(line(".")+1,"// creat time: ".strftime("%c")."    //")
 39     call append(line(".")+2,"///////////////////////////////////////////////////////")
 40     call append(line(".")+3,"#include<iostream>")
 41     call append(line(".")+4,"#include<cstdio>")
 42     call append(line(".")+5,"#include<cstdlib>")
 43     call append(line(".")+6,"#include<string.h>")
 44     call append(line(".")+7,"#include<math.h>")
 45     call append(line(".")+8,"#include<algorithm>")
 46     call append(line(".")+9,"#include<map>")
 47     call append(line(".")+10,"#include<vector>")
 48     call append(line(".")+11,"#include<queue>")
 49     call append(line(".")+12,"using namespace std;")
 50     call append(line(".")+13,"#define MAXN 1")
 51     call append(line(".")+14,"int main()")
 52     call append(line(".")+15,"{")
 53     call append(line(".")+16,"    return 0;")
 54     call append(line(".")+17,"}")
 55     endif
 56     "新建文件时定位到文件尾
 57     autocmd BufNewFile * normal G
 58 endfunc
 59 map <F9> :call CompileCpp()<CR>
 60 function CompileCpp()
 61      set makeprg=g++\ -o\ %<\ %
 62      silent make
 63      let myfile=expand("%:r")
 64      if filereadable(myfile)
 65          execute "! ./%< && rm ./%<"
 66      else
 67          cope5
 68      endif
 69 endfunction

个人vim配置文件,布布扣,bubuko.com

个人vim配置文件

标签:acm   acm-icpc   vim   配置文件   

原文地址:http://blog.csdn.net/accepthjp/article/details/28871565

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!