Created
March 20, 2016 13:24
-
-
Save calorie/c0cb266073d5b0ef868f 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
"--------------------------------------------------------------------- | |
" vim plugins | |
"--------------------------------------------------------------------- | |
if has('vim_starting') | |
set runtimepath+=~/.vim/bundle/neobundle.vim/ | |
endif | |
call neobundle#begin(expand('~/.vim/bundle/')) | |
NeoBundleFetch 'Shougo/neobundle.vim' | |
if neobundle#load_cache() | |
" Unite {{{ | |
" unite | |
NeoBundleLazy 'Shougo/unite.vim', { | |
\ 'depends' : 'Shougo/neomru.vim', | |
\ 'autoload' : { | |
\ 'commands' : [ | |
\ 'Unite', 'UniteWithCurrentDir', | |
\ 'UniteWithBufferDir', 'UniteBookmarkAdd', | |
\ 'UniteWithCursorWord'], | |
\ }} | |
" }}} | |
" Edit {{{ | |
" comment | |
NeoBundleLazy 'tomtom/tcomment_vim', { | |
\ 'autoload' : { | |
\ 'commands' : ['TComment', | |
\ 'TCommentAs', 'TCommentMaybeInline'] | |
\ }} | |
NeoBundle 'Yggdroot/indentLine', { | |
\ 'autoload' : { | |
\ 'commands' : ['IndentLinesReset', 'IndentLinesToggle'], | |
\ }} | |
" filtering & align text | |
NeoBundleLazy 'godlygeek/tabular', { | |
\ 'autoload' : { 'commands' : 'Tab' }} | |
" enclose text | |
NeoBundleLazy 'tpope/vim-surround', { | |
\ 'autoload' : { | |
\ 'mappings' : [ | |
\ ['nx', '<Plug>Dsurround'], ['nx', '<Plug>Csurround' ], | |
\ ['nx', '<Plug>Ysurround' ], ['nx', '<Plug>YSurround' ], | |
\ ['nx', '<Plug>Yssurround'], ['nx', '<Plug>YSsurround'], | |
\ ['nx', '<Plug>VgSurround'], ['nx', '<Plug>VSurround']] | |
\ }} | |
" toggle text | |
NeoBundleLazy 'AndrewRadev/switch.vim', { | |
\ 'autoload' : { 'commands' : 'Switch' }} | |
" completion for parenthesis | |
NeoBundle 'jiangmiao/auto-pairs' | |
" textobj {{{ | |
" create text object | |
NeoBundleLazy 'kana/vim-textobj-user' | |
" all text | |
NeoBundleLazy 'kana/vim-textobj-entire', { | |
\ 'depends' : 'textobj-user', | |
\ 'autoload' : { | |
\ 'mappings' : [['nx', '<Plug>(textobj-entire-a)'], | |
\ ['nx', '<Plug>(textobj-entire-i)']] | |
\ }} | |
" }}} | |
" }}} | |
" Completion {{{ | |
" completion | |
if has('lua') | |
NeoBundleLazy 'Shougo/neocomplete.vim', { | |
\ 'autoload' : { 'insert' : 1 }} | |
endif | |
" snippet completion | |
NeoBundleLazy 'Shougo/neosnippet-snippets' | |
NeoBundleLazy 'Shougo/neosnippet', { | |
\ 'depends' : 'Shougo/neosnippet-snippets', | |
\ 'autoload' : { | |
\ 'commands' : ['NeoSnippetEdit'], | |
\ 'filetypes' : 'snippet', | |
\ 'insert' : 1, | |
\ 'unite_sources' : ['snippet', 'neosnippet/user', | |
\ 'neosnippet/runtime'], | |
\ }} | |
" }}} | |
" Searching/Moving {{{ | |
" intuitive moving | |
NeoBundleLazy 'Lokaltog/vim-easymotion', { | |
\ 'autoload' : { 'mappings' : ',' }} | |
" smart moving | |
NeoBundleLazy 'kana/vim-smartword', { | |
\ 'autoload' : { | |
\ 'mappings' : [ | |
\ '<Plug>(smartword-w)', '<Plug>(smartword-b)', | |
\ '<Plug>(smartword-e)', '<Plug>(smartword-ge)'] | |
\ }} | |
" expand % | |
NeoBundleLazy 'edsono/vim-matchit', { 'autoload' : { | |
\ 'mappings' : '%' }} | |
" intuitive moving on visual mode | |
NeoBundleLazy 't9md/vim-textmanip', { 'autoload' : { | |
\ 'mappings' : [ | |
\ ['x', '<Plug>(textmanip-move-down)'], | |
\ ['x', '<Plug>(textmanip-move-up)'], | |
\ ['x', '<Plug>(textmanip-move-left)' ], | |
\ ['x', '<Plug>(textmanip-move-right)']], | |
\ }} | |
" window swap | |
NeoBundleLazy 'calorie/vim-swap-windows', { 'autoload' : { | |
\ 'commands' : [ | |
\ 'MarkWindow', 'SwapWindows'], | |
\ }} | |
" mru | |
NeoBundleLazy 'Shougo/neomru.vim' | |
" echo the number of match words | |
NeoBundleLazy 'osyo-manga/vim-anzu', { | |
\ 'autoload' : { | |
\ 'mappings' : [ | |
\ '<Plug>(anzu-n-with-echo)', | |
\ '<Plug>(anzu-N-with-echo)', | |
\ '<Plug>(anzu-star-with-echo)', | |
\ '<Plug>(anzu-sharp-with-echo)' | |
\ ], | |
\ }} | |
" }}} | |
" Programming {{{ | |
" auto create tags | |
NeoBundleLazy 'szw/vim-tags', { | |
\ 'depends' : 'tpope/vim-dispatch', | |
\ 'autoload' : { | |
\ 'commands' : 'TagsGenerate', | |
\ }} | |
" run command quickly | |
NeoBundleLazy 'thinca/vim-quickrun', { | |
\ 'autoload' : { | |
\ 'mappings' : [['nxo', '<Plug>(quickrun)']], | |
\ 'commands' : 'QuickRun', | |
\ }} | |
" completion end | |
NeoBundle 'tpope/vim-endwise.git' | |
" }}} | |
" Syntax {{{ | |
" syntax | |
NeoBundleLazy 'scrooloose/syntastic', { | |
\ 'autoload': { 'insert' : 1 }} | |
" }}} | |
" Buffer {{{ | |
" tree explore | |
NeoBundleLazy 'scrooloose/nerdtree', { | |
\ 'autoload' : { | |
\ 'commands' : ['NERDTreeToggle','NERDTreeFind','NERDTree'] | |
\ }} | |
" }}} | |
" Encording {{{ | |
NeoBundle 'banyan/recognize_charcode.vim' | |
" }}} | |
" Utility {{{ | |
" auto save | |
NeoBundle 'vim-scripts/vim-auto-save' | |
" async run | |
NeoBundleLazy 'Shougo/vimproc', { | |
\ 'build' : { | |
\ 'mac' : 'make', | |
\ 'linux' : 'make', | |
\ 'unix' : 'gmake', | |
\ 'cygwin' : 'make -f make_cygwin.mak', | |
\ }, | |
\ 'autoload' : { | |
\ 'function_prefix' : 'vimproc', | |
\ }} | |
" cool statusline | |
NeoBundle 'vim-airline/vim-airline', { | |
\ 'depends': ['tpope/vim-fugitive', 'vim-airline/vim-airline-themes'] | |
\ } | |
NeoBundleLazy 'vim-airline/vim-airline-themes' | |
" async run | |
NeoBundleLazy 'tpope/vim-dispatch', { | |
\ 'autoload': { 'commands': ['Dispatch', 'Make', 'Start'] } | |
\ } | |
" sudo vim | |
NeoBundleLazy 'vim-scripts/sudo.vim', { | |
\ 'autoload': { 'commands': ['SudoRead', 'SudoWrite'] } | |
\ } | |
" control git | |
NeoBundle 'tpope/vim-fugitive', { | |
\ 'autoload' : { | |
\ 'commands': [ | |
\ 'Git', 'Gstatus', 'Gwrite', 'Glog', | |
\ 'Gcommit', 'Gblame', 'Ggrep', 'Gdiff'], | |
\ }} | |
" }}} | |
" ColorScheme {{{ | |
" calorie, jellybeans, wombat, railscasts | |
NeoBundle 'calorie/colorschemes' | |
" }}} | |
NeoBundleSaveCache | |
endif | |
call neobundle#end() | |
filetype plugin indent on | |
"--------------------------------------------------------------------- | |
" Basics | |
"--------------------------------------------------------------------- | |
let mapleader = "," | |
set scrolloff=5 | |
set textwidth=0 | |
set nobackup | |
set autoread | |
set noswapfile | |
set hidden | |
set backspace=indent,eol,start | |
set formatoptions=lmoq | |
set vb t_vb= | |
set browsedir=buffer | |
set whichwrap=b,s,h,l,<,>,[,] | |
set showcmd | |
set noshowmode | |
set viminfo='50,<1000,s100,\"50 | |
set modelines=0 | |
set clipboard=unnamed | |
set shortmess+=I | |
if has('patch-7.4.314') | |
set shortmess+=c | |
endif | |
noremap ; : | |
inoremap <C-c> <ESC> | |
command! Rv source $MYVIMRC | |
command! Path echo expand("%:p") | |
set helpfile=$VIMRUNTIME/doc/help.txt | |
let g:is_mac = (has('mac') || has('macunix') || has('gui_macvim') || | |
\ (!executable('xdg-open') && system('uname') =~? '^darwin')) | |
let g:is_windows = has('win16') || has('win32') || has('win64') | |
"--------------------------------------------------------------------- | |
" Indent | |
"--------------------------------------------------------------------- | |
set autoindent | |
set smartindent | |
set cindent | |
set tabstop=2 shiftwidth=2 softtabstop=0 | |
augroup Indent | |
autocmd! | |
autocmd FileType apache setlocal sw=4 sts=4 ts=4 et | |
autocmd FileType aspvbs setlocal sw=4 sts=4 ts=4 et | |
autocmd FileType c setlocal sw=4 sts=4 ts=4 et | |
autocmd FileType cpp setlocal sw=4 sts=4 ts=4 et | |
autocmd FileType cs setlocal sw=4 sts=4 ts=4 et | |
autocmd FileType css setlocal sw=4 sts=4 ts=4 et | |
autocmd FileType diff setlocal sw=4 sts=4 ts=4 et | |
autocmd FileType eruby setlocal sw=2 sts=2 ts=2 et | |
autocmd FileType html setlocal sw=2 sts=2 ts=2 et | |
autocmd FileType java setlocal sw=4 sts=4 ts=4 et | |
autocmd FileType javascript setlocal sw=4 sts=4 ts=4 et | |
autocmd FileType perl setlocal sw=4 sts=4 ts=4 et | |
autocmd FileType php setlocal sw=4 sts=4 ts=4 et | |
autocmd FileType python setlocal sw=4 sts=4 ts=4 et | |
autocmd FileType ruby setlocal sw=2 sts=2 ts=2 et | |
autocmd FileType haml setlocal sw=2 sts=2 ts=2 et | |
autocmd FileType sh setlocal sw=2 sts=2 ts=2 et | |
autocmd FileType sql setlocal sw=4 sts=4 ts=4 et | |
autocmd FileType vb setlocal sw=4 sts=4 ts=4 et | |
autocmd FileType vim setlocal sw=2 sts=2 ts=2 et | |
autocmd FileType wsh setlocal sw=4 sts=4 ts=4 et | |
autocmd FileType xhtml setlocal sw=4 sts=4 ts=4 et | |
autocmd FileType xml setlocal sw=4 sts=4 ts=4 et | |
autocmd FileType yaml setlocal sw=2 sts=2 ts=2 et | |
autocmd FileType zsh setlocal sw=2 sts=2 ts=2 et | |
autocmd FileType scala setlocal sw=2 sts=2 ts=2 et | |
autocmd FileType go setlocal sw=2 sts=2 ts=2 et | |
autocmd FileType lua setlocal sw=2 sts=2 ts=2 et | |
autocmd FileType json setlocal sw=2 sts=2 ts=2 et | |
augroup END | |
"--------------------------------------------------------------------- | |
" Apperance | |
"--------------------------------------------------------------------- | |
set showmatch | |
set matchtime=1 | |
set number | |
set display=uhex | |
set previewheight=15 | |
set cmdheight=1 | |
set lazyredraw | |
set ttyfast | |
set cursorline | |
set list | |
set listchars=tab:>.,trail:_,extends:>,precedes:< | |
highlight ZenkakuSpace cterm=underline ctermfg=lightblue guibg=darkgray | |
match ZenkakuSpace / / | |
augroup cch | |
autocmd! cch | |
autocmd WinLeave * set nocursorline | |
autocmd WinEnter,BufEnter * set cursorline | |
augroup END | |
highlight clear CursorLine | |
highlight CursorLine gui=underline | |
highlight CursorLine ctermbg=black guibg=black | |
"--------------------------------------------------------------------- | |
" StatusLine | |
"--------------------------------------------------------------------- | |
set laststatus=2 | |
set ruler | |
"--------------------------------------------------------------------- | |
" Complete | |
"--------------------------------------------------------------------- | |
set wildmenu | |
set wildchar=<tab> | |
set wildmode=list:full | |
set history=1000 | |
set complete+=k | |
set completeopt=menuone | |
cnoremap <C-p> <Up> | |
cnoremap <Up> <C-p> | |
cnoremap <C-n> <Down> | |
cnoremap <Down> <C-n> | |
if has('lua') | |
"------------------------------------ | |
" neocomple.vim | |
"------------------------------------ | |
let g:acp_enableAtStartup = 0 | |
let g:neocomplcache_enable_at_startup = 0 | |
let g:neocomplete#enable_at_startup = 1 | |
let bundle = neobundle#get('neocomplete.vim') | |
function! bundle.hooks.on_source(bundle) | |
let g:neocomplete#disable_auto_complete = 0 | |
let g:neocomplete#enable_smart_case = 1 | |
let g:neocomplete#enable_camel_case = 1 | |
let g:neocomplete#enable_fuzzy_completion = 1 | |
let g:neocomplete#sources#syntax#min_keyword_length = 3 | |
let g:neocomplete#auto_completion_start_length = 2 | |
let g:neocomplete#manual_completion_start_length = 0 | |
let g:neocomplete#min_keyword_length = 3 | |
" let g:neocomple_skip_auto_completion_time = '0.6' | |
let g:neocomplete#enable_complete_select = 1 | |
try | |
let completeopt_save = &completeopt | |
set completeopt+=noinsert,noselect | |
catch | |
let g:neocomplete#enable_complete_select = 0 | |
finally | |
let &completeopt = completeopt_save | |
endtry | |
let g:neocomplete#enable_auto_select = 0 | |
let g:neocomplete#enable_refresh_always = 0 | |
let g:neocomplete#enable_cursor_hold_i = 0 | |
let g:neocomplete#enable_insert_char_pre = 0 | |
" let g:neocomplete#sources#dictionary#dictionaries = { | |
" \ 'default' : '', | |
" \ 'scala' : $HOME.'/.vim/bundle/vim-scala/dict/scala.dict', | |
" \ 'java' : $HOME.'/.vim/dict/java.dict', | |
" \ 'c' : $HOME.'/.vim/dict/c.dict', | |
" \ 'cpp' : $HOME.'/.vim/dict/cpp.dict', | |
" \ 'javascript' : $HOME.'/.vim/dict/javascript.dict', | |
" \ 'ocaml' : $HOME.'/.vim/dict/ocaml.dict', | |
" \ 'perl' : $HOME.'/.vim/dict/perl.dict', | |
" \ 'php' : $HOME.'/.vim/dict/php.dict', | |
" \ 'scheme' : $HOME.'/.vim/dict/scheme.dict', | |
" \ 'vim' : $HOME.'/.vim/dict/vim.dict', | |
" \ 'ruby' : $HOME.'/.vim/dict/ruby.dict' | |
" \ } | |
let g:neocomplete#enable_auto_delimiter = 1 | |
let g:neocomplete#disable_auto_select_buffer_name_pattern = | |
\ '\[Command Line\]' | |
let g:neocomplete#max_list = 100 | |
let g:neocomplete#force_overwrite_completefunc = 1 | |
if !exists('g:neocomplete#sources#omni#input_patterns') | |
let g:neocomplete#sources#omni#input_patterns = {} | |
endif | |
if !exists('g:neocomplete#sources#omni#functions') | |
let g:neocomplete#sources#omni#functions = {} | |
endif | |
if !exists('g:neocomplete#force_omni_input_patterns') | |
let g:neocomplete#force_omni_input_patterns = {} | |
endif | |
let g:neocomplete#enable_auto_close_preview = 1 | |
let g:neocomplete#sources#omni#input_patterns.ruby = '[^. *\t]\.\w*\|\h\w*::\w*' | |
" let g:neocomplete#sources#omni#input_patterns.perl = '\h\w*->\h\w*\|\h\w*::' | |
if !exists('g:neocomplete#keyword_patterns') | |
let g:neocomplete#keyword_patterns = {} | |
endif | |
let g:neocomplete#keyword_patterns._ = '\h\w*' | |
" let g:neocomplete#keyword_patterns.perl = '\h\w*->\h\w*\|\h\w*::\w*' | |
let g:neocomplete#ignore_source_files = ['tag.vim'] | |
let g:neocomplete#sources#vim#complete_functions = { | |
\ 'Unite' : 'unite#complete_source', | |
\ } | |
call neocomplete#custom#source('look', 'min_pattern_length', 4) | |
inoremap <expr><C-n> pumvisible() ? "\<C-n>" : "\<C-p>\<Down>" | |
inoremap <expr><C-p> pumvisible() ? "\<C-p>" : "\<C-p>\<C-n>" | |
inoremap <expr><C-g> neocomplete#undo_completion() | |
let s:is_auto_pairs = neobundle#is_sourced('auto-pairs') | |
inoremap <expr><CR> neocomplete#smart_close_popup() . "\<CR>" | |
inoremap <silent> <BS> <C-r>=<SID>my_bs_function()<CR> | |
function! s:my_bs_function() | |
let s:bs = s:is_auto_pairs ? AutoPairsDelete() : "\<BS>" | |
return neocomplete#smart_close_popup() . s:bs | |
endfunction | |
inoremap <expr><HOME> neocomplete#close_popup() . "\<HOME>" | |
inoremap <expr><END> neocomplete#close_popup() . "\<END>" | |
inoremap <expr><Left> neocomplete#close_popup() . "\<Left>" | |
inoremap <expr><Right> neocomplete#close_popup() . "\<Right>" | |
inoremap <expr><Up> neocomplete#close_popup() . "\<Up>" | |
inoremap <expr><Down> neocomplete#close_popup() . "\<Down>" | |
endfunction | |
unlet bundle | |
endif | |
"--------------------------------------------------------------------- | |
"" Search | |
"--------------------------------------------------------------------- | |
nnoremap <ESC><ESC> :nohlsearch<CR> | |
nnoremap <C-c><C-c> :nohlsearch<CR> | |
"--------------------------------------------------------------------- | |
" Move | |
"--------------------------------------------------------------------- | |
nnoremap j gj | |
nnoremap k gk | |
nnoremap 0 ^ | |
imap <C-e> <END> | |
imap <C-a> <HOME> | |
imap <C-j> <Down> | |
imap <C-k> <Up> | |
imap <C-h> <Left> | |
imap <C-l> <Right> | |
noremap <Space>j <C-f> | |
noremap <Space>k <C-b> | |
augroup CursorLine | |
autocmd! | |
autocmd BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal g`\"" | endif | |
augroup END | |
nnoremap ( % | |
nnoremap ) % | |
set virtualedit+=block | |
vnoremap v $h | |
nnoremap <C-j> <C-w>j | |
nnoremap <C-k> <C-w>k | |
nnoremap <C-l> <C-w>l | |
nnoremap <C-h> <C-w>h | |
nnoremap tc :<C-u>tabnew \| :NERDTree<CR> | |
nnoremap tx :<C-u>tabclose<CR> | |
nnoremap to :<C-u>tabonly<CR> | |
nnoremap <Space><Space> :<C-u>tabnext<CR> | |
nnoremap <BS><BS> :<C-u>tabprevious<CR> | |
"--------------------------------------------------------------------- | |
" Tags | |
"--------------------------------------------------------------------- | |
set notagbsearch | |
nnoremap t <Nop> | |
nnoremap tt <C-]> | |
nnoremap tj :<C-u>tag<CR> | |
nnoremap tk :<C-u>pop<CR> | |
nnoremap tl :<C-u>tags<CR> | |
"--------------------------------------------------------------------- | |
" Colors | |
"--------------------------------------------------------------------- | |
syntax enable | |
if neobundle#is_installed('colorschemes') && neobundle#is_sourced('colorschemes') | |
colorscheme calorie | |
endif | |
set t_Co=256 | |
set t_Sf=[3%dm | |
set t_Sb=[4%dm | |
if &term =~ 'xterm-debian' || &term =~ 'xterm-xfree86' | |
set t_Co=16 | |
set t_Sf=[3%dm | |
set t_Sb=[4%dm | |
elseif &term =~ 'xterm-color' | |
set t_Co=8 | |
set t_Sf=[3%dm | |
set t_Sb=[4%dm | |
endif | |
highlight Pmenu ctermbg=255 ctermfg=0 guifg=#000000 guibg=#999999 | |
highlight PmenuSbar ctermbg=255 ctermfg=0 guifg=#000000 guibg=#FFFFFF | |
highlight PmenuSel cterm=reverse ctermfg=33 ctermbg=222 gui=reverse guifg=#3399ff guibg=#f0e68c | |
"--------------------------------------------------------------------- | |
" Edit | |
"--------------------------------------------------------------------- | |
set noimdisable | |
set iminsert=0 imsearch=0 | |
set noimcmdline | |
vnoremap p <Esc>:let current_reg = @"<CR>gvdi<C-R>=current_reg<CR><Esc> | |
set expandtab | |
inoremap , ,<Space> | |
inoremap <C-u> <C-g>u<C-u> | |
imap <C-b> <BS> | |
function! s:remove_dust() | |
let cursor = getpos(".") | |
%s/\s\+$//ge | |
if &ft !~ 'make' | |
%s/\t/ /ge | |
endif | |
call setpos(".", cursor) | |
unlet cursor | |
endfunction | |
augroup RemoveDust | |
autocmd! | |
autocmd BufWritePre * call <SID>remove_dust() | |
augroup END | |
"--------------------------------------------------------------------- | |
" Encoding | |
"--------------------------------------------------------------------- | |
set ffs=unix | |
set encoding=utf-8 | |
augroup Encoding | |
autocmd! | |
autocmd FileType cvs :set fileencoding=euc-jp | |
autocmd FileType svn :set fileencoding=utf-8 | |
autocmd FileType js :set fileencoding=utf-8 | |
autocmd FileType css :set fileencoding=utf-8 | |
autocmd FileType html :set fileencoding=utf-8 | |
autocmd FileType xml :set fileencoding=utf-8 | |
autocmd FileType java :set fileencoding=utf-8 | |
autocmd FileType scala :set fileencoding=utf-8 | |
augroup END | |
set suffixes=.bak,~,.swp,.o,.info,.aux,.log,.dvi,.bbl,.blg,.brf,.cb,.ind,.idx,.ilg,.inx,.out,.toc | |
command! Cp932 edit ++enc=cp932 | |
command! Eucjp edit ++enc=euc-jp | |
command! Iso2022jp edit ++enc=iso-2022-jp | |
command! Utf8 edit ++enc=utf-8 | |
command! Jis Iso2022jp | |
command! Sjis Cp932 | |
"-------------------------------------------------------------------- | |
" Plugins | |
"-------------------------------------------------------------------- | |
"------------------------------------ | |
" tabular | |
"------------------------------------ | |
vnoremap tb :Tab / | |
"------------------------------------ | |
" tcomment_vim | |
"------------------------------------ | |
let g:tcommentmaps = 0 | |
nnoremap <silent>gcc :TComment<CR> | |
vnoremap <silent>gc :TComment<CR> | |
"------------------------------------ | |
" surround.vim | |
"------------------------------------ | |
nmap ds <Plug>Dsurround | |
nmap cs <Plug>Csurround | |
xmap S <Plug>VSurround | |
xmap gS <Plug>VgSurround | |
let g:surround_{char2nr('e')} = "begin \r end" | |
let g:surround_{char2nr('d')} = "do \r end" | |
let g:surround_{char2nr("-")} = ":\r" | |
"------------------------------------ | |
" Fugitive.vim | |
"------------------------------------ | |
nnoremap <Space>gd :<C-u>Gdiff<CR> | |
nnoremap <Space>gs :<C-u>Gstatus<CR> | |
nnoremap <Space>gl :<C-u>Glog<CR> | |
nnoremap <Space>ga :<C-u>Gwrite<CR> | |
nnoremap <Space>gc :<C-u>Gcommit<CR> | |
nnoremap <Space>gC :<C-u>Git commit --amend<CR> | |
nnoremap <Space>gb :<C-u>Gblame<CR> | |
"------------------------------------ | |
" smartword.vim | |
"------------------------------------ | |
map W <Plug>(smartword-w) | |
map B <Plug>(smartword-b) | |
map E <Plug>(smartword-e) | |
map ge <Plug>(smartword-ge) | |
"------------------------------------ | |
" unite.vim | |
"------------------------------------ | |
nnoremap [unite] <Nop> | |
nmap <Space> [unite] | |
nnoremap <silent> [unite]a :<C-u>UniteWithCurrentDir -auto-preview -buffer-name=all buffer file_mru bookmark file<CR> | |
nnoremap <silent> [unite]f :<C-u>Unite -auto-preview -buffer-name=file file<CR> | |
nnoremap <silent> [unite]b :<C-u>Unite -auto-preview -buffer-name=buffre buffer<CR> | |
nnoremap <silent> [unite]u :<C-u>Unite -auto-preview -buffer-name=file_mru buffer file_mru<CR> | |
nnoremap <silent> [unite]m :<C-u>Unite -auto-preview -buffer-name=mru file_mru<CR> | |
nnoremap <silent> [unite]d :<C-u>UniteWithBufferDir -auto-preview -buffer-name=dir file<CR> | |
nnoremap <silent> [unite]A :<C-u>UniteBookmarkAdd<CR><CR><CR> | |
nnoremap <silent> [unite]B :<C-u>Unite -auto-preview -buffer-name=bookmark bookmark<CR> | |
nnoremap <silent> [unite]gr :<C-u>Unite -auto-preview -buffer-name=grep -immediately grep:<CR> | |
nnoremap <silent> [unite]Gr :<C-u>UniteWithCursorWord -auto-preview -buffer-name=grep -immediately grep<CR> | |
let s:bundle = neobundle#get('unite.vim') | |
function! s:bundle.hooks.on_source(bundle) | |
augroup UniteSettings | |
autocmd! | |
autocmd FileType unite call s:unite_my_settings() | |
augroup END | |
function! s:unite_my_settings() | |
nmap <buffer> <ESC> <Plug>(unite_exit) | |
nmap <buffer> <ESC><ESC> <Plug>(unite_exit) | |
nnoremap <silent><buffer> <C-k> :<C-u>call unite#mappings#do_action('preview')<CR> | |
imap <buffer> <C-w> <Plug>(unite_delete_backward_path) | |
nnoremap <silent> <buffer> <expr> o unite#do_action('open') | |
nnoremap <silent> <buffer> <expr> l unite#do_action('split') | |
nnoremap <silent> <buffer> <expr> s unite#do_action('vsplit') | |
endfunction | |
let g:unite_source_history_yank_enable = 1 | |
let g:unite_source_history_yank_save_clipboard = 1 | |
let g:unite_split_rule = "rightbelow" | |
let g:unite_enable_start_insert = 0 | |
let g:unite_source_file_mru_limit = 200 | |
let g:unite_enable_split_vertically = 1 | |
let g:unite_source_grep_max_candidates = 200 | |
let g:unite_source_grep_default_opts = "-HnEi" | |
\ . " --exclude='*.svn*'" | |
\ . " --exclude='*.log*'" | |
\ . " --exclude='*tmp*'" | |
\ . " --exclude-dir='tmp'" | |
\ . " --exclude-dir='log'" | |
\ . " --exclude-dir='vendor'" | |
\ . " --exclude-dir='CVS'" | |
\ . " --exclude-dir='.svn'" | |
\ . " --exclude-dir='.git'" | |
if executable('ag') | |
let g:unite_source_grep_command = 'ag' | |
let g:unite_source_grep_default_opts = '-S --nogroup --nocolor --column --hidden' | |
let g:unite_source_grep_recursive_opt = '' | |
endif | |
endfunction | |
unlet s:bundle | |
"------------------------------------ | |
" quickrun.vim | |
"------------------------------------ | |
nnoremap <silent><Leader>r :QuickRun<CR> | |
let s:bundle = neobundle#get('vim-quickrun') | |
function! s:bundle.hooks.on_source(bundle) | |
let g:quickrun_config = {} | |
let g:quickrun_config.c = { | |
\ 'type': 'c/gcc', | |
\ 'command': 'gcc', | |
\ 'exec': ['%c %o %s -o %s:p:r -lm', '%s:p:r %a'], | |
\ 'tempfile': '%{tempname()}.c', | |
\ 'hook/sweep/files': '%S:p:r', | |
\ 'cmdopt': '-std=c99 -Wall', | |
\ 'args': '%{input("argv> ")}', | |
\ } | |
endfunction | |
unlet s:bundle | |
"------------------------------------ | |
" NERDTree.vim | |
"------------------------------------ | |
augroup NERDTree | |
autocmd! | |
autocmd VimEnter * if !argc() && neobundle#is_installed('nerdtree') | NERDTree | endif | |
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif | |
autocmd FileType nerdtree silent! nunmap <buffer> CD | |
augroup END | |
nnoremap <Leader>nt :<C-u>NERDTreeToggle<CR> | |
nnoremap <Leader>nf :<C-u>NERDTreeFind<CR> | |
let g:NERDTreeShowHidden = 1 | |
let g:NERDTreeWinSize = 20 | |
let g:NERDTreeIgnore = ['.DS_Store', '.gitkeep', '.keep', '\.lo$', '\.o$', '.dirstamp', '.libs', '.deps', '.meta'] | |
"------------------------------------ | |
" neosnippets | |
"------------------------------------ | |
imap <C-f> <Plug>(neosnippet_expand_or_jump) | |
smap <C-f> <Plug>(neosnippet_expand_or_jump) | |
imap <expr><TAB> neosnippet#expandable() ? "\<Plug>(neosnippet_expand_or_jump)" : pumvisible() ? "\<C-n>" : "\<TAB>" | |
smap <expr><TAB> neosnippet#expandable() ? "\<Plug>(neosnippet_expand_or_jump)" : "\<TAB>" | |
let g:neosnippet#snippets_directory = '~/.vim/bundle/snipmate-snippets/snippets,~/.vim/snippets' | |
if has('conceal') | |
set conceallevel=2 concealcursor=i | |
endif | |
"------------------------------------ | |
" easy-mosion | |
"------------------------------------ | |
let s:bundle = neobundle#get('vim-easymotion') | |
function! s:bundle.hooks.on_source(bundle) | |
let g:EasyMotion_keys = 'hjklasdfgyuiopqwertnmzxcvbHJKLASDFGYUIOPQWERTNMZXCVB' | |
let g:EasyMotion_leader_key = '<Leader>' | |
let g:EasyMotion_grouping = 1 | |
highlight EasyMotionTarget ctermbg=none ctermfg=red | |
highlight EasyMotionShade ctermbg=none ctermfg=blue | |
endfunction | |
unlet s:bundle | |
"------------------------------------ | |
" Syntastic | |
"------------------------------------ | |
let s:bundle = neobundle#get('syntastic') | |
function! s:bundle.hooks.on_source(bundle) | |
let g:syntastic_enable_signs = 1 | |
let g:syntastic_enable_highlighting = 1 | |
let g:syntastic_auto_jump = 0 | |
let g:syntastic_auto_loc_list = 1 | |
let g:syntastic_check_on_open = 0 | |
let g:syntastic_echo_current_error = 1 | |
let g:syntastic_enable_balloons = 1 | |
let g:syntastic_loc_list_height = 3 | |
let g:syntastic_quiet_messages = {} | |
let g:syntastic_mode_map = { | |
\ 'mode' : 'passive', | |
\ 'active_filetypes' : [], | |
\ } | |
endfunction | |
unlet s:bundle | |
"------------------------------------ | |
" vim-endwise | |
"------------------------------------ | |
" let g:endwise_no_mappings = 1 | |
"------------------------------------ | |
" vim-tags | |
"------------------------------------ | |
let s:vim_tags_path_prefix = '/usr/' | |
let g:vim_tags_project_tags_command = s:vim_tags_path_prefix . "bin/ctags -R {OPTIONS} {DIRECTORY} 2>/dev/null" | |
let g:vim_tags_gems_tags_command = s:vim_tags_path_prefix . "bin/ctags -R {OPTIONS} `bundle show --paths` 2>/dev/null" | |
let g:vim_tags_auto_generate = 1 | |
let g:vim_tags_use_vim_dispatch = 1 | |
let g:vim_tags_use_ycm = 0 | |
"------------------------------------ | |
" text-manipvim | |
"------------------------------------ | |
xmap <C-h> <Plug>(textmanip-move-left) | |
xmap <C-j> <Plug>(textmanip-move-down) | |
xmap <C-k> <Plug>(textmanip-move-up) | |
xmap <C-l> <Plug>(textmanip-move-right) | |
"------------------------------------ | |
" sudo.vim | |
"------------------------------------ | |
augroup Sudo | |
autocmd! | |
autocmd BufReadCmd sudo:*,sudo:*/* SudoRead <afile> | |
autocmd FileReadCmd sudo:*,sudo:*/* SudoRead <afile> | |
autocmd BufWriteCmd sudo:*,sudo:*/* SudoWrite <afile> | |
autocmd FileWriteCmd sudo:*,sudo:*/* SudoWrite <afile> | |
augroup END | |
"------------------------------------ | |
" vim-airline | |
"------------------------------------ | |
let g:airline_powerline_fonts = 0 | |
let g:airline#extensions#branch#enabled = 1 | |
let g:airline#extensions#bufferline#enabled = 0 | |
let g:airline#extensions#tagbar#enabled = 0 | |
let g:airline#extensions#whitespace#enabled = 0 | |
let g:airline#extensions#tabline#enabled = 1 | |
let g:airline#extensions#tabline#tab_nr_type = 1 | |
let g:airline#extensions#tabline#show_buffers = 0 | |
let g:airline#extensions#tabline#tab_min_count = 2 | |
let g:airline#extensions#tabline#left_sep = '' | |
let g:airline#extensions#tabline#left_alt_sep = '' | |
let g:airline#extensions#tabline#right_sep = '' | |
let g:airline#extensions#tabline#right_alt_sep = '' | |
let g:airline_left_sep = '' | |
let g:airline_left_alt_sep = '' | |
let g:airline_right_sep = '' | |
let g:airline_right_alt_sep = '' | |
if !exists('g:airline_symbols') | |
let g:airline_symbols = {} | |
endif | |
let g:airline_symbols.branch = '' | |
let g:airline_symbols.readonly = 'RO' | |
let g:airline_symbols.linenr = '' | |
let g:airline_theme = 'raven' | |
let g:airline_mode_map = { | |
\ '__' : '-', | |
\ 'n' : 'N', | |
\ 'i' : 'I', | |
\ 'R' : 'R', | |
\ 'c' : 'C', | |
\ 'v' : 'V', | |
\ 'V' : 'V-L', | |
\ '' : 'V-B', | |
\ 's' : 'S', | |
\ 'S' : 'S', | |
\ '' : 'S', | |
\ } | |
"------------------------------------ | |
" vim-textobj-entire | |
"------------------------------------ | |
xmap ae <Plug>(textobj-entire-a) | |
xmap ie <Plug>(textobj-entire-i) | |
"------------------------------------ | |
" vim-swap-windows | |
"------------------------------------ | |
nnoremap <silent> <leader>mw :MarkWindow<CR> | |
nnoremap <silent> <leader>pw :SwapWindows<CR> | |
"------------------------------------ | |
" vim-auto-save | |
"------------------------------------ | |
let g:auto_save = 1 | |
let g:auto_save_silent = 1 | |
let g:auto_save_in_insert_mode = 0 | |
"------------------------------------ | |
" auto-pairs | |
"------------------------------------ | |
let g:AutoPairsMapBS = 0 | |
"------------------------------------ | |
" switch.vim | |
"------------------------------------ | |
nnoremap + :Switch<CR> | |
nnoremap - :call switch#Switch(g:variable_style_switch_definitions)<cr> | |
let g:switch_custom_definitions = | |
\ [ | |
\ ['+', '-'], | |
\ ['*', '/'], | |
\ ['and', 'or'], | |
\ ['yes', 'no'], | |
\ ['if', 'unless'], | |
\ ['enable', 'disable'], | |
\ ['pick', 'reword', 'fixup', 'squash', 'edit', 'exec'], | |
\ ] | |
let g:variable_style_switch_definitions = [ | |
\ { | |
\ '\<[a-z0-9]\+_\k\+\>': { | |
\ '_\(.\)': '\U\1' | |
\ }, | |
\ '\<[a-z0-9]\+[A-Z]\k\+\>': { | |
\ '\([A-Z]\)': '_\l\1' | |
\ }, | |
\ } | |
\ ] | |
"------------------------------------ | |
" vim-anzu | |
"------------------------------------ | |
let g:anzu_search_limit = 100 | |
nmap n <Plug>(anzu-n-with-echo) | |
nmap N <Plug>(anzu-N-with-echo) | |
nmap * <Plug>(anzu-star-with-echo) | |
nmap # <Plug>(anzu-sharp-with-echo) | |
"------------------------------------ | |
" indentLine | |
"------------------------------------ | |
let g:indentLine_noConcealCursor = '' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment