vimrc
2015-10-28 23:09
190 查看
windows
View Code
" All system-wide defaults are set in $VIMRUNTIME/debian.vim and sourced by " the call to :runtime you can find below. If you wish to change any of those " settings, you should do it in this file (/etc/vim/vimrc), since debian.vim " will be overwritten everytime an upgrade of the vim packages is performed. " It is recommended to make changes after sourcing debian.vim since it alters " the value of the 'compatible' option. " This line should not be removed as it ensures that various options are " properly set to work with the Vim-related packages available in Debian. runtime! debian.vim " Uncomment the next line to make Vim more Vi-compatible " NOTE: debian.vim sets 'nocompatible'. Setting 'compatible' changes numerous " options, so any other options should be set AFTER setting 'compatible'. "set compatible " Vim5 and later versions support syntax highlighting. Uncommenting the next " line enables syntax highlighting by default. if has("syntax") syntax on endif " If using a dark background within the editing area and syntax highlighting " turn on this option as well "set background=dark " Uncomment the following to have Vim jump to the last position when " reopening a file "if has("autocmd") " au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif "endif " Uncomment the following to have Vim load indentation rules and plugins " according to the detected filetype. "if has("autocmd") " filetype plugin indent on "endif " The following are commented out as they cause vim to behave a lot " differently from regular Vi. They are highly recommended though. set showcmd " Show (partial) command in status line. set showmatch " Show matching brackets. "set ignorecase " Do case insensitive matching "set smartcase " Do smart case matching "set incsearch " Incremental search set autowrite " Automatically save before commands like :next and :make "set hidden " Hide buffers when they are abandoned set mouse=a " Enable mouse usage (all modes) " Source a global configuration file if available if filereadable("/etc/vim/vimrc.local") source /etc/vim/vimrc.local endif set nu set tabstop=4 set softtabstop=4 set shiftwidth=4 "set smartindent set cursorline set ruler "set autoindent set showcmd "set formatoptions=tcrqn "自动格式化 set clipboard+=unnamed set autowrite "set confirm set smarttab set history=1000 set autoread "禁止生成临时文件 set nobackup set noswapfile set foldenable "允许折叠 set foldmethod=manual "手动折叠 " 匹配括号高亮的时间(单位是十分之一秒) set matchtime=1 set backspace=2 " 允许backspace和光标键跨越行边界 auto BufNewFile *.cpp exec ":call SetTitle()" func SetTitle() if &filetype == 'cpp' call setline(1,"#include <cstdio>") call append(line("."),"#include <queue>") call append(line(".")+1,"#include <cstring>") call append(line(".")+2,"#include <iostream>") call append(line(".")+3,"#include <cstdlib>") call append(line(".")+4,"#include <algorithm>") call append(line(".")+5,"#include <vector>") call append(line(".")+6,"#include <map>") call append(line(".")+7,"#include <set>") call append(line(".")+8,"#include <ctime>") call append(line(".")+9,"#include <cmath>") call append(line(".")+10,"#include <cctype>") call append(line(".")+11,"#define MAX 100000") call append(line(".")+12,"#define LL long long") call append(line(".")+13,"using namespace std;") call append(line(".")+14,"int main()") call append(line(".")+15,"{") call append(line(".")+16," //freopen(\"/home/user/桌面/in\",\"r\",stdin);") call append(line(".")+17," ") call append(line(".")+18," //printf(\"time=%.3lf\",(double)clock()/CLOCKS_PER_SEC);") call append(line(".")+19," return 0;") call append(line(".")+20,"}") endif autocmd BufNewFile * normal G endfunc "键盘命令 """""""""""""""""""""""""""""""""""""""""""""""""" nmap <leader>w :w!<cr> nmap <leader>f :find<cr> "映射全选+复制 ctrl+a map <C-A> <Esc>ggVGY map! <C-A> <Esc>ggVGY map <F12> gg=G "选中状态下 ctrl+c 复制 vmap <C-c> "+y "C,C++ 按F5编译运行 map <F5> :call CompileRunGcc()<CR> func! CompileRunGcc() exec "w" if &filetype == 'c' exec "!g++ % -o %<" exec "! %<.exe" elseif &filetype == 'cpp' exec "!g++ % -o %<" exec "! %<.exe" elseif &filetype == 'java' exec "!javac %" exec "!java %<.class" elseif &filetype == 'sh' :!%.sh endif endfunc "自动补全 inoremap ( ()<ESC>i inoremap ) <c-r>=ClosePair(')')<CR> inoremap { {<CR>}<ESC>O inoremap } <c-r>=ClosePair('}')<CR> inoremap [ []<ESC>i inoremap ] <c-r>=ClosePair(']')<CR> "inoremap " ""<ESC>i "inoremap ' ''<ESC>i function! ClosePair(char) if getline('.')[col('.') - 1] == a:char return "\<Right>" else return a:char endif endfunction filetype plugin indent on "打开文件类型检测, 加了这句才可以用智能补全 set completeopt=longest,menu """"""""""""""""""""""""'"" " 显示相关 " """"""""""""""""""" " "set shortmess=atI " 启动的时候不显示那个援助乌干达儿童的提示 winpos -4 -4 " 设定窗口位置 set lines=40 columns=170 " 设定窗口大小 " "set nu " 显示行号 " set go= " 不要图形按钮 " "color asmanian2 " 设置背景主题 " set guifont=Courier_New:h10:cANSI " 设置字体 " "syntax on " 语法高亮 " autocmd InsertLeave * se nocul " 用浅色高亮当前行 autocmd InsertEnter * se cul " 用浅色高亮当前行 " "set ruler " 显示标尺 " set showcmd " 输入的命令显示出来,看的清楚些 " "set cmdheight=1 " 命令行(在状态行下)的高度,设置为1 set whichwrap+=<,>,h,l " 允许backspace和光标键跨越行边界(不建议) " "set scrolloff=3 " 光标移动到buffer的顶部和底部时保持3行距离 set novisualbell " 不要闪烁(不明白) " set statusline=%F%m%r%h%w\ [FORMAT=%{ " &ff}]\ [TYPE=%Y]\ [POS=%l,%v][%p%%]\ %{ " strftime(\"%d/%m/%y\ -\ %H:%M\")} "状态行显示的内容 " set laststatus=1 " 启动显示状态行(1),总是显示状态行(2) " set foldenable " 允许折叠 " set foldmethod=manual " 手动折叠 " "set background=dark "背景使用黑色 " set nocompat
View Code
相关文章推荐
- yii2视频教程
- TOP 10 开源的推荐系统简介
- UiDevice的UiObject的讲解
- 一道题(1)
- 第一篇博客-初入Android解决Fetching Android SDK component information问题
- 小白笔记--------------------链栈
- 大三CS狗一点想法
- 怎样在spring初始化完成后执行一些操作?
- List集合拆分
- LightOJ - 1068 Investigation(数位DP)
- dropzone
- USB鼠标通信协议格式
- zoj3911 线段树区间修改与求素数的结合
- js xuexi
- 第七次作业——团队作业——项目冲刺———第一天
- 黑马程序员——Java 基础:匿名内部类
- java springmvc 微信公众平台自动回复乱码问题
- Ubuntu学习 - SVN服务搭建
- 数据库(SQL Server)管理数据库表~新奇之处
- 在活动中使用Menu