Created
May 9, 2012 12:36
-
-
Save pluskid/2644215 to your computer and use it in GitHub Desktop.
my vimrc
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
" vim: set foldmarker={,} foldlevel=0 foldmethod=marker: | |
"======================================== | |
" Basic setting { | |
"======================================== | |
set nocompatible | |
set visualbell " disable sound bell | |
let mapleader = ',' | |
filetype plugin indent on " auto filetype identification | |
call pathogen#infect() | |
set backup | |
set backupdir=~/.vim/cache/backup/ " backup directory | |
set directory=~/.vim/cache/swap/ " swap directory | |
set formatoptions+=mB | |
"} | |
"======================================== | |
" UI { | |
"======================================== | |
set t_Co=256 " force terminal 256 color | |
if has('gui_running') | |
set guifont=Droid\ Sans\ Mono\ 9 | |
set background=dark | |
color solarized | |
set guioptions-=T " remove toolbar | |
set lines=40 | |
set columns=95 | |
else | |
set background=dark | |
color ir_black | |
end | |
syntax on | |
let g:load_doxygen_syntax=1 | |
set mouse=a " automatically enable mouse | |
set mousemodel=popup " mouse popup | |
set cursorline " highlight current line | |
set nu " line number | |
set showmatch " show matching parenthesis | |
set scrolljump=5 " lines to scroll when cursor leaves screen | |
set scrolloff=5 " minimum lines to keep above and below cursor | |
"-------------------- | |
" status line { | |
if has('cmdline_info') | |
set ruler " show the ruler | |
set rulerformat=%30(%=\:b%n%y%m%r%w\ %l,%c%V\ %P%) " a ruler on steroids | |
set showcmd " show partial commands in status line and | |
" selected characters/lines in visual mode | |
endif | |
if has('statusline') | |
set laststatus=2 | |
" Broken down into easily includeable segments | |
set statusline=%<%f\ " Filename | |
set statusline+=%w%h%m%r " Options | |
set statusline+=%{fugitive#statusline()} " Git Hotness | |
set statusline+=\ [%{&ff}/%Y] " filetype | |
set statusline+=\ [%{getcwd()}] " current dir | |
set statusline+=%=%-14.(%l,%c%V%)\ %p%% " Right aligned file nav info | |
endif | |
"} | |
"} | |
"======================================== | |
" Basic editing { | |
"======================================== | |
set autochdir " auto switch to current file directory | |
set virtualedit=onemore " allow for cursor beyond last character | |
set hidden " allow buffer switching without saving | |
set backspace=indent,eol,start " better backspace | |
set incsearch " search as you type | |
set hlsearch " highlight search terms | |
set ignorecase " case insensitive search | |
set wildmenu " show list instead of just completing | |
set wildmode=list:longest,full " command <Tab> completion, list matches, then longest common part, then all. | |
set whichwrap=b,s,h,l,<,>,[,] " backspace and cursor keys wrap to | |
set nowrap | |
set autoindent | |
set shiftwidth=4 " indent is 4 spaces | |
set expandtab " expand tab into spaces | |
set tabstop=4 | |
set softtabstop=4 " let backspace delete indent | |
" visual shifting (does not exit Visual mode) | |
vnoremap < <gv | |
vnoremap > >gv | |
" windows key bindings Ctrl+C, Ctrl+V, etc. | |
source $VIMRUNTIME/mswin.vim | |
set completeopt=menuone,menu,longest | |
"} | |
"======================================== | |
" Utility plugins { | |
"======================================== | |
"-------------------- | |
" NERDTree { | |
map <F7> :NERDTreeToggle<CR> | |
let NERDTreeIgnore=['\.pyc', '\~$', '\.swo$', '\.swp$', '\.git', '\.hg', '\.svn', '\.bzr', '\.o$'] | |
"} | |
"-------------------- | |
" ctrlp { | |
let g:ctrlp_cmd = 'CtrlP' | |
let g:ctrlp_prompt_mappings = { | |
\ 'PrtSelectMove("j")': ['<c-n>', '<down>'], | |
\ 'PrtSelectMove("k")': ['<c-p>', '<up>'], | |
\ 'PrtHistory(-1)': ['<c-j>'], | |
\ 'PrtHistory(1)': ['<c-k>'], | |
\ } | |
let g:ctrlp_working_path_mode = 2 | |
let g:ctrlp_dotfiles = 0 | |
set wildignore+=*/tmp/*,*.so,*.swp,*.o,*/_compiled/*,*/doc/*,*/data/* | |
map <F2> :CtrlPBuffer<CR> | |
imap <F2> <C-O>:CtrlPBuffer<CR> | |
"} | |
"-------------------- | |
" local-vimrc { | |
let g:local_vimrc = {'names':['.localvimrc'], 'hash_fun':'LVRHashOfFile'} | |
"} | |
"} | |
"======================================== | |
" Editing plugins { | |
"======================================== | |
"-------------------- | |
" neocomplcache { | |
let g:neocomplcache_enable_at_startup = 0 | |
let g:neocomplcache_enable_camel_case_completion = 1 | |
let g:neocomplcache_enable_smart_case = 1 | |
let g:neocomplcache_enable_underbar_completion = 1 | |
let g:neocomplcache_min_syntax_length = 3 | |
let g:neocomplcache_enable_auto_delimiter = 1 | |
"inoremap <expr><CR> pumvisible() ? neocomplcache#close_popup() : "\<CR>" | |
inoremap <expr><CR> neocomplcache#smart_close_popup() . "\<CR>" | |
inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>" | |
" <C-h>, <BS>: close popup and delete backword char. | |
inoremap <expr><C-h> neocomplcache#smart_close_popup()."\<C-h>" | |
inoremap <expr><BS> neocomplcache#smart_close_popup()."\<C-h>" | |
" heavy omni completion | |
let g:neocomplcache_omni_patterns = {} | |
let g:neocomplcache_omni_patterns.c = '\%(\.\|->\)\h\w*' | |
let g:neocomplcache_omni_patterns.cpp = '\h\w*\%(\.\|->\)\h\w*\|\h\w*::' | |
let g:neocomplcache_omni_patterns.go = '\%(\.\)' | |
" let neocomplcache and clang_complete work together | |
let g:neocomplcache_force_overwrite_completefunc=1 | |
let g:clang_complete_auto=1 | |
"} | |
"-------------------- | |
" supertab { | |
let g:SuperTabDefaultCompletionType = "context" | |
"} | |
"-------------------- | |
" UltiSnips { | |
let g:UltiSnipsExpandTrigger = '<C-e>' | |
let g:UltiSnipsJumpForwardTrigger = '<C-j>' | |
let g:UltiSnipsJumpBackwardTrigger = '<C-k>' | |
"} | |
"} | |
"======================================== | |
" LaTeX { | |
"======================================== | |
let g:tex_flavor = 'latex' | |
let g:Tex_CompileRule_pdf = 'latexmk -pdf "$*"' | |
let g:Tex_DefaultTargetFormat = 'pdf' | |
autocmd FileType tex set spell | |
autocmd FileType tex set textwidth=79 | |
" those improves editing response speed | |
autocmd FileType tex set foldmethod=manual | |
autocmd FileType tex set nocursorline | |
"-------------------- | |
"auctex-like shortcuts { | |
"let s:tex_leader = ';' | |
"let s:tex_abbrevs = { 'a': '\\alpha', 'b': '\\beta', 'c': '\\chi', 'd': '\\delta', | |
" \ 'e': '\\varepsilon', 'f': '\\varphi', 'g': '\\gamma', 'h': '\\eta', | |
" \ 'i': '\\iota', 'k': '\\kappa', 'l': '\\lambda', 'm': '\\mu', | |
" \ 'n': '\\nu', 'o': '\\omega', 'p': '\\pi', 'q': '\\theta', 'r': '\\rho', | |
" \ 's': '\\sigma', 't': '\\tao', 'u': '\\upsilon', 'v': '\\vee', | |
" \ 'w': '\\wedge', 'z': '\\zeta', 'D': '\\Delta', 'F': '\Phi', | |
" \ 'G': '\\Gamma', 'L': '\\Lambda', 'N': '\nabla', 'O': '\\Omega', | |
" \ 'Q': '\\Theta', 'R': '\\varrho', 'U': '\\Upsilon', 'X': '\\Xi', | |
" \ 'Y': '\\Psi', '0': '\\emptyset', '6': '\\partial', '8': '\\infty', | |
" \ '/': '\\frac{$1}{$2}', '(': '\\left( $0 \\right)', | |
" \ '[': '\\left\\[ $0 \\right\\]', '{': '\\left\\{ $0 \\right\\}', | |
" \ '*': '\\times', '<': '\\leq', '>': '\\geq', ';': ';' | |
" \ } | |
"for [key, snip] in items(s:tex_abbrevs) | |
" exec "autocmd FileType tex inoremap <silent>" . | |
" \ s:tex_leader . key . " " . "<C-R>=UltiSnips_Anon('" . snip . "')<cr>" | |
"endfor | |
"let s:tex_leader2 = '`' | |
"let s:tex_abbrevs2 = { 'b': '\\mathbf\{$1\}$0', 'n': '\\mathbb\{$1\}$0', | |
" \ 'i': '\\mathit\{$1\}$0', 'c': '\\mathcal\{$1\}$0', | |
" \ 's': '\\mathsf\{$1\}$0' | |
" \ } | |
"for [key, snip] in items(s:tex_abbrevs2) | |
" exec "autocmd FileType tex inoremap <silent>" . | |
" \ s:tex_leader2 . key . " " . "<C-R>=UltiSnips_Anon('" . snip . "')<cr>" | |
"endfor | |
"autocmd FileType tex inoremap <silent> __ <C-R>=UltiSnips_Anon('_\{$1\}$0')<cr> | |
"autocmd FileType tex inoremap <silent> ^^ <C-R>=UltiSnips_Anon('^\{$1\}$0')<cr> | |
"} | |
"} | |
"} | |
"======================================== | |
" File Types { | |
"======================================== | |
"-------------------- | |
" textile { | |
autocmd FileType textile noremap <buffer> <silent> k gk | |
autocmd FileType textile noremap <buffer> <silent> j gj | |
autocmd FileType textile noremap <buffer> <silent> 0 g0 | |
autocmd FileType textile noremap <buffer> <silent> $ g$ | |
autocmd FileType textile syntax match textileLeftQuote '“' conceal cchar=『 | |
autocmd FileType textile syntax match textileRightQuote '”' conceal cchar=』 | |
autocmd FileType textile set conceallevel=2 | |
autocmd FileType textile set concealcursor=nvic | |
autocmd FileType textile set ambiwidth=double | |
"} | |
"-------------------- | |
" pandoc { | |
autocmd FileType pandoc setlocal linebreak | |
autocmd FileType pandoc setlocal breakat-=* | |
autocmd FileType pandoc nnoremap <buffer> j gj | |
autocmd FileType pandoc nnoremap <buffer> k gk | |
autocmd FileType pandoc vnoremap <buffer> j gj | |
autocmd FileType pandoc vnoremap <buffer> k gk | |
autocmd FileType pandoc vnoremap <buffer> 0 g0 | |
autocmd FileType pandoc vnoremap <buffer> $ g$ | |
autocmd FileType pandoc setlocal display=lastline | |
autocmd FileType pandoc setlocal nojoinspaces | |
autocmd FileType pandoc setlocal wrap | |
autocmd FileType pandoc setlocal nocursorline | |
"} | |
"-------------------- | |
" ruby { | |
autocmd FileType ruby set shiftwidth=2 | |
autocmd FileType ruby set expandtab | |
autocmd FileType ruby set tabstop=2 | |
autocmd FileType ruby set softtabstop=2 | |
"} | |
"-------------------- | |
" c++ { | |
autocmd FileType c set cindent | |
autocmd FileType cpp set cindent | |
"} | |
"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment