Created
July 17, 2014 04:29
-
-
Save chao-he/1cd6fd3dd8c073614fb8 to your computer and use it in GitHub Desktop.
vim configuration
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
" how many lines of history VIM has to remember | |
set history=100 | |
" Enable filetype plugin | |
filetype plugin on | |
filetype indent on | |
" Set to auto read when file changed outside | |
set autoread | |
" Enable mouse if we heve | |
if has("mouse") | |
set mouse=a | |
endif | |
" With a map leader it's possible to do extra key | |
" combinations like <leader>w saves the current file | |
let mapleader="," | |
let g:mapleader="," | |
" when vimrc is edited, reload it | |
autocmd! bufwritepost vimrc source ~/.vimrc | |
set so=7 "7 lines to cursors when moving vertical | |
set wildmenu "turn on wild menu | |
set ruler "always show current position | |
set cmdheight=1 "the commandbar height | |
set hid "change buffer - without saving | |
set backspace=eol,start,indent | |
set whichwrap+=<,>,h,l | |
set ignorecase | |
set smartcase | |
set hlsearch | |
set incsearch | |
set noerrorbells | |
set novisualbell | |
set t_vb= | |
set number | |
set encoding=utf-8 | |
set fileencoding=utf-8 | |
"set fileencodings=ucs-bom,gbk,utf-8,cp936 | |
"lang zh_CN.utf-8 | |
set foldmethod=marker | |
set foldenable | |
syntax enable | |
colorscheme desert | |
set background=dark | |
set ffs=unix,dos,mac | |
" set nobackup | |
" set nowb | |
" set noswapfile | |
set expandtab | |
set smarttab | |
set shiftwidth=4 | |
set tabstop=4 | |
"set lbr | |
set tw=2000 | |
set pastetoggle=<F10> | |
set autoindent | |
set smartindent | |
"set wrap | |
" Using system clipboard without "* | |
set clipboard=unnamed | |
" always show status line | |
set laststatus=2 | |
set statusline=\ %{HasPaste()}%F\ Line:%l/%L\ Col:%c\ %m%r%h\ %w\ \ CWD:\ %r%{CurDir()}%h | |
function! CurDir() | |
let curdir = substitute(getcwd(), '/home/hechao/', "~/", "g") | |
return curdir | |
endfunction | |
function! HasPaste() | |
if &paste | |
return 'PASTE ' | |
else | |
return '' | |
endif | |
endfunction | |
" Abbrevs and key mapping | |
iab idate <c-r>=strftime("%Y-%m-%d %H:%M:%S")<cr> | |
iab iauthor <c-r>="Chao He <[email protected]>"<cr> | |
map 0 ^ | |
map 9 $ | |
map <Leader><leader>m mmHmt:%s/<C-V><cr>//ge<cr>'tzt'y | |
map <space> / | |
map <M-space> ? | |
map <silent> <leader><cr> :noh<cr> | |
if has("autocmd") | |
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif | |
endif | |
set completeopt-=preview | |
set path=.,/usr/include,/usr/local/include,~/.local/include,~/qmodule/,~/qmodule/segment/include,~/qmodule/febird/include | |
filetype off | |
" set the runtime path to include Vundle and initialize | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#rc() | |
"call vundle#begin() | |
" " alternatively, pass a path where Vundle should install plugins | |
" "call vundle#begin('~/some/path/here') | |
" | |
" " let Vundle manage Vundle, required | |
Bundle 'gmarik/Vundle.vim' | |
Bundle 'michaeljsmith/vim-indent-object' | |
let g:indentobject_meaningful_indentation = ["haml", "sass", "python", "yaml", "markdown"] | |
" Bundle 'Spaceghost/vim-matchit' | |
" Bundle 'kien/ctrlp.vim' | |
" let g:ctrlp_working_path_mode = '' | |
" let g:ctrlp_by_filename = 1 | |
Bundle "Shougo/neomru.vim" | |
Bundle "Shougo/unite.vim" | |
call unite#filters#matcher_default#use(['matcher_fuzzy']) | |
call unite#filters#sorter_default#use(['sorter_rank']) | |
call unite#set_profile('files', 'smartcase', 1) | |
call unite#custom#source('line,outline','matchers','matcher_fuzzy') | |
let g:unite_data_directory='~/.vim/.cache/unite' | |
let g:unite_enable_start_insert=1 | |
let g:unite_source_history_yank_enable=1 | |
let g:unite_source_rec_max_cache_files=5000 | |
let g:unite_prompt='» ' | |
if executable('ag') | |
let g:unite_source_grep_command='ag' | |
let g:unite_source_grep_default_opts='--nocolor --nogroup -S -C4' | |
let g:unite_source_grep_recursive_opt='' | |
elseif executable('ack') | |
let g:unite_source_grep_command='ack' | |
let g:unite_source_grep_default_opts='--no-heading --no-color -C4' | |
let g:unite_source_grep_recursive_opt='' | |
endif | |
function! s:unite_settings() | |
nmap <buffer> Q <plug>(unite_exit) | |
nmap <buffer> <esc> <plug>(unite_exit) | |
imap <buffer> <esc> <plug>(unite_exit) | |
endfunction | |
autocmd FileType unite call s:unite_settings() | |
nmap <leader> [unite] | |
nnoremap [unite] <nop> | |
nnoremap <silent> [unite]<space> :<C-u>Unite -toggle -auto-resize -buffer-name=mixed file_rec/async:! buffer file_mru bookmark<cr><c-u> | |
nnoremap <silent> [unite]f :<C-u>Unite -toggle -auto-resize -buffer-name=files file_rec/async:!<cr><c-u> | |
nnoremap <silent> [unite]e :<C-u>Unite -buffer-name=recent file_mru<cr> | |
nnoremap <silent> [unite]y :<C-u>Unite -buffer-name=yanks history/yank<cr> | |
nnoremap <silent> [unite]l :<C-u>Unite -auto-resize -buffer-name=line line<cr> | |
nnoremap <silent> [unite]b :<C-u>Unite -auto-resize -buffer-name=buffers buffer<cr> | |
nnoremap <silent> [unite]/ :<C-u>Unite -no-quit -buffer-name=search grep:.<cr> | |
nnoremap <silent> [unite]m :<C-u>Unite -auto-resize -buffer-name=mappings mapping<cr> | |
nnoremap <silent> [unite]s :<C-u>Unite -quick-match buffer<cr> | |
nnoremap ff :Unite -quick-match -toggle -auto-resize -buffer-name=unite_b file_rec/async:! file file_mru<CR> | |
nnoremap bb :Unite -quick-match -toggle -auto-resize -buffer-name=unite_b buffer<CR> | |
Bundle "Shougo/vimfiler.vim" | |
let g:vimfiler_as_default_explorer = 1 | |
Bundle 'honza/vim-snippets' | |
Bundle 'Valloric/YouCompleteMe' | |
let g:ycm_autoclose_preview_window_after_completion = 1 | |
let g:ycm_collect_identifiers_from_tags_files = 1 | |
let g:ycm_complete_in_comments_and_strings = 1 | |
let g:ycm_confirm_extra_conf = 0 | |
let g:ycm_filetype_blacklist={'unite': 1} | |
let g:ycm_filetype_whitelist = {'python':1, 'c':1, 'cpp':1, 'php':1} | |
let g:ycm_global_ycm_extra_conf = "/home/hechao/.ycm_extra_conf.py" | |
let g:ycm_key_list_previous_completion=['<C-p>', '<Up>'] | |
let g:ycm_key_list_select_completion=['<C-n>', '<Down>'] | |
let g:ycm_server_keep_logfiles = 0 | |
let g:ycm_server_log_level = 'info' | |
nnoremap <C-]> :YcmCompleter GoToDefinitionElseDeclaration<CR> | |
Bundle 'SirVer/ultisnips' | |
" set rtp+='~/.vim/bundle/vim-snippets/' | |
let g:UltiSnipsExpandTrigger="<c-j>" | |
let g:UltiSnipsJumpForwardTrigger="<tab>" | |
let g:UltiSnipsJumpBackwardTrigger="<s-tab>" | |
let g:UltiSnipsSnippetsDir='~/.vim/bundle/vim-snippets/UltiSnips/' | |
let g:UltiSnipsSnippetDirectories=["UltiSnips"] | |
Bundle "davidhalter/jedi" | |
" Bundle 'scrooloose/nerdtree' | |
" let g:NERDTreeMinimalUI = 1 | |
" let NERDTreeIgnore=['\.vim$', '\~$', '\.svn$', '\.o$', '\.so$', '\.a$'] | |
" nmap <leader><leader>e :NERDTreeToggle<cr><cr> | |
Bundle 'fencview.vim' | |
Bundle 'tComment' | |
nnoremap // :TComment<CR> | |
vnoremap // :TComment<CR> | |
" Bundle "amiorin/vim-project" | |
" " {{{ | |
" let g:project_enable_welcome = 1 | |
" let g:project_use_nerdtree = 0 | |
" set rtp+=~/.vim/bundle/vim-project/ | |
" " set rtp+=~/.vim/bundle/vim-snippets/ | |
" call project#rc("~") | |
" Project '~/queryparser' | |
" }}} | |
" Bundle "jeetsukumaran/vim-buffergator" | |
" Bundle "techlivezheng/vim-plugin-minibufexpl" | |
Bundle "majutsushi/tagbar" | |
nmap <leader><leader>t :Tagbar<cr><cr>"{{{ | |
let g:tagbar_width = 20 | |
let g:tagbar_autofocus = 1 | |
let g:tagbar_compact = 1 | |
let g:tagbar_autoshowtag = 1 | |
" let g:tagbar_autopreview = 1 | |
" autocmd FileType c,cpp nested :TagbarOpen | |
" }}} | |
Bundle "vim-scripts/google.vim" | |
filetype plugin indent on |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment