Created
May 17, 2016 01:42
-
-
Save wgm89/cf5a90e8dc43af5f14a5cf962f96a5ae to your computer and use it in GitHub Desktop.
vim config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set nocompatible " be iMproved, required | |
filetype off " required | |
" set the runtime path to include Vundle and initialize | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
" alternatively, pass a path where Vundle should install plugins | |
"call vundle#begin('~/some/path/here') | |
" let Vundle manage Vundle, required | |
Plugin 'gmarik/Vundle.vim' | |
" The following are examples of different formats supported. | |
" Keep Plugin commands between vundle#begin/end. | |
Plugin 'scrooloose/nerdtree' | |
Plugin 'taglist.vim' | |
Plugin 'Lokaltog/vim-easymotion' | |
Plugin 'scrooloose/syntastic' | |
Plugin 'tpope/vim-pathogen' | |
" All of your Plugins must be added before the following line | |
call vundle#end() " required | |
filetype plugin indent on " required | |
" To ignore plugin indent changes, instead use: | |
"filetype plugin on | |
" | |
" Brief help | |
" :PluginList - lists configured plugins | |
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate | |
" :PluginSearch foo - searches for foo; append `!` to refresh local cache | |
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal | |
" | |
" see :h vundle for more details or wiki for FAQ | |
" Put your non-Plugin stuff after this line | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" Plugin 设置 | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
"let g:molokai_original = 1 | |
"let g:rehash256 = 1 | |
map <C-n> :NERDTreeToggle<CR> | |
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif | |
map <silent> <F9> :TlistToggle<cr> | |
execute pathogen#infect() | |
"""""""""""""""""""""""""""""" | |
" Tag list (ctags) | |
"""""""""""""""""""""""""""""" | |
"设定linux系统中ctags程序的位置 | |
let Tlist_Ctags_Cmd = '/usr/bin/ctags' | |
let Tlist_Show_One_File = 1 "不同时显示多个文件的tag,只显示当前文件的 | |
let Tlist_Exit_OnlyWindow = 1 "如果taglist窗口是最后一个窗口,则退出vim | |
let Tlist_Use_Right_Window = 1 "在右侧窗口中显示taglist窗口 | |
"I don't want the docstring window to popup during completion: | |
autocmd FileType python setlocal completeopt-=preview | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" 一般设定 | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" Make search case insensitive | |
set hlsearch | |
set incsearch | |
set ignorecase | |
set smartcase | |
" Show whitespace | |
" MUST be inserted BEFORE the colorscheme command | |
autocmd ColorScheme * highlight ExtraWhitespace ctermbg=red guibg=red | |
au InsertLeave * match ExtraWhitespace /\s\+$/ | |
" 设定主题 | |
set t_Co=256 | |
syntax enable | |
colorscheme molokai | |
" 设定默认解码 | |
set fenc=utf-8 | |
set fencs=utf-8,usc-bom,euc-jp,gb18030,gbk,gb2312,cp936 | |
" 不要使用vi的键盘模式,而是vim自己的 | |
set nocompatible | |
" history文件中需要记录的行数 | |
set history=100 | |
" 在处理未保存或只读文件的时候,弹出确认 | |
set confirm | |
" 与windows共享剪贴板 | |
" set clipboard+=unnamed | |
" 侦测文件类型 | |
filetype on | |
" 载入文件类型插件 | |
filetype plugin on | |
" 为特定文件类型载入相关缩进文件 | |
filetype indent on | |
" 保存全局变量 | |
set viminfo+=! | |
" 带有如下符号的单词不要被换行分割 | |
set iskeyword+=_,$,@,%,#,- | |
" 语法高亮 | |
syntax on | |
" 命令行(在状态行下)的高度,默认为1,这里是2 | |
set cmdheight=2 | |
" 使回格键(backspace)正常处理indent, eol, start等 | |
set backspace=2 | |
" 允许backspace和光标键跨越行边界 | |
set whichwrap+=<,>,h,l | |
" 启动的时候不显示那个援助索马里儿童的提示 | |
set shortmess=atI | |
" 通过使用: commands命令,告诉我们文件的哪一行被改变过 | |
set report=0 | |
" 不让vim发出讨厌的滴滴声 | |
set noerrorbells | |
" 在被分割的窗口间显示空白,便于阅读 | |
set fillchars=vert:\ ,stl:\ ,stlnc:\ | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" 搜索和匹配 | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" 高亮显示匹配的括号 | |
set showmatch | |
" 匹配括号高亮的时间(单位是十分之一秒) | |
set matchtime=5 | |
" 在搜索的时候忽略大小写 | |
set ignorecase | |
" 不要高亮被搜索的句子(phrases) | |
set nohlsearch | |
" 在搜索时,输入的词句的逐字符高亮(类似firefox的搜索) | |
set incsearch | |
" 光标移动到buffer的顶部和底部时保持3行距离 | |
set scrolloff=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=2 | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" 文本格式和排版 | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" 自动格式化 | |
set formatoptions=tcrqn | |
" 继承前一行的缩进方式,特别适用于多行注释 | |
set autoindent | |
" 制表符为4 | |
set tabstop=4 | |
set ts=4 | |
set expandtab | |
" 统一缩进为4 | |
set softtabstop=4 | |
set shiftwidth=4 | |
" Showing line numbers and length | |
set number " show line numbers | |
set tw=79 " width of document (used by gd) | |
set colorcolumn=80 | |
highlight colorcolumn ctermbg=0 | |
highlight colorcolumn ctermbg=0 | |
set cursorline | |
highlight cursorline ctermbg=0 | |
"restore cursor | |
set viminfo='10,\"100,:20,%,n~/.viminfo | |
func ResCur() | |
if line("'\"") <= line("$") | |
normal! g`" | |
return 1 | |
endif | |
endfunction | |
augroup resCur | |
autocmd! | |
autocmd BufWinEnter * call ResCur() | |
augroup END | |
" Mouse and backspace | |
set backspace=indent,eol,start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment