Created
August 13, 2013 13:14
-
-
Save supermomonga/6220953 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
" Kanari Sugoi .vimrc | |
" Rules {{{ | |
" Mapping {{{ | |
" | |
" * Emacs-like mapping | |
" - If the command is not countable and motionable, | |
" that command should be mapped with Emacs-like binding | |
" - e.g. ":Unite buffer" should be mapped with "<C-x>b" | |
" instead of "<Space>ub" | |
" | |
" }}} | |
" NeoBundle {{{ | |
" | |
" * Managing | |
" - Options for "NeoBundleLazy" is only "build", "depends", and other | |
" options which is related of installing, building, and updating. | |
" | |
" - Configurations such as "autoload", plugin's setting should be | |
" set in each "bundled" or "on_source" sections. | |
" | |
" }}} | |
" }}} | |
" Basic {{{ | |
" Absolute {{{ | |
" Reset Autocmd group | |
augroup MyAutoCmd | |
autocmd! | |
augroup END | |
" Echo startup time on start | |
if has('vim_starting') && has('reltime') | |
let g:startuptime = reltime() | |
augroup MyAutoCmd | |
autocmd! VimEnter * let g:startuptime = reltime(g:startuptime) | redraw | |
\ | echomsg 'startuptime: ' . reltimestr(g:startuptime) | |
augroup END | |
endif | |
" .vim folder | |
" Maybe I will never use other os than OS X... | |
if has('unix') | |
let $VIM_DOTVIM_DIR=expand('~/.vim') | |
else | |
let $VIM_DOTVIM_DIR=expand('~/.vim') | |
endif | |
let $VIM_REMOTE_BUNDLE_DIR = $VIM_DOTVIM_DIR . '/bundle' | |
let $VIM_LOCAL_BUNDLE_DIR = $VIM_DOTVIM_DIR . '/local_bundle' | |
let $VIM_NEOBUNDLE_DIR = $VIM_REMOTE_BUNDLE_DIR . '/neobundle.vim' | |
let $VIM_SWAP_DIR = $VIM_DOTVIM_DIR . '/tmp/swap' | |
let $VIM_BACKUP_DIR = $VIM_DOTVIM_DIR . '/tmp/backup' | |
let $VIM_UNDO_DIR = $VIM_DOTVIM_DIR . '/tmp/undo' | |
" }}} | |
" Functions {{{ | |
function! s:Set(variable, value) " {{{ | |
execute printf("let &%s = a:value", a:variable) | |
endfunction " }}} | |
function! s:GetPathSeparator() " {{{ | |
if has('win32') || has('win64') | |
return ';' | |
else | |
return ':' | |
endif | |
endfunction " }}} | |
function! s:PrependPath(current, path) " {{{ | |
return a:current == '' ? | |
\ a:path : a:path . s:GetPathSeparator() . a:current | |
endfunction " }}} | |
function! s:AppendPath(current, path) " {{{ | |
return a:current == '' ? | |
\ a:path : a:current . s:GetPathSeparator() . a:append | |
endfunction " }}} | |
function! s:bundle_tap(bundle) " {{{ | |
let s:tapped_bundle = neobundle#get(a:bundle) | |
return neobundle#is_installed(a:bundle) | |
endfunction " }}} | |
function! s:bundle_config(config) " {{{ | |
if exists("s:tapped_bundle") && s:tapped_bundle != {} | |
" let a:config.lazy = 1 | |
call neobundle#config(s:tapped_bundle.name, a:config) | |
endif | |
endfunction " }}} | |
function! s:bundle_untap() " {{{ | |
let s:tapped_bundle = {} | |
endfunction " }}} | |
" }}} | |
" NeoBundle {{{ | |
" Use VIM features instead of vi | |
set nocompatible | |
" To use NeoBundle, manually add to runtimepath | |
if has('vim_starting') | |
set runtimepath+=$VIM_NEOBUNDLE_DIR | |
" To load my local development plugin | |
call neobundle#local(expand($VIM_LOCAL_BUNDLE_DIR), { 'resettable' : 0 }) | |
endif | |
" To load remote plugin | |
call neobundle#rc(expand($VIM_REMOTE_BUNDLE_DIR)) | |
" Let NeoBundle manage NeoBundle | |
NeoBundleFetch 'Shougo/neobundle.vim' | |
" Required to use | |
filetype plugin indent on | |
" }}} | |
" Appearance UI {{{ | |
" }}} | |
" Appearance Color {{{ | |
" }}} | |
" Syntax {{{ | |
" }}} | |
" Backup {{{ | |
call s:Set('directory', $VIM_SWAP_DIR) | |
call s:Set('backupdir', $VIM_BACKUP_DIR) | |
call s:Set('undodir', $VIM_UNDO_DIR) | |
" }}} | |
" }}} | |
" Edit {{{ | |
" Indent {{{ | |
" Use Space instead of Tab to make indent | |
set expandtab | |
" TODO: Width of tab? | |
set tabstop=2 | |
" Hoe many spaces to each indent level | |
set shiftwidth=2 | |
" Automatically adjust indent | |
set autoindent | |
" Automatically indent when insert a new line | |
set smartindent | |
" Insert an indent when keydown <Tab> in indent spaces | |
set smarttab | |
" Symbols to use indent or other | |
set listchars=tab:▸\ ,trail:-,extends:»,precedes:«,nbsp:% | |
" }}} | |
" Movement {{{ | |
" BS can delete newline or indent | |
set backspace=indent,eol,start | |
" Can move at eol, bol | |
set whichwrap=b,s,h,l,<,>,[,] | |
" }}} | |
" Folding {{{ | |
" Use marker to fold | |
" e.g. {{{kanari_sugoi_code}}} | |
" TODO: [Problem] When I input close marker which is "}" three times, | |
" the all foldings after that will be opened... | |
set foldmethod=marker | |
" }}} | |
" Search {{{ | |
" incremental search | |
set incsearch | |
" Dont think upper-lower case until upper-case input | |
set smartcase | |
" }}} | |
" Buffer Handling {{{ | |
" Can change buffer in window no matter buffer is unsaved | |
set hidden | |
" }}} | |
" TODO: Input Method {{{ | |
" TODO: Disable japanese input mode when exit from the insert mode | |
" }}} | |
" Basic Key Mapping {{{ | |
" [Emacs] Increment, Decrement by -, + | |
" Bcause I want to use <C-x> for Emacs-like mapping | |
nnoremap + <C-a> | |
nnoremap - <C-x> | |
" [Emacs] <C-k> to close buffer completely | |
nnoremap <C-x>k :bw<CR> | |
" [Emacs] <C-e> to EOL | |
nnoremap <C-e> $ | |
" [Emacs] <C-k> to Delete a line | |
nnoremap <C-k> dd | |
" Toggle 0 and ^ | |
nnoremap <expr>0 col('.') == 1 ? '^' : '0' | |
nnoremap <expr>^ col('.') == 1 ? '^' : '0' | |
" : without <Shift> | |
nnoremap ; : | |
" _ : Quick horizontal splits | |
nnoremap _ :sp<CR> | |
" | : Quick vertical splits | |
nnoremap <bar> :vsp<CR> | |
" N: Find next occurrence backward | |
nnoremap N Nzzzv | |
nnoremap n nzzzv | |
" Backspace: Act like normal backspace | |
" TODO: Mac OS X doesn't have <BS>. have delete key. | |
nnoremap <BS> X | |
" cmdwin | |
nnoremap : q:i | |
" TODO: Move those settins to right section | |
autocmd MyAutoCmd CmdwinEnter [:>] iunmap <buffer> <Tab> | |
autocmd MyAutoCmd CmdwinEnter [:>] nunmap <buffer> <Tab> | |
" JK peropero | |
" Use logical move instead of physical ones | |
nnoremap j gj | |
nnoremap k gk | |
" Easy to make selection to pars | |
onoremap ) f) | |
onoremap ( t( | |
" Easy to insert space in normal mode | |
nnoremap <C-l> i<Space><Esc><Right> | |
nnoremap <C-h> i<Space><Esc> | |
" }}} | |
" }}} | |
" Bundle {{{ | |
" Secret{{{ | |
" This file contains only g:vimrc_secrets. | |
if filereadable(expand('~/.secret_vimrc')) | |
let g:vimrc_secrets = {} | |
execute 'source' expand('~/.secret_vimrc') | |
endif | |
" }}} | |
" List {{{ | |
NeoBundleLazy "Shougo/vimproc.vim", { | |
\ 'build' : { | |
\ 'windows' : "mingw32-make -f make_mingw32.mak", | |
\ 'cygwin' : "make -f make_cygwin.mak", | |
\ 'mac' : "make -f make_mac.mak", | |
\ 'unix' : "make -f make_unix.mak", | |
\ }, | |
\ } | |
NeoBundleLazy "Shougo/unite.vim", { 'depends' : [ "vimproc.vim" ] } | |
NeoBundleLazy "Shougo/vimshell.vim", { 'depends' : [ "vimproc.vim" ] } | |
" }}} | |
" Plugin Configurations {{{ | |
if s:bundle_tap("unite.vim") | |
echo "hi" | |
call s:bundle_config({ | |
\ 'autoload' : { | |
\ 'commands' : [ "Unite" ] | |
\ } | |
\ }) | |
function! s:tapped_bundle.hooks.on_source(bundle) | |
let g:unite_source_file_mru_limit = 300 | |
let g:unite_kind_jump_list_after_jump_scroll=0 | |
endfunction | |
call s:bundle_untap() | |
endif | |
" }}} | |
" }}} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment