Last active
August 29, 2015 14:10
-
-
Save hanxi/f0816df0fad50a696786 to your computer and use it in GitHub Desktop.
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 | |
filetype off | |
"{{ 插件安装 | |
"git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim | |
"PluginInstall | |
"set the runtime path to include Vundle and initialize | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
Plugin 'gmarik/Vundle.vim' | |
Plugin 'Align' | |
Plugin 'dantezhu/authorinfo' | |
Plugin 'Shougo/neocomplcache.vim' | |
Plugin 'scrooloose/nerdtree' | |
Plugin 'scrooloose/nerdcommenter' | |
Plugin 'Lokaltog/vim-powerline' | |
Plugin 'altercation/vim-colors-solarized' | |
call vundle#end() | |
filetype plugin indent on | |
"}} 插件安装结束 | |
"{{ 主题 | |
syn enable | |
"set background=dark | |
set background=light | |
syn on "语法支持 | |
colorscheme solarized "设置颜色主题 | |
"}} | |
"{{ 通用配置 | |
set ai "自动缩进 | |
set si | |
set bs=2 "在insert模式下用退格键删除 | |
set showmatch "代码匹配 | |
set laststatus=2 "总是显示状态行 | |
set expandtab "以下三个配置配合使用,设置tab和缩进空格数 | |
set shiftwidth=4 | |
set tabstop=4 | |
set softtabstop=4 | |
set cursorline "为光标所在行加下划线 | |
set cursorcolumn "为光标所在行加下划线 | |
set number "显示行号 | |
set autoread "文件在Vim之外修改过,自动重新读入 | |
set autowriteall "设置自动保存 | |
set autochdir | |
set tags=tags;/ | |
set ignorecase "检索时忽略大小写 | |
set encoding=utf-8 | |
set fileencoding=utf-8 "使用utf-8新建文件 | |
set fileencodings=utf-8,gbk "使用utf-8或gbk打开文件 | |
let &termencoding=&encoding " | |
set hls "检索时高亮显示匹配项 | |
set helplang=cn "帮助系统设置为中文 | |
"set foldmethod=syntax "代码折叠 | |
set nofoldenable "关闭代码折叠 | |
"}} 通用配置结束 | |
"{{ 快捷键配置 | |
"conf for tabs, 为标签页进行的配置,通过ctrl h/l切换标签等 | |
let mapleader = ',' | |
nnoremap <C-l> gt | |
nnoremap <C-h> gT | |
nnoremap <leader>t : tabe<CR> | |
"大写字母 | |
inoremap <c-u> <esc>gUiwea | |
"}} 快捷键配置结束 | |
"{{ 插件配置 | |
"powerline{ 状态栏的配置 | |
set t_Co=256 | |
let g:Powerline_symbols = 'unicode' | |
let g:Powerline_colorscheme = 'solarized256' | |
let g:Powerline_stl_path_style = 'full' | |
"} | |
"nerdtree{ 目录树配置 | |
map <C-T> :NERDTree<CR> | |
"} | |
"neocomplcache{ 自动补全 | |
let g:neocomplcache_enable_at_startup = 1 | |
inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>" | |
"inoremap <expr><space> pumvisible() ? neocomplcache#close_popup() : "\<SPACE>" | |
"} | |
"Align{ 字符对齐 | |
vmap gn :Align=<CR> | |
"} | |
"authoinfo{ 文件头模板 | |
nmap <F4> :AuthorInfoDetect<cr> | |
let g:vimrc_author='hanxi' | |
let g:vimrc_email='hanxi.com@gmail.com' | |
let g:vimrc_homepage='http://hanxi.info' | |
"} | |
"}} 插件配置结束 | |
" 保存执行ctags | |
function! UPDATE_TAGS() | |
let _f_ = expand("%:p") | |
let _cmd_ = '"ctags -R"' | |
let _resp = system(_cmd_) | |
unlet _cmd_ | |
unlet _f_ | |
unlet _resp | |
endfunction | |
autocmd BufWrite *.cpp,*.h,*.c,*.lua call UPDATE_TAGS() | |
" 保存时自动删除行尾空格 | |
func! DeleteTrailingWS() | |
%ret! 4 | |
exe "normal mz" | |
%s/\s\+$//ge | |
exe "normal `z" | |
:w | |
endfunc | |
"autocmd BufWrite * :call DeleteTrailingWS() | |
command W call DeleteTrailingWS() | |
au BufReadPost * if line("'\"") > 0|if line("'\"") <= line("$")|exe("norm '\"")|else|exe "norm $"|endif|endif | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment