Created
August 14, 2013 23:22
-
-
Save supermomonga/6236767 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 | |
" To use camel_case. | |
let g:My = {} | |
let s:my = g:My | |
" 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' | |
" }}} | |
" Environment Variables {{{ | |
let $PATH = s:append_path($PATH, '~/bin/') | |
let $PATH = s:append_path($PATH, '/Applications/MacVim.app/Contents/MacOS/' | |
" Java {{{ | |
" It's necessary to show Japanese messages from JDK | |
let $LANG = 'ja_JP.UTF-8' | |
" Set JAVA_HOME to select your favorite JDK version. | |
let $JAVA_HOME = '/Library/Java/JavaVirtualMachines/jdk1.7.0_25.jdk/Contents/Home' | |
let $CLASSPATH = s:append_path($CLASSPATH, '.') | |
" The directory which contains `jfxrt.jar`. | |
" Note that in JDK8, `jfxrt.jar` is in ext folder | |
if match($JAVA_HOME, 'jdk1.8') != -1 | |
let $JFX_DIR = $JAVA_HOME . '/jre/lib/ext/' | |
else | |
let $JFX_DIR = $JAVA_HOME . '/jre/lib/' | |
endif | |
" }}} | |
" }}} | |
" Encoding {{{ | |
" | |
let &termencoding = &encoding | |
set encoding=utf-8 | |
set fileencoding=utf-8 | |
set fileencodings=ucs-bom,utf-8,iso-2022-jp-3,iso-2022-jp,eucjp-ms,euc-jisx0213,euc-jp,sjis,cp932 | |
set fileformats=unix,dos,mac | |
" }}} | |
" Functions {{{ | |
function! s:set(variable, value) " {{{ | |
execute printf("let &%s = a:value", a:variable) | |
endfunction " }}} | |
function! s:get_path_separator() " {{{ | |
if has('win32') || has('win64') | |
return ';' | |
else | |
return ':' | |
endif | |
endfunction " }}} | |
function! s:prepend_path(current, path) " {{{ | |
return a:current == '' ? | |
\ a:path : a:path . s:get_path_separator() . a:current | |
endfunction " }}} | |
function! s:append_path(current, path) " {{{ | |
return a:current == '' ? | |
\ a:path : a:current . s:get_path_separator() . 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 " }}} | |
" }}} | |
" Appearance UI {{{ | |
" Show line number | |
set number | |
" Always show tab | |
set showtabline=2 | |
" Alternative chars for eol, tab, and others | |
set listchars=eol:$,tab:>-,extends:< | |
" When input close bracket, show start bracket | |
set showmatch | |
" }}} | |
" 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 ; : | |
vnoremap ; : | |
" _ : 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 | |
" }}} | |
" Setup {{{ | |
" 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' | |
" }}} | |
" List {{{ | |
NeoBundle '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', | |
\ }} | |
NeoBundle 'bling/vim-airline' | |
NeoBundle 'surround.vim' | |
NeoBundle 'kana/vim-repeat' | |
NeoBundle 'kana/vim-submode' | |
NeoBundle 'kana/vim-textobj-user' | |
NeoBundle 'kana/vim-textobj-entire', { 'depends' : 'kana/vim-textobj-user' } | |
NeoBundle 'kana/vim-textobj-function', { 'depends' : 'kana/vim-textobj-user' } | |
NeoBundle 'kana/vim-textobj-indent', { 'depends' : 'kana/vim-textobj-user' } | |
NeoBundle 'osyo-manga/vim-textobj-multiblock', { 'depends' : 'kana/vim-textobj-user' } | |
NeoBundle 'osyo-manga/vim-automatic' | |
NeoBundle 'jceb/vim-hier' | |
NeoBundle 'vim-jp/vimdoc-ja' | |
NeoBundleLazy 'Shougo/unite.vim', { 'depends' : [ 'Shougo/vimproc.vim' ] } | |
NeoBundleLazy 'Shougo/vimshell.vim', { 'depends' : [ 'Shougo/vimproc.vim' ] } | |
NeoBundleLazy 'Shougo/neosnippet.vim' | |
NeoBundleLazy 'Shougo/neocomplete.vim' | |
NeoBundleLazy 'h1mesuke/vim-alignta' | |
NeoBundleLazy 'kana/vim-smartinput' | |
NeoBundleLazy 'mattn/gist-vim', { 'depends' : [ 'mattn/webapi-vim' ] } | |
NeoBundleLazy 'thinca/vim-prettyprint' | |
NeoBundleLazy 'thinca/vim-quickrun' | |
NeoBundleLazy 'thinca/vim-ref' | |
" Ruby | |
NeoBundleLazy 'vim-ruby/vim-ruby' | |
NeoBundleLazy 'taka84u9/vim-ref-ri', { 'depends' : [ 'Shougo/unite.vim', 'thinca/vim-ref' ] } | |
NeoBundleLazy 'tpope/vim-rails' | |
" NeoBundleLazy 'tpope/vim-endwise' | |
NeoBundleLazy 'basyura/unite-rails', { 'depends' : [ 'Shougo/unite.vim' ] } | |
" TODO: Windows build command to get .ctags | |
NeoBundleLazy 'alpaca-tc/alpaca_tags', { | |
\ 'depends' : [ 'Shougo/vimproc.vim' ], | |
\ 'build' : { | |
\ 'mac' : 'wget https://raw.github.com/alpaca-tc/alpaca_tags/master/.ctags -O ~/.ctags', | |
\ 'unix' : 'wget https://raw.github.com/alpaca-tc/alpaca_tags/master/.ctags -O ~/.ctags', | |
\ } | |
\ } | |
" TODO: atode settei simasu... | |
" NeoBundleLazy 'tpope/vim-endwise' | |
" NeoBundleLazy 'tpope/vim-fugitive' | |
" NeoBundleLazy 'tpope/vim-markdown' | |
" NeoBundleLazy 'tsukkee/lingr-vim' | |
" Disable some local bundles | |
NeoBundleDisable vimshell-kawaii.vim | |
NeoBundleDisable vimshell-scopedalias.vim | |
NeoBundleDisable unite-vacount2012.vim | |
NeoBundleDisable vimshell-suggest.vim | |
" Required to use | |
filetype plugin indent on | |
" }}} | |
" Plugin Configurations {{{ | |
if s:bundle_tap('unite.vim') " {{{ | |
call s:bundle_config({ | |
\ 'autoload' : { | |
\ 'commands' : [ | |
\ { | |
\ 'name' : 'Unite', | |
\ 'complete' : 'customlist,unite#complete_source' | |
\ }, | |
\ 'UniteWithCursorWord', | |
\ 'UniteWithInput' | |
\ ] | |
\ } | |
\ }) | |
function! s:tapped_bundle.hooks.on_source(bundle) | |
let g:unite_kind_jump_list_after_jump_scroll=0 | |
let g:unite_enable_start_insert = 1 | |
let g:unite_source_rec_min_cache_files = 1000 | |
let g:unite_source_rec_max_cache_files = 5000 | |
let g:unite_source_file_mru_long_limit = 6000 | |
let g:unite_source_file_mru_limit = 300 | |
let g:unite_source_directory_mru_long_limit = 6000 | |
let g:unite_prompt = '❯ ' | |
endfunction | |
call s:bundle_untap() | |
endif " }}} | |
if s:bundle_tap('vimshell.vim') " {{{ | |
call s:bundle_config({ | |
\ 'autoload' : { | |
\ 'commands' : [ 'VimShell', 'VimShellPop' ] | |
\ } | |
\ }) | |
function! s:tapped_bundle.hooks.on_source(bundle) | |
endfunction | |
nnoremap <C-x><C-v> :<C-u>VimShellPop -toggle<CR> | |
inoremap <C-x><C-v> :<C-u>VimShellPop -toggle<CR> | |
call s:bundle_untap() | |
endif " }}} | |
if s:bundle_tap('neocomplete.vim') " {{{ | |
call s:bundle_config({ | |
\ 'autoload' : { | |
\ 'insert' : 1, | |
\ } | |
\ }) | |
function! s:tapped_bundle.hooks.on_source(bundle) | |
" Enable at startup | |
let g:neocomplete#enable_at_startup = 1 | |
" Smartcase | |
let g:neocomplete#enable_smart_case = 1 | |
" Enable _ separated completion | |
let g:neocomplete_enable_underbar_completion = 1 | |
" Minimum length to cache | |
let g:neocomplete_min_syntax_length = 3 | |
" Max size of candidates to show | |
let g:neocomplete#max_list = 1000 | |
" How many length to need to start completion | |
let g:neocomplete_auto_completion_start_length = 2 | |
" Auto select the first candidate | |
" let g:neocomplete_enable_auto_select = 1 | |
" Force to overwrite complete func | |
let g:neocomplete_force_overwrite_completefunc = 1 | |
" let g:neocomplete_enable_camel_case_completion = 1 | |
let g:neocomplete#skip_auto_completion_time = '0.3' | |
" Cancel and close popup | |
" imap <expr><C-g> neocomplete#cancel_popup() | |
endfunction | |
call s:bundle_untap() | |
endif " }}} | |
if s:bundle_tap('neosnippet.vim') " {{{ | |
call s:bundle_config({ | |
\ 'autoload' : { | |
\ 'insert' : 1, | |
\ 'filetype' : 'snippet', | |
\ 'commands' : [ 'NeoSnippetEdit', 'NeoSnippetSource' ], | |
\ 'filetypes' : [ 'nsnippet' ], | |
\ 'unite_sources' : | |
\ ['snippet', 'neosnippet/user', 'neosnippet/runtime'] | |
\ } | |
\ }) | |
function! s:tapped_bundle.hooks.on_source(bundle) | |
let g:neosnippet#enable_snipmate_compatibility = 1 | |
" My original snippets | |
let g:neosnippet#snippets_directory='~/.vim/snippets' | |
" <CR> to expand snippet if can | |
imap <expr><CR> !pumvisible() ? "\<CR>" : | |
\ neosnippet#expandable() ? "\<Plug>(neosnippet_expand)" : | |
\ neocomplete#smart_close_popup() | |
" supertab. | |
imap <expr><TAB> pumvisible() ? "\<C-n>" : | |
\ neosnippet#jumpable() ? "\<Plug>(neosnippet_jump)" : | |
\ "\<TAB>" | |
smap <expr><TAB> pumvisible() ? "\<C-n>" : | |
\ neosnippet#jumpable() ? "\<Plug>(neosnippet_jump)" : | |
\ "\<TAB>" | |
endfunction | |
call s:bundle_untap() | |
endif " }}} | |
if s:bundle_tap('vim-alignta') " {{{ | |
call s:bundle_config({ | |
\ 'autoload' : { | |
\ 'commands' : ['Alignta'], | |
\ } | |
\ }) | |
function! s:tapped_bundle.hooks.on_source(bundle) | |
endfunction | |
call s:bundle_untap() | |
endif " }}} | |
if s:bundle_tap('vim-smartinput') " {{{ | |
call s:bundle_config({ | |
\ 'autoload' : { | |
\ 'insert' : 1 | |
\ } | |
\ }) | |
function! s:tapped_bundle.hooks.on_source(bundle) | |
endfunction | |
call s:bundle_untap() | |
endif " }}} | |
if s:bundle_tap('vim-submode') " {{{ | |
call s:bundle_config({}) | |
function! s:tapped_bundle.hooks.on_source(bundle) | |
let g:submode_keep_leaving_key = 1 | |
" tab moving | |
call submode#enter_with('changetab', 'n', '', 'gt', 'gt') | |
call submode#enter_with('changetab', 'n', '', 'gT', 'gT') | |
call submode#map('changetab', 'n', '', 't', 'gt') | |
call submode#map('changetab', 'n', '', 'T', 'gT') | |
" undo/redo | |
call submode#enter_with('undo/redo', 'n', '', 'g-', 'g-') | |
call submode#enter_with('undo/redo', 'n', '', 'g+', 'g+') | |
call submode#map('undo/redo', 'n', '', '-', 'g-') | |
call submode#map('undo/redo', 'n', '', '+', 'g+') | |
" TODO: Macro | |
" call submode#enter_with('macro/a', 'n', '', '@a', '@a') | |
" call submode#map('macro/a', 'n', '', 'a', '@a') | |
endfunction | |
call s:bundle_untap() | |
endif " }}} | |
if s:bundle_tap('vim-automatic') " {{{ | |
call s:bundle_config({}) | |
function! s:tapped_bundle.hooks.on_source(bundle) | |
echomsg 'hi automatic' | |
endfunction | |
nnoremap <silent> <Plug>(quit) :<C-u>q<CR> | |
function! s:my_temporary_window_init(config) | |
nmap <buffer> <C-[> <Plug>(quit) | |
endfunction | |
let g:automatic_default_match_config = { | |
\ 'is_open_other_window' : 1 | |
\ } | |
let g:automatic_default_set_config = { | |
\ 'height' : '50%', | |
\ 'move' : 'bottom', | |
\ 'apply' : function('s:my_temporary_window_init') | |
\ } | |
let g:automatic_config = [ | |
\ { 'match' : { 'filetype' : 'unite' } }, | |
\ { 'match' : { 'filetype' : 'vimshell' } }, | |
\ { 'match' : { 'buftype' : 'help' } }, | |
\ { | |
\ 'match' : { | |
\ 'filetype' : '\v^ref-.+', | |
\ 'autocmds' : [ 'FileType' ] | |
\ } | |
\ }, | |
\ { | |
\ 'match' : { | |
\ 'bufname' : '\[quickrun output\]', | |
\ }, | |
\ 'set' : { | |
\ 'height' : 5, | |
\ } | |
\ }, | |
\ { | |
\ 'match' : { | |
\ 'autocmds' : [ 'CmdwinEnter' ] | |
\ }, | |
\ 'set' : { | |
\ 'height' : 5, | |
\ 'is_close_focus_out' : 1, | |
\ 'unsettings' : [ 'move', 'resize' ] | |
\ }, | |
\ } | |
\ ] | |
call s:bundle_untap() | |
endif " }}} | |
if s:bundle_tap('gist-vim') " {{{ | |
call s:bundle_config({ | |
\ 'autoload' : { | |
\ 'commands' : ['Gist'], | |
\ } | |
\ }) | |
function! s:tapped_bundle.hooks.on_source(bundle) | |
let g:gist_clip_command = 'pbcopy' | |
let g:gist_detect_filetype = 1 | |
" let g:gist_open_browser_after_post = 1 | |
" let g:gist_browser_command = 'w3m %URL%' | |
endfunction | |
call s:bundle_untap() | |
endif " }}} | |
if s:bundle_tap('vim-prettyprint') " {{{ | |
call s:bundle_config({ | |
\ 'autoload' : { 'commands' : ['PP'] } | |
\ }) | |
function! s:tapped_bundle.hooks.on_source(bundle) | |
endfunction | |
call s:bundle_untap() | |
endif " }}} | |
if s:bundle_tap('vim-quickrun') " {{{ | |
call s:bundle_config({ | |
\ 'autoload' : { | |
\ 'mappings' : [ '<Plug>(quickrun)' ], | |
\ 'commands' : [ 'QuickRun' ], | |
\ } | |
\ }) | |
function! s:tapped_bundle.hooks.on_source(bundle) | |
endfunction | |
call s:bundle_untap() | |
endif " }}} | |
if s:bundle_tap('vim-textobj-multiblock') " {{{ | |
function! s:tapped_bundle.hooks.on_source(bundle) | |
omap ab <Plug>(textobj-multiblock-a) | |
omap ib <Plug>(textobj-multiblock-i) | |
vmap ab <Plug>(textobj-multiblock-a) | |
vmap ib <Plug>(textobj-multiblock-i) | |
endfunction | |
call s:bundle_untap() | |
endif " }}} | |
if s:bundle_tap('vim-ref') " {{{ | |
call s:bundle_config({ | |
\ 'autoload' : { | |
\ 'commands' : [{ | |
\ 'name' : 'Ref', | |
\ 'complete' : 'customlist,ref#complete' | |
\ }], | |
\ 'unite_sources' : [ 'ref' ] | |
\ } | |
\ }) | |
function! s:tapped_bundle.hooks.on_source(bundle) | |
endfunction | |
let g:ref_open = 'split' | |
let g:ref_refe_cmd = '~/.vim/ref/ruby-refm-1.9.3-dynamic-20120829/refe-1_9_3' | |
aug MyAutoCmd | |
au FileType ruby,eruby,ruby.rspec,haml nnoremap <silent><buffer><C-x><C-r> :<C-u>Unite -no-start-insert ref/refe ref/ri -auto-preview -default-action=below -input=<C-R><C-W><CR> | |
aug END | |
call s:bundle_untap() | |
endif " }}} | |
if s:bundle_tap('vim-ref-ri') " {{{ | |
call s:bundle_config({ | |
\ 'autoload' : { | |
\ 'filetypes' : [ 'ruby', 'haml', 'eruby' ], | |
\ 'unite_sources' : [ 'ref/ri' ] | |
\ }, | |
\ }) | |
function! s:tapped_bundle.hooks.on_source(bundle) | |
endfunction | |
call s:bundle_untap() | |
endif " }}} | |
if s:bundle_tap('vim-endwise') " {{{ | |
call s:bundle_config({ | |
\ 'autoload' : { | |
\ 'filetypes' : [ 'ruby' ] | |
\ } | |
\ }) | |
function! s:tapped_bundle.hooks.on_source(bundle) | |
let g:endwise_no_mappings = 1 | |
if maparg('<Space>','i') =~# '<C-R>=.*crend(.)<Space>\|<\%(Plug\|SNR\|SID\)>.*End' | |
" Already mapped | |
elseif maparg('<Space>','i') =~ '<Space>' | |
exe "imap <script> <C-X><Space> ".maparg('<Space>','i')."<SID>AlwaysEnd" | |
exe "imap <script> <Space> ".maparg('<Space>','i')."<SID>DiscretionaryEnd" | |
elseif maparg('<Space>','i') =~ '<Plug>delimitMateCR' | |
exe "imap <C-X><Space> ".maparg('<Space>', 'i')."<Plug>AlwaysEnd" | |
exe "imap <Space> ".maparg('<Space>', 'i')."<Plug>DiscretionaryEnd" | |
else | |
imap <C-X><Space> <Space><Plug>AlwaysEnd | |
imap <Space> <Space><Plug>DiscretionaryEnd | |
endif | |
endfunction | |
call s:bundle_untap() | |
endif " }}} | |
if s:bundle_tap('vim-ruby') " {{{ | |
call s:bundle_config({ | |
\ 'autoload' : { | |
\ 'mappings' : [ '<Plug>(ref-keyword)' ], | |
\ 'filetypes' : [ 'ruby' ] | |
\ } | |
\ }) | |
function! s:tapped_bundle.hooks.on_source(bundle) | |
endfunction | |
call s:bundle_untap() | |
endif " }}} | |
if s:bundle_tap('vim-rails') " {{{ | |
call s:bundle_config({ | |
\ 'autoload' : { | |
\ 'filetypes' : [ 'ruby', 'haml', 'eruby' ] | |
\ } | |
\ }) | |
function! s:tapped_bundle.hooks.on_source(bundle) | |
endfunction | |
call s:bundle_untap() | |
endif " }}} | |
if s:bundle_tap('alpaca_tags') " {{{ | |
call s:bundle_config({ | |
\ 'autoload' : { | |
\ 'commands' : [ 'AlpacaTagsUpdate', 'AlpacaTagsSet', 'AlpacaTagsBundle' ] | |
\ } | |
\ }) | |
function! s:tapped_bundle.hooks.on_source(bundle) | |
let g:alpaca_update_tags_config = { | |
\ '_' : '-R --sort=yes', | |
\ 'js' : '--languages=+js', | |
\ '-js' : '--languages=-js,JavaScript', | |
\ 'vim' : '--languages=+Vim,vim', | |
\ '-vim' : '--languages=-Vim,vim', | |
\ '-style': '--languages=-css,sass,scss,js,JavaScript,html', | |
\ 'scss' : '--languages=+scss --languages=-css,sass', | |
\ 'sass' : '--languages=+sass --languages=-css,scss', | |
\ 'css' : '--languages=+css', | |
\ 'java' : '--languages=+java $JAVA_HOME/src', | |
\ 'ruby': '--languages=+Ruby', | |
\ 'coffee': '--languages=+coffee', | |
\ '-coffee': '--languages=-coffee', | |
\ 'bundle': '--languages=+Ruby --languages=-css,sass,scss,js,JavaScript,coffee', | |
\ } | |
aug AlpacaUpdateTags | |
au! | |
au FileWritePost,BufWritePost * AlpacaTagsUpdate -style | |
au FileWritePost,BufWritePost Gemfile AlpacaTagsUpdateBundle | |
au FileReadPost,BufEnter * AlpacaTagsSet | |
aug END | |
endfunction | |
call s:bundle_untap() | |
endif " }}} | |
if s:bundle_tap('unite-rails') " {{{ | |
call s:bundle_config({ | |
\ 'autoload' : { | |
\ 'unite_sources' : [ | |
\ 'rails/bundle', 'rails/bundled_gem', 'rails/config', | |
\ 'rails/controller', 'rails/db', 'rails/destroy', 'rails/features', | |
\ 'rails/gem', 'rails/gemfile', 'rails/generate', 'rails/git', 'rails/helper', | |
\ 'rails/heroku', 'rails/initializer', 'rails/javascript', 'rails/lib', 'rails/log', | |
\ 'rails/mailer', 'rails/model', 'rails/rake', 'rails/route', 'rails/schema', 'rails/spec', | |
\ 'rails/stylesheet', 'rails/view' | |
\ ] | |
\ } | |
\ }) | |
function! s:my.unite_rails_init() | |
nnoremap <C-x><C-c>r :<C-u>Unite rails/model rails/controller rails/view rails/db rails/config rails/javascript rails/stylesheet rails/helper rails/mailer<CR> | |
nnoremap <C-x><C-c>m :<C-u>Unite rails/model<CR> | |
nnoremap <C-x><C-c>c :<C-u>Unite rails/controller<CR> | |
nnoremap <C-x><C-c>v :<C-u>Unite rails/view<CR> | |
nnoremap <C-x><C-c>f :<C-u>Unite rails/config<CR> | |
nnoremap <C-x><C-c>j :<C-u>Unite rails/javascript<CR> | |
nnoremap <C-x><C-c>s :<C-u>Unite rails/stylesheet<CR> | |
nnoremap <C-x><C-c>d :<C-u>Unite rails/db<CR> | |
nnoremap <C-x><C-c>l :<C-u>Unite rails/lib<CR> | |
nnoremap <C-x><C-c>h :<C-u>Unite rails/helper<CR> | |
endfunction | |
function! s:tapped_bundle.hooks.on_source(bundle) | |
aug MyAutoCmd | |
au User Rails call g:My.unite_rails_init() | |
aug END | |
endfunction | |
call s:bundle_untap() | |
endif " }}} | |
if s:bundle_tap('vim-airline') " {{{ | |
function! s:tapped_bundle.hooks.on_source(bundle) | |
let g:airline_left_sep=' ' | |
let g:airline_right_sep=' ' | |
let g:airline_detect_iminsert=1 | |
let g:airline_theme='dark' | |
" To show airline status on single window. | |
set laststatus=2 | |
endfunction | |
call s:bundle_untap() | |
endif " }}} | |
" }}} | |
" }}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment