Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
3258 lines (3074 sloc) 133 KB
" vim: set fdm=marker sw=2 sts=2 cms="%s :
"=============================================================================
aug vimrc
au!
aug END
let s:bind = {'win': 'm', 'markj': '`', 'reg': '[@]', 'mode': '<C-q>', 'esc': '<C-o>', 'snip': 's', 'sticky': ':'}
"--------------------------------------
set encoding=utf-8
scriptencoding utf8
"BufRead時、'fileencodings'の先頭から'encoding'を試してerrが出なければそれを適用
set fileencodings=utf8,cp932,iso-2022-jp,euc-jp,default,latin
"改行コードの自動認識(新規作成されるファイルフォーマットをdosにしたい)
set fileformats=dos,unix,mac
"======================================
"環境変数
"$HOME がないとき、$VIM/TMPHOME を $HOME にする "{{{
if !exists("$HOME")
if isdirectory('/hom')
let $HOME='/hom'
else
let $HOME=$VIM. '/TMPHOME'
endif
endif
"}}}
"$PATHを追加{{{
function! s:PATH_add(path)
let $PATH .= $PATH =~ a:path ? '' : a:path. ';'
endfunction
function! s:PATH_insert(path)
let $PATH = $PATH =~ a:path ? $PATH : a:path. ';'. $PATH
endfunction
if has('vim_starting')
let $PATH .= ';'
call s:PATH_add('/bnr/cmd/MinGW/bin')
call s:PATH_add('/bnr/cmd/path')
call s:PATH_add('/bnr/cmd/PortableGit-1.7.11-preview20120620/bin')
call s:PATH_add('C:/Program Files/Java/jdk1.7.0_09/bin')
let $GOROOT = '/bnr/cmd/go'
call s:PATH_add($GOROOT.'/bin')
let $GOPATH = $HOME. '/_go'
call s:PATH_add($GOPATH.'/bin')
call s:PATH_add('/bnr/cmd/MercurialCmdPortable/App/Mercurial')
call s:PATH_insert(expand('~/Dropbox/vimfiles/neobundle/vim-themis/bin'))
call s:PATH_insert('/bnr/txe/vim')
endif
"}}}
let $JVGREP_OUTPUT_ENCODING = 'cp932'
let $TERM = exists('$TERM') ? $TERM : 'msys'
let $DOTFILES = $HOME. '/Dropbox/dotfiles'
"--------------------------------------
"vim関係のpath
let $BASEDIR = exists('$BASEDIR') ? $BASEDIR : expand($HOME . '/Dropbox')
let $MYVIMRC_SUBSTANCEDIR = $BASEDIR. '/dotfiles/vim'
let $VIMCACHE = $HOME. '/.cache/vim'
let $VIMUSERDIR = $BASEDIR. '/.config/vim'
if has('vim_starting')
let $VIMFILES = isdirectory(expand('$BASEDIR/vimfiles')) ? $BASEDIR. '/vimfiles' : isdirectory(expand('$HOME/vimfiles')) ? $HOME. '/vimfiles' : $VIM. '/vimfiles'
set rtp+=$VIMFILES,$VIMFILES/after,$VIMFILES/neobundle/neobundle.vim
endif
"=============================================================================
"if !s:iswin
"set shell=zsh
"else
"set shell=bash
"endif
"vimfiler
let g:vimfiler_tree_leaf_icon = ''
let g:vimfiler_tree_opened_icon = ''
let g:vimfiler_tree_closed_icon = ''
let g:vimfiler_file_icon = '...'
let g:vimfiler_marked_file_icon = ''
let g:vimfiler_readonly_file_icon = ''
let g:vimfiler_time_format = '%d-%m-%Y %H:%M:%S'
let g:backdraft_buffer_func = {'enterdraft': 'BackdraftEnterDraft'}
function! BackdraftEnterDraft() "{{{
nmap <buffer><expr><C-p> yankround#is_active() ? "\<Plug>(yankround-prev)" : "\<Plug>(backdraft_cycle_dec)"
nmap <buffer><expr><C-n> yankround#is_active() ? "\<Plug>(yankround-next)" : "\<Plug>(backdraft_cycle_inc)"
endfunction
"}}}
nnoremap ,sk :<C-u>AltiTask<CR>
"=============================================================================
"Neobundle_vim:
call neobundle#begin(expand('$VIMFILES/neobundle'))
let g:MYBUNDLE = expand('$VIMFILES/mybundle')
NeoBundleLocal $VIMFILES/bundle/
NeoBundle 'Shougo/neobundle.vim'
"--------------------------------------
"NeoBundle 'haya14busa/incsearch.vim'
"NeoBundle 'osyo-manga/vital-over'
"NeoBundle 'osyo-manga/vim-over'
"NeoBundle 'kamichidu/vim-milqi'
"NeoBundle 'kamichidu/vim-regexp-assemble'
"NeoBundle 'bitbucket:ns9tks/vim-fuzzyfinder'
"NeoBundle 'bitbucket:ns9tks/vim-l9'
"NeoBundle 'bitbucket:ns9tks/vim-autocomplpop'
"NeoBundle 'kana/vim-ku'
"Library:
NeoBundleLazy 'Shougo/vimproc'
NeoBundle 'vim-jp/vital.vim', {'autoload': {'commands': 'Vitalize'},}
NeoBundle 'LeafCage/oreo.vim', {'stay_same': 1, 'base': g:MYBUNDLE}
NeoBundle 'LeafCage/lim.vim', {'stay_same': 1, 'base': g:MYBUNDLE}
NeoBundleLazy 'tomtom/tlib_vim'
NeoBundleLazy 'thinca/vim-openbuf'
NeoBundleLazy 'mattn/wwwrenderer-vim' "webpage(only text)を返す
NeoBundleLazy 'mattn/webapi-vim'
NeoBundleLazy 'osyo-manga/vim-gift'
NeoBundle 'rbtnn/rabbit-ui.vim'
NeoBundleLazy 'rbtnn/rabbit-ui-collection.vim', {'autoload': {'commands': [{'complete': 'file', 'name': 'RabbitUICollectionEditCSV'}, 'RabbitUICollectionChoiceMark', 'RabbitUICollectionChoiceBookmark', 'RabbitUICollectionChoiceBuffer']}}
"--------------------------------------
"Synthesis:
NeoBundleLazy 'Shougo/unite.vim'
NeoBundleLazy 'ctrlpvim/ctrlp.vim',
NeoBundle 'LeafCage/alti.vim', {'stay_same': 1, 'base': g:MYBUNDLE}
NeoBundleLazy 'Shougo/vimshell'
NeoBundleLazy 'Shougo/vimfiler'
NeoBundleLazy 'LeafCage/flashcards.vim', {'autoload': {'unite_sources': ['flashcards'], 'commands': [{'complete': 'customlist,flashcards#comp_decks', 'name': 'FlashcardsBegin'}, {'complete': 'customlist,flashcards#comp_decks', 'name': 'FlashcardsEdit'}, 'FlashcardsContinue']}, 'stay_same': 1, 'base': g:MYBUNDLE}
"--------------------------------------
"Network_and_Documents:
NeoBundleLazy 'tyru/open-browser.vim', {'autoload': {'mappings': [['sxn', '<Plug>(openbrowser-']], 'commands': [{'complete': 'customlist,openbrowser#_cmd_complete', 'name': 'OpenBrowserSearch'}, {'complete': 'customlist,openbrowser#_cmd_complete', 'name': 'OpenBrowserSmartSearch'}, 'OpenBrowser']}}
NeoBundleLazy 'thinca/vim-ref'
NeoBundleLazy 'basyura/J6uil.vim', {'depends': 'mattn/webapi-vim'}
NeoBundleLazy 'LeafCage/ref-javadoc', {'depends': 'thinca/vim-ref', 'stay_same': 1, 'base': g:MYBUNDLE}
"NeoBundle 'vim-jp/vimdoc-ja'
"--------------------------------------
"Development:
NeoBundleLazy 'tpope/vim-fugitive'
NeoBundleLazy 'thinca/vim-quickrun', {'autoload': {'commands': 'QuickRun', 'mappings': ['<Plug>(quickrun']}, 'depends': 'Shougo/vimproc'}
NeoBundleLazy 'kannokanno/vimtest'
NeoBundle 'thinca/vim-themis'
NeoBundle 'Kuniwak/vint'
NeoBundleLazy 'kannokanno/vmock'
NeoBundleLazy 'LeafCage/laptime.vim', {'stay_same': 1, 'base': g:MYBUNDLE}
NeoBundleLazy 'LeafCage/vimhelpgenerator', {'stay_same': 1, 'base': g:MYBUNDLE}
NeoBundleLazy 'rhysd/conflict-marker.vim', {'autoload': {'unite_sources': ['conflict'], 'mappings': [['n', '<Plug>(conflict-marker-']], 'commands': ['ConflictMarkerBoth', 'ConflictMarkerThemselves', 'ConflictMarkerOurselves', 'ConflictMarkerNextHunk', 'ConflictMarkerPrevHunk', 'ConflictMarkerNone']}}
NeoBundleLazy 'gregsexton/gitv', {'autoload': {'commands': ['Gitv']}}
NeoBundleLazy 'cocoa.vim' "Objective-C
NeoBundleLazy 'javacomplete'
NeoBundleLazy 'Javascript-OmniCompletion-with-YUI-and-j'
NeoBundle 'thinca/vim-scall'
NeoBundle 'elzr/vim-json'
"NeoBundle 'mikelue/vim-maven-plugin' "Apache Maven project
"NeoBundle 'groovy.vim'
"NeoBundle 'derekwyatt/vim-scala'
"--------------------------------------
"Insert:
"NeoBundle 'kana/vim-smartchr'
"NeoBundleLazy 'cohama/lexima.vim', {'autoload': {'insert': 1}}
if has('lua')
NeoBundleLazy 'Shougo/neocomplete.vim', {'autoload': {'insert': 1}}
else
NeoBundleLazy 'Shougo/neocomplcache', {'autoload': {'insert': 1}}
end
NeoBundleLazy 'Shougo/neosnippet'
NeoBundle 'Shougo/neosnippet-snippets'
NeoBundleLazy 'mattn/emmet-vim', {'autoload': {'insert': 1, 'commands': ['Emmet', 'EmmetInstall']}}
NeoBundleLazy 'tpope/vim-abolish', {'autoload': {'mappings': [['n', '<Plug>Coerce']], 'commands': [{'complete': 'custom,LoadAbolish', 'name': 'S'}, {'complete': 'custom,LoadAbolish', 'name': 'Abolish'}, {'complete': 'custom,LoadAbolish', 'name': 'Subvert'}]}}
NeoBundleLazy 'scrooloose/nerdcommenter', {'autoload': {'mappings': [['inx', '<Plug>NERDCommenter']]}}
NeoBundle 'LeafCage/yankround.vim', {'stay_same': 1, 'base': g:MYBUNDLE}
NeoBundleLazy 'LeafCage/nebula.vim', {'autoload': {'commands': ['NebulaPutLazy', 'NebulaPutFromClipboard', 'NebulaYankOptions', 'NebulaYankConfig', 'NebulaPutConfig', 'NebulaYankTap']}, 'stay_same': 1, 'base': g:MYBUNDLE}
NeoBundleLazy 'terryma/vim-expand-region', {'autoload': {'mappings': [['sxn', '<Plug>(expand_region_']]}}
NeoBundleLazy 'kana/vim-operator-user'
NeoBundleLazy 'kana/vim-operator-replace' "レジスタにあるものとoperator指定したものを置き換え
NeoBundleLazy 'kana/vim-textobj-user'
NeoBundleLazy 'h1mesuke/textobj-wiw', {'depends': 'kana/vim-textobj-user', 'autoload': {'mappings': ['<Plug>(textobj-wiw']}} "カーソルドのwordを選択する/ CamelCaseMotionの働きも?
NeoBundleLazy 'kana/vim-textobj-function'
NeoBundleLazy 'kana/vim-textobj-indent', {'depends': 'kana/vim-textobj-user','autoload': {'mappings': ['<Plug>(textobj-indent']}}
NeoBundleLazy 'thinca/vim-textobj-between'
NeoBundleLazy 'thinca/vim-textobj-comment'
NeoBundleLazy 'anyakichi/vim-textobj-xbrackets'
NeoBundleLazy 'sgur/vim-textobj-parameter', {'depends': 'kana/vim-textobj-user', 'autoload': {'mappings': ['<Plug>(textobj-parameter']}}
NeoBundleLazy 'osyo-manga/vim-textobj-multiblock'
NeoBundleLazy 'deris/vim-rengbang', {'autoload': {'mappings': [['nx', '<Plug>(operator-rengbang']], 'commands': ['RengBang', 'RengBangUsePrev']}}
NeoBundleLazy 'anyakichi/vim-surround'
NeoBundleLazy 'supermomonga/unite-sudden-death', {'autoload': {'unite_sources': ['suddendeath']}}
NeoBundleLazy 'LeafCage/unite-recording', {'stay_same': 1, 'base': g:MYBUNDLE}
NeoBundleLazy 'mattn/ctrlp-mark', {'autoload': {'commands': ['CtrlPMark']}, 'depends': 'kien/ctrlp.vim'}
"--------------------------------------
"Moving:
NeoBundleLazy 'kana/vim-smartword', {'autoload': {'mappings': ['<Plug>(smartword-']}}
NeoBundle 'deton/jasegment.vim' "WBEを日本語文節区切り移動に
NeoBundleLazy 'Lokaltog/vim-easymotion', {'autoload': {'mappings': [['sxno', '<Plug>(easymotion-']], 'commands': ['EMCommandLineNoreMap', 'EMCommandLineMap', 'EMCommandLineUnMap']}}
NeoBundleLazy 'bkad/CamelCaseMotion', {'autoload': {'mappings': ['<Plug>CamelCaseMotion_']}}
NeoBundleLazy 'yonchu/accelerated-smooth-scroll', {'autoload': {'mappings': [['xn', '<Plug>(ac-smooth-scroll-c-']]}}
"NeoBundleLazy 'rhysd/clever-f.vim', {'autoload': {'mappings': [['sxno', '<Plug>(clever-f-']]}}
NeoBundleLazy 'thinca/vim-poslist', {'autoload': {'mappings': ['<Plug>(poslist-']}}
NeoBundleLazy 'thinca/vim-visualstar', {'autoload': {'mappings': ['<Plug>(visualstar-']}}
NeoBundle 'haya14busa/vim-asterisk'
NeoBundleLazy 'https://github.com/vim-scripts/DrawIt.git' "図を描写する #Bible5-4
NeoBundleLazy 'https://github.com/vim-scripts/Align.git' "高機能なテキストファイル整形ツール #Bible5-11
NeoBundleLazy 'https://github.com/tpope/vim-speeddating.git'
"--------------------------------------
"Writing:
"NeoBundle 'mrtazz/simplenote.vim' "オンラインノートsimplenoteを使う
"NeoBundle 'tomtom/ttoc_vim', {'depends': 'tomtom/tlib_vim'} "アウトライナ
"NeoBundle 'vim-scripts/vimwiki'
"NeoBundle 'https://github.com/fuenor/qfixhowm.git'
NeoBundleLazy 'thinca/vim-showtime', {'autoload': {'commands': [{'complete': 'file', 'name': 'ShowtimeStart'}]}}
"--------------------------------------
"Buffer_and_Win_and_Tabpage_and_Jump:
NeoBundleLazy 't9md/vim-choosewin', {'autoload': {'mappings': [['n', '<Plug>(choosewin)']], 'commands': ['ChooseWin']}}
NeoBundleLazy 'itchyny/thumbnail.vim', {'autoload': {'commands': [{'complete': 'customlist,thumbnail#complete', 'name': 'Thumbnail'}]}}
"NeoBundle 'kana/vim-tabpagecd' "TabPage毎にcrrdirを持てるようにする
"NeoBundle 'Rykka/lastbuf.vim'
"NeoBundleLazy 'osyo-manga/vim-reanimate', {'autoload': {'commands': ['ReanimateSave', 'ReanimateLoad', 'ReanimateSaveInput', 'ReanimateLoadInput', 'ReanimateLoadLatest', 'ReanimateSaveCursorHold', 'ReanimateSwitch', 'ReanimateEditVimrcLocal', 'ReanimateUnload']}}
NeoBundleLazy 'kana/vim-altr', {'autoload': {'mappings': [['scxino', '<Plug>(altr-']]}} "現在バッファから開くファイルを類推して開く
NeoBundleLazy 'kana/vim-gf-user', {'autoload': {'mappings': [['nv', '<Plug>(gf-user-']]}}
NeoBundleLazy 'sgur/vim-gf-autoload'
"NeoBundle 'osyo-manga/vim-automatic', {'depends': 'osyo-manga/vim-gift', 'vim_version': '7.3.895'}
"--------------------------------------
"Bind_and_Command:
"NeoBundleLazy 'kana/vim-arpeggio'
NeoBundleLazy 'kana/vim-submode', {'autoload': {'commands': ['SubmodeRestoreOptions']}}
NeoBundleLazy 't9md/vim-mapswap', {'autoload': {'mappings': [['n', '<Plug>(mapswap-dump)']], 'commands': ['Mapswap']}}
NeoBundleLazy 'thinca/vim-ambicmd' "コマンド名省入力 ex)NeoBundleUpdate > NBU
NeoBundle 'tyru/vim-altercmd' "コマンドのエイリアスを作る tyru版あり #B9-6
NeoBundleLazy 'LeafCage/cmdlineplus.vim', {'autoload': {'mappings': [['c', '<Plug>(cmdlineplus-']]}, 'stay_same': 1, 'base': g:MYBUNDLE}
"--------------------------------------
"Info:
NeoBundleLazy 'itchyny/calendar.vim', {'autoload': {'commands': [{'complete': 'customlist,calendar#argument#complete', 'name': 'Calendar'}]}}
NeoBundleLazy 'AndrewRadev/linediff.vim', {'autoload': {'commands': ['LinediffReset', 'Linediff']}}
NeoBundleLazy 'mbbill/undotree', {'autoload': {'commands': ['UndotreeToggle']}}
NeoBundle 'LeafCage/foldCC.vim', {'stay_same': 1, 'base': g:MYBUNDLE}
NeoBundle 'LeafCage/visiblemarks.vim', {'stay_same': 1, 'base': g:MYBUNDLE}
NeoBundle 'LeafCage/echos.vim', {'autoload': {'commands': [{'complete': 'expression', 'name': 'Echos'}]}, 'stay_same': 1, 'base': g:MYBUNDLE}
NeoBundle 'tyru/current-func-info.vim'
NeoBundleLazy 'sgur/vim-gitgutter', {'autoload': {'mappings': [['n', '<Plug>GitGutter']], 'commands': ['GitGutterAll', 'GitGutterToggle', 'GitGutterPrevHunk', 'GitGutterDisable', 'GitGutterLineHighlightsEnable', 'GitGutterNextHunk', 'GitGutterEnable', 'GitGutter', 'GitGutterLineHighlightsToggle', 'GitGutterLineHighlightsDisable']}}
"NeoBundle 'LeafCage/win-shujuukankei.vim'
NeoBundleLazy 'LeafCage/lastmess.vim', {'autoload': {'mappings': [['n', '<Plug>(lastmess']], 'commands': ['LastMess']}, 'type': 'nosync', 'base': g:MYBUNDLE}
NeoBundleLazy 'osyo-manga/vim-anzu'
NeoBundleLazy 'tacroe/unite-mark', {'autoload': {'unite_sources': ['mark']}}
NeoBundleLazy 'tsukkee/unite-tag', {'autoload': {'unite_sources' : ['tag']}}
NeoBundleLazy 'tsukkee/unite-help', {'autoload': {'unite_sources' : ['help']}}
NeoBundleLazy 'https://github.com/ujihisa/neco-look.git' "要look.exe
"NeoBundleLazy 'h1mesuke/unite-outline', {'autoload': {'unite_sources' : 'outline'}}
NeoBundleLazy 'thinca/vim-prettyprint', {'autoload' : {'commands': 'PP' }}
NeoBundleLazy 'taglist.vim' "ctagsを利用して :Tlistで変数関数定義一覧バッファ作成
NeoBundleLazy 'TagHighlight' "ctagsの情報を利用してハイライト
"NeoBundle 'errormarker.vim'
NeoBundleLazy 'jceb/vim-hier' "quickfixエラー箇所をハイライト
"NeoBundle 'ujihisa/unite-font' "動かない
NeoBundleLazy 'ujihisa/unite-colorscheme', {'autoload': {'unite_sources': ['colorscheme']}}
NeoBundleLazy 'pasela/unite-webcolorname', {'autoload': {'unite_sources' : 'webcolorname'}}
NeoBundleLazy 'LeafCage/unite-gvimrgb', {'autoload': {'unite_sources': ['gvimrgb']}, 'stay_same': 1, 'base': g:MYBUNDLE}
NeoBundleLazy 'osyo-manga/unite-highlight', {'autoload': {'unite_sources': ['highlight']}}
NeoBundleLazy 'cocopon/colorswatch.vim', {'autoload': {'commands': ['ColorSwatchGenerate']}}
NeoBundle 'LeafCage/taillight.vim', {'stay_same': 1, 'base': g:MYBUNDLE}
"--------------------------------------
"GUI:
NeoBundleLazy 'daisuzu/rainbowcyclone.vim', {'augroup': 'RainbowCyclone', 'autoload': {'mappings': [['n', '<Plug>(rc_']], 'commands': ['RCList', 'RCReset', 'RCConcat', 'RC']}}
NeoBundle 'itchyny/lightline.vim'
"NeoBundle 't9md/vim-ezbar'
"NeoBundle 'kien/rainbow_parentheses.vim'
"NeoBundle 'altercation/vim-colors-solarized' "なんか良いらしいcolorscheme
NeoBundleLazy 'tyru/winmove.vim', {'autoload': {'mappings': ['<Plug>(winmove-']}, 'gui':1}
NeoBundleLazy 'thinca/vim-fontzoom', {'autoload': {'mappings': ['<Plug>(fontzoom-'], 'commands': 'Fontzoom'}}
"--------------------------------------
"Maintenance:
"NeoBundle 'thinca/vim-localrc' "特定dir以下に.lvimrcを置くとdir以下のfileだけで設定反映
NeoBundle 'savevers.vim'
"--------------------------------------
"Helper:
NeoBundle 'ynkdir/vim-diff'
"NeoBundle 'fuenor/qfixgrep'
"--------------------------------------
call neobundle#end()
"=============================================================================
"各種プラグイン設定
"======================================
"Library:
let g:uptodate_filenamepatterns = ['lily.vim', 'lib/vimelements.vim']
let g:uptodate_cellardir = $VIMFILES. '/bundle/LCLIB'
autocmd vimrc FuncUndefined lib#* let _ = g:uptodate_cellardir. '/'. fnamemodify(expand('<afile>'), ':gs?#?/?:h'). '.vim' |if filereadable(_) |exe 'source ' _ | endif | unlet _
if neobundle#tap('vimproc') "{{{
call neobundle#config({'build': {'windows': 'make -f make_mingw32.mak', 'cygwin': 'make -f make_cygwin.mak', 'mac': 'make -f make_mac.mak', 'unix': 'make -f make_unix.mak',},
\ 'autoload': {'commands': [{'complete': 'shellcmd', 'name': 'VimProcBang'}, {'complete': 'shellcmd', 'name': 'VimProcRead'}]}})
endif
"}}}
"--------------------------------------
if neobundle#tap('oreo.vim') "{{{
let g:oreo#config_dir = '~/Dropbox/.config/vim/oreo.vim'
let g:oreo#libs = {}
let g:oreo#libs.lim = 'D:/hom/Dropbox/vimfiles/mybundle/lim.vim'
let g:oreo#libs.limalfa = 'oppai'
let g:oreo#libs['rabbit_ui'] = 'D:/hom/Dropbox/vimfiles/neobundle/rabbit-ui.vim'
endif
"}}}
"======================================
"Synthesis:
if neobundle#tap('unite.vim') "{{{
call neobundle#config({'autoload': {'commands': [{'name': 'Unite', 'complete': 'customlist,unite#complete_source'},
\ 'UniteWithCursorWord', 'UniteWithInput']}})
function! neobundle#tapped.hooks.on_source(bundle)
let g:unite_data_directory = $VIMCACHE. '/.unite'
let g:unite_cursor_line_highlight = 'Pmenu'
let g:unite_split_rule = 'botright' "窓の表示位置
let g:unite_winheight = 20 "水平分割時の窓高さ
let g:unite_enable_start_insert = 0
let g:unite_source_grep_command = 'jvgrep' "grepコマンド
let g:unite_source_grep_recursive_opt = '-R'
let g:unite_source_grep_default_opts = '-n --enc utf-8,utf-8,euc-jp'
"let g:unite_source_grep_recursive_opt = '-R'
"let g:unite_source_grep_default_opts = '-Hn'
"let g:unite_source_find_command = 'find'
"let g:unite_source_history_yank_enable = 1 "unite-history/yankを有効化する(ヤンクしたテキストの履歴)
let g:unite_kind_jump_list_after_jump_scroll=0
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
"actionではinsert-modeで始める
call unite#set_profile('action', 'context', {'start_insert' : 1})
" デフォルトのコンテキストを -prompt-direction=top にする
call unite#custom#profile('default', 'context', { 'prompt_direction': 'top'})
source $MYVIMRC_SUBSTANCEDIR/unite_setting.vim
endfunction
cnoreabb <expr>line getcmdtype()==':' && getcmdline()=~'^\s*Unite ' && getcmdline()!~'-start-insert' ?
\ '-start-insert -no-quit -buffer-name=search line' : 'line'
let g:loaded_unite_source_mru = 1 "mruを無効にする
autocmd vimrc FileType unite wincmd =
autocmd vimrc BufLeave [\[\*]unite[\]\*] wincmd =
"やたら長い変数をechoするとき見やすく表示
command! -complete=var -nargs=+ UPP exe 'Unite output:PP\ '. escape(<q-args>, ': ')
command! -nargs=+ -complete=customlist,unite#complete#source UniteMS bot sp| Unite -no-split <args>
nnoremap [space]u :<C-u>Unite<Space>
cnoreabb <expr>u getcmdtype()==':' && getcmdline()==' u' ? 'Unite' : 'u'
"文字関係
nnoremap ,dg :<C-u>Unite -buffer-name=register register<CR>
"nnoremap ,dy :<C-u>Unite history/yank<CR>
"xnoremap ,dy d:<C-u>Unite history/yank<CR>
"inoremap <expr><C-y> pumvisible() ? "\<C-y>" : "\<Esc>:Unite -start-insert history/yank\<CR>"
"file/buf関係
nnoremap ,dfl :<C-u>UniteWithBufferDir -buffer-name=files file<CR>
nnoremap ,dff :<C-u>Unite -buffer-name=files file<CR>
nnoremap ,dfr :<C-u>Unite -buffer-name=files -start-insert file_rec:<C-r>=escape(expand('%:p:h:h'), ': ')<CR><CR>
nnoremap ,dfs :<C-u>UniteWithBufferDir -buffer-name=files -start-insert buffer file_mru bookmark file<CR>
nnoremap ,fs :<C-u>UniteWithBufferDir -buffer-name=files -start-insert buffer file_mru bookmark file<CR>
nnoremap ,dfm :<C-u>Unite -buffer-name=files -start-insert file_mru<CR>
nnoremap ,fm :<C-u>Unite -buffer-name=files -start-insert file_mru<CR>
nnoremap ,dp :<C-u>Unite -buffer-name=files -start-insert buffer<CR>
nnoremap mp :<C-u>Unite -buffer-name=files -start-insert buffer<CR>
nnoremap ,dv :<C-u>Unite -buffer-name=files buffer_tab<CR>
nnoremap ,fv :<C-u>Unite -buffer-name=files buffer_tab<CR>
nnoremap ,da :<C-u>UniteBookmarkAdd<CR>
nnoremap ,db :<C-u>Unite bookmark<CR>
"nnoremap ,du :<C-u>Unite buffer_deleted<CR>
"場所関係
nnoremap ,dl :<C-u>Unite line -start-insert<CR>
nnoremap ,djc :<C-u>Unite change<CR>
nnoremap ,djj :<C-u>Unite jump<CR>
nnoremap ,dmm :<C-u>Unite mark<CR>
"let g:unite_source_mark_marks = '`mlkjih".^MLKJIHabcdefgnopqrstuvwxyzABCDEFGNOPQRSTUVWXYZ012'
let g:unite_source_mark_marks = '`abcdefghijkl".^ABCDEFGHIJKLmnopqrstuvwxyzMNOPQRSTUVWXYZ012'
nnoremap ,di :<C-u>Unite outline_indent<CR>
nnoremap ,dia :<C-u>Unite outline_indent:a<CR>
"autocmd BufEnter *
\ if empty(&buftype)
\| nnoremap <buffer> <C-]> :<C-u>UniteWithCursorWord -immediately tag<CR>
\| endif
"vim関係
nnoremap ,dmp :<C-u>Unite mapping<CR>
nnoremap ,dms :<C-u>Unite output:mes<CR>
nnoremap ,dme :<C-u>Unite output:mes<CR>
"GUI/CUI関係
nnoremap ,dxf :<C-u>Unite font<CR>
nnoremap ,dxw :<C-u>Unite webcolorname<CR>
"unite関係
nnoremap ,du :UniteResume<CR>
nnoremap ,ds :<C-u>Unite source<CR>
nnoremap ,d@ :<C-u>Unite menu:main<CR>
nnoremap ,d:m :<C-u>Unite menu:main<CR>
nnoremap ,d:g :<C-u>Unite menu:git<CR>
endif
"}}}
"--------------------------------------
if neobundle#tap('ctrlp.vim') "{{{
call neobundle#config({'autoload': {'commands': ['CtrlP', 'CtrlPBuffer', 'CtrlPMRU', 'CtrlPLastMode', 'CtrlPRoot', 'CtrlPClearCache', 'CtrlPClearAllCaches']}})
function! neobundle#tapped.hooks.on_source(bundle)
let g:ctrlp_prompt_mappings = {}
let g:ctrlp_prompt_mappings['PrtBS()'] = ['<BS>', '<C-h>']
let g:ctrlp_prompt_mappings['PrtSelectMove("j")'] = ['<C-n>']
let g:ctrlp_prompt_mappings['PrtSelectMove("k")'] = ['<C-p>']
let g:ctrlp_prompt_mappings['PrtHistory(-1)'] = ['<C-j>']
let g:ctrlp_prompt_mappings['PrtHistory(1)'] = ['<C-l>']
let g:ctrlp_prompt_mappings['PrtCurLeft()'] = ['<Left>', '<C-b>', '<C-k>']
let g:ctrlp_prompt_mappings['PrtCurRight()'] = ['<Right>', '<C-f>']
let g:ctrlp_prompt_mappings['PrtExit()'] = ['<Esc>', '<C-c>', '<C-q>']
let g:ctrlp_prompt_mappings['ToggleType(1)'] = ['<C-]>', '<C-up>']
let g:ctrlp_prompt_mappings['ToggleType(-1)'] = ['<C-\>', '<C-down>']
let g:ctrlp_prompt_mappings['PrtInsert()'] = ['<C-^>']
let g:ctrlp_prompt_mappings['PrtInsert("r")'] = ['<S-Left>']
endfunction
nnoremap <silent>[space]<C-p> :<C-u>CtrlP<CR>
nnoremap <silent><M-p> :<C-u>CtrlP<CR>
nnoremap <silent><M-b> :<C-u>CtrlPBuffer<CR>
nnoremap <silent>,b<C-p> :<C-u>CtrlPBuffer<CR>
nnoremap <silent>m<C-p> :<C-u>CtrlPMRU<CR>
nnoremap <silent><M-m> :<C-u>CtrlPMRU<CR>
nnoremap <silent>z<C-p> :<C-u>CtrlP D:/hom/Dropbox/ref<CR>
let g:ctrlp_smallreg_dir = $VIMCACHE. '/ctrlp/smallreg'
nnoremap <silent>g<C-p> :<C-u>CtrlPMark<CR>
"nnoremap <silent>[C-k]<C-p> :<C-u>CtrlPBuffer<CR>
"nnoremap <silent>[C-k]<C-h> :<C-u>CtrlPMRU<CR>
"autocmd vimrc CursorMoved ControlP let w:lightline = 0
let g:ctrlp_buffer_func = {'enter': 'CtrlPEnter'}
function! CtrlPEnter()
let w:lightline = 0
endfunction
let g:ctrlp_cache_dir = $VIMCACHE. '/ctrlp'
let g:ctrlp_max_files = 50
let g:ctrlp_use_migemo = 1
let g:ctrlp_show_hidden = 1
let g:ctrlp_switch_buffer = ''
let g:ctrlp_reuse_window = 'netrw\|help\|quickfix\|vimfiler\|unite\|vimshell'
let g:ctrlp_root_markers = ['[root]']
let g:ctrlp_open_new_file = 'h'
let g:ctrlp_working_path_mode = 'rc'
"let g:ctrlp_key_loop = 1
let g:ctrlp_mruf_exclude = '' "mruに追跡したくないfile
endif
"}}}
"--------------------------------------
if neobundle#tap('alti.vim') "{{{
function! neobundle#tapped.hooks.on_source(bundle)
let g:alti_prompt_mappings = {}
let g:alti_prompt_mappings['PrtCurLeft()'] = ['<Left>', '<C-k>']
let g:alti_prompt_mappings['PrtPage(1)'] = ['<C-l>', '<PageDown>', '<kPageDown>']
let g:alti_prompt_mappings['PrtPage(-1)'] = ['<C-o>', '<PageUp>', '<kPageUp>']
let g:alti_prompt_mappings['PrtExit()'] = ['<Esc>', '<C-c>', '<C-q>']
let g:alti_getreg_mappings = {}
let g:alti_getreg_mappings['"'] = ['<C-e>']
let g:alti_getreg_mappings['*'] = ['<C-y>']
endfunction
let g:alti_cache_dir = $VIMCACHE. '/alti'
"let g:alti_max_files = 1000
"let g:alti_use_migemo = 1
"let g:alti_show_hidden = 1
"let g:alti_switch_buffer = 'Et'
"let g:alti_reuse_window = 'netrw\|help\|quickfix\|vimfiler\|unite\|vimshell'
"let g:alti_root_markers = ['[root]']
"let g:alti_open_new_file = 'h'
endif
"}}}
"--------------------------------------
if neobundle#tap('vimshell') "{{{
call neobundle#config({'autoload': {'commands': [{'name': 'VimShell', 'complete': 'customlist,vimshell#complete'},
\ 'VimShellExecute', 'VimShellInteractive', 'VimShellTerminal', 'VimShellPop', 'VimShellTab'],
\ 'mappings': ['<Plug>(vimshell_']}})
function! neobundle#tapped.hooks.on_source(bundle)
let g:vimshell_temporary_directory = $VIMCACHE. '/.vimshell'
let g:vimshell_vimshrc_path = $VIMUSERDIR. '/.vimshrc'
let g:vimshell_split_command = '8split'
let g:vimshell_user_prompt = 'fnamemodify(getcwd(), ":~")' "ユーザプロンプトにカレントディレクトリを表示
let g:vimshell_split_height = 50
let g:vimshell_enable_smart_case = 1
if has('win32') || has('win64')
" Display user name on Windows.
let g:vimshell_prompt = $USERNAME."% "
else
" Display user name on Linux.
let g:vimshell_prompt = $USER."% "
call vimshell#set_execute_file('bmp,jpg,png,gif', 'gexe eog')
call vimshell#set_execute_file('mp3,m4a,ogg', 'gexe amarok')
let g:vimshell_execute_file_list['zip'] = 'zipinfo'
call vimshell#set_execute_file('tgz,gz', 'gzcat')
call vimshell#set_execute_file('tbz,bz2', 'bzcat')
endif
au FileType vimshell setl nobl
au FileType vimshell nnoremap <silent><buffer> q <C-w>c
au FileType vimshell nmap <silent><buffer><C-x>c <Plug>(vimshell_interrupt)
au FileType vimshell nnoremap ,db :<C-u>Unite -default-action=cd bookmark<CR>
au FileType vimshell nnoremap ,dd :<C-u>Unite -default-action=cd directory_mru<CR>
autocmd FileType vimshell
\ call vimshell#altercmd#define('g', 'git')
\| call vimshell#altercmd#define('i', 'iexe')
\| call vimshell#altercmd#define('l', 'll')
\| call vimshell#altercmd#define('ll', 'ls -l')
\| call vimshell#hook#add('chpwd', 'my_chpwd', 'My_chpwd')
function! My_chpwd(args, context)
call vimshell#execute('ls')
endfunction
endfunction
noremap <silent>,xs :let A = expand('%:p:h')<Bar> exe 'VimShellTab '. A<Bar>unlet A<CR>
noremap <silent>,sh :let A = expand('%:p:h')<Bar> exe 'VimShell -split '. A<Bar>unlet A<CR>
endif
"}}}
"--------------------------------------
if neobundle#tap('vimfiler') "{{{
call neobundle#config({'depends': ['Shougo/unite.vim',], 'autoload': {'commands':
\ [{'name': 'VimFiler', 'complete': 'customlist,vimfiler#complete'},
\ {'name': 'VimFilerExplorer', 'complete': 'customlist,vimfiler#complete'},
\ {'name': 'Edit', 'complete': 'customlist,vimfiler#complete'},
\ {'name': 'Write', 'complete': 'customlist,vimfiler#complete' }, 'Read', 'Source'],
\ 'mappings': ['<Plug>(vimfiler_'], 'explorer': 1,}})
let g:vimfiler_data_directory = $VIMCACHE. '/.vimfiler'
let g:vimfiler_as_default_explorer = 1
let g:unite_kind_file_use_trashbox = 1
let g:vimfiler_safe_mode_by_default = 0
"let g:vimfiler_split_rule = 'belowright'
"let g:vimfiler_detect_drives
"拡張子関連付け
"call vimfiler#set_execute_file('vim', 'vim')
"シンタックス
"let g:vimfiler_extensions = {'text': '', 'image': '', 'archive': '', 'system': '', 'multimedia': '',}
function! neobundle#tapped.hooks.on_source(bundle)
au FileType vimfiler let b:vimfiler.is_visible_dot_files = 1| setl nobl nonu| autocmd BufLeave <buffer> setl nobl
"vf basic-Keymaps "{{{
let g:vimfiler_no_default_key_mappings = 1
au FileType vimfiler nmap <buffer> j <Plug>(vimfiler_loop_cursor_down)
au FileType vimfiler nmap <buffer> k <Plug>(vimfiler_loop_cursor_up)
au FileType vimfiler nmap <buffer> gg <Plug>(vimfiler_cursor_top)
au FileType vimfiler nmap <buffer> <C-l> <Plug>(vimfiler_redraw_screen)
au FileType vimfiler nmap <buffer> @ <Plug>(vimfiler_toggle_mark_current_line)
au FileType vimfiler nmap <buffer> ` <Plug>(vimfiler_toggle_mark_current_line_up)
au FileType vimfiler nmap <buffer> <C-i> <Plug>(vimfiler_switch_to_other_window)
au FileType vimfiler nmap <buffer> i <Plug>(vimfiler_switch_to_another_vimfiler)
au FileType vimfiler nmap <buffer> vv <Plug>(vimfiler_toggle_mark_all_lines)
au FileType vimfiler nmap <buffer> vu <Plug>(vimfiler_clear_mark_all_lines)
au FileType vimfiler nmap <buffer> zc <Plug>(vimfiler_copy_file)
au FileType vimfiler nmap <buffer> zm <Plug>(vimfiler_move_file)
au FileType vimfiler nmap <buffer> zd <Plug>(vimfiler_delete_file)
au FileType vimfiler nmap <buffer> r <Plug>(vimfiler_rename_file)
au FileType vimfiler nmap <buffer> K <Plug>(vimfiler_make_directory)
au FileType vimfiler nmap <buffer> E <Plug>(vimfiler_new_file)
au FileType vimfiler nmap <buffer> <CR> <Plug>(vimfiler_execute)
"au FileType vimfiler nmap <buffer> <C-j> <Plug>(vimfiler_execute)
au FileType vimfiler nmap <buffer> l <Plug>(vimfiler_smart_l)
au FileType vimfiler nmap <buffer> x <Plug>(vimfiler_execute_system_associated)
au FileType vimfiler nmap <buffer> <2-LeftMouse> <Plug>(vimfiler_execute_system_associated)
au FileType vimfiler nmap <buffer> h <Plug>(vimfiler_smart_h)
au FileType vimfiler nmap <buffer> <BS> <Plug>(vimfiler_switch_to_parent_directory)
au FileType vimfiler nmap <buffer> L <Plug>(vimfiler_switch_to_drive)
au FileType vimfiler nmap <buffer> ~ <Plug>(vimfiler_switch_to_home_directory)
au FileType vimfiler nmap <buffer> \ <Plug>(vimfiler_switch_to_root_directory)
au FileType vimfiler nmap <buffer> <C-h> <Plug>(vimfiler_switch_to_history_directory)
au FileType vimfiler nmap <buffer> z. <Plug>(vimfiler_toggle_visible_dot_files)
au FileType vimfiler nmap <buffer> H <Plug>(vimfiler_popup_shell)
au FileType vimfiler nmap <buffer> ee <Plug>(vimfiler_edit_file)
"au FileType vimfiler nmap <buffer> E <Plug>(vimfiler_split_edit_file)
au FileType vimfiler nnoremap <silent><buffer><expr>es vimfiler#do_action('split')
au FileType vimfiler nmap <buffer> B <Plug>(vimfiler_edit_binary_file)
au FileType vimfiler nmap <buffer> er <Plug>(vimfiler_edit_binary_file)
au FileType vimfiler nmap <buffer> ge <Plug>(vimfiler_execute_external_filer)
au FileType vimfiler nmap <buffer> <RightMouse> <Plug>(vimfiler_execute_external_filer)
au FileType vimfiler nmap <buffer> <C-CR> <Plug>(vimfiler_execute_external_filer)
au FileType vimfiler nmap <buffer> ! <Plug>(vimfiler_execute_shell_command)
au FileType vimfiler nmap <buffer> q <Plug>(vimfiler_close)
au FileType vimfiler nmap <buffer> ddq <Plug>(vimfiler_exit)
au FileType vimfiler nmap <buffer> ? <Plug>(vimfiler_help)
au FileType vimfiler nmap <buffer> vi <Plug>(vimfiler_preview_file)
au FileType vimfiler nmap <buffer> o <Plug>(vimfiler_sync_with_current_vimfiler)
au FileType vimfiler nmap <buffer> O <Plug>(vimfiler_open_file_in_another_vimfiler)
au FileType vimfiler nmap <buffer> b <Plug>(vimfiler_open_file_in_another_vimfiler)
au FileType vimfiler nmap <buffer> <C-g><C-g> <Plug>(vimfiler_print_filename)
au FileType vimfiler nmap <buffer> g<C-g> <Plug>(vimfiler_toggle_maximize_window)
au FileType vimfiler nmap <buffer> yy <Plug>(vimfiler_yank_full_path)
au FileType vimfiler nmap <buffer> M <Plug>(vimfiler_set_current_mask)
au FileType vimfiler nmap <buffer> gr <Plug>(vimfiler_grep)
au FileType vimfiler nmap <buffer> gf <Plug>(vimfiler_find)
au FileType vimfiler nmap <buffer> S <Plug>(vimfiler_select_sort_type)
au FileType vimfiler nmap <buffer> <C-v> <Plug>(vimfiler_switch_vim_buffer_mode)
au FileType vimfiler nmap <buffer> gc <Plug>(vimfiler_cd_vim_current_dir)
au FileType vimfiler nmap <buffer> gs <Plug>(vimfiler_toggle_safe_mode)
au FileType vimfiler nmap <buffer> gS <Plug>(vimfiler_toggle_simple_mode)
au FileType vimfiler nmap <buffer> a <Plug>(vimfiler_choose_action)
au FileType vimfiler nmap <buffer> Y <Plug>(vimfiler_pushd)
au FileType vimfiler nmap <buffer> P <Plug>(vimfiler_popd)
au FileType vimfiler nmap <buffer> t <Plug>(vimfiler_expand_tree)
au FileType vimfiler nmap <buffer> . <Plug>(vimfiler_expand_tree)
au FileType vimfiler nmap <buffer> T <Plug>(vimfiler_expand_tree_recursive)
au FileType vimfiler nmap <buffer> I <Plug>(vimfiler_cd_input_directory)
au FileType vimfiler vmap <buffer> @ <Plug>(vimfiler_toggle_mark_selected_lines)
"}}}
au FileType vimfiler nnoremap <silent><buffer><expr>eb vimfiler#do_action('vsplit')
au FileType vimfiler nnoremap <silent><buffer><expr>ev vimfiler#do_action('tabopen')
au FileType vimfiler nnoremap <silent>,db :<C-u>Unite -default-action=vimfiler bookmark<CR>
au FileType vimfiler nnoremap <silent>,dd :<C-u>Unite -default-action=vimfiler directory_mru<CR>
endfunction
nnoremap ,ff :VimFiler -split -horizontal -reverse<CR>
nnoremap ,fj :VimFiler -split -winwidth=24 -simple -reverse -explorer <C-r>=<SID>get_prj_root()<CR><CR>
nnoremap ,fov :VimFiler -split -horizontal -reverse $VIMFILES<CR>
nnoremap ,fr :<C-u>Unite -buffer-name=files -start-insert file_rec:<C-r>=escape(<SID>get_prj_root(), ': ')<CR><CR>
nnoremap ,fl :VimFilerBufferDir -split -horizontal -reverse<CR>
nnoremap ,fb :Unite -default-action=vimfiler bookmark<CR>
nnoremap ,fd :Unite -default-action=vimfiler directory_mru<CR>
"nnoremap <silent>,xf :<C-u>call vimfiler#switch_filer(join([expand('%:p:h')]), {'split': 1, 'double': 1, 'horizontal': 1})<CR>
function! s:get_prj_root() "{{{
let prjRootPath = finddir('.git', expand('%:p:h').';')
if empty(prjRootPath)
return expand('%:p:h:h')
endif
return fnamemodify(prjRootPath, ':h')
endfunction
"}}}
endif
"}}}
"--------------------------------------
if neobundle#tap('flashcards.vim') "{{{
let g:flashcards#settings_dir = '~/.cache/vim/flashcards.vim'
let g:flashcards#decks_dir = '~/Dropbox/.config/vim/flashcards.vim'
endif
"}}}
"--------------------------------------
if neobundle#tap('calendar.vim') "{{{
let g:calendar_cache_directory = $VIMCACHE. '/calendar.vim/'
autocmd vimrc FileType calendar call s:calendar_mappings()
function! s:calendar_mappings()
nmap <buffer><expr>q b:calendar.view._help ? "\<Plug>(calendar_help)" : b:calendar.view._event ? "\<Plug>(calendar_event)" : b:calendar.view._task ? "\<Plug>(calendar_task)" : "\<Plug>(calendar_exit)"
nmap <buffer>h <Plug>(calendar_prev)
nmap <buffer>l <Plug>(calendar_next)
nmap <buffer>H <Plug>(calendar_line_head)
nmap <buffer>L <Plug>(calendar_line_last)
nmap <buffer>dd <Plug>(calendar_delete_line)
nmap <buffer>cc <Plug>(calendar_clear)
nmap <buffer>gh <Plug>(calendar_today)
nmap <buffer>t <Plug>(calendar_task)
nmap <buffer>e <Plug>(calendar_event)
nmap <buffer>r <Plug>(calendar_start_insert_change)
nmap <buffer><Esc> <Plug>(calendar_close_event)
try
unmap <buffer>d
unmap <buffer>c
unmap <buffer><C-h>
unmap <buffer><Space>
catch /E31:/
endtry
endfunction
endif
"}}}
"======================================
"Network_and_Documents:
if neobundle#tap('open-browser.vim') "{{{
call neobundle#config({'autoload': {'mappings': ['<Plug>(openbrowser-'], 'commands':
\ ['OpenBrowser', 'OpenBrowserSearch', 'OpenBrowserSmartSearch']}})
nmap ,xo <Plug>(openbrowser-smart-search)
vmap ,xo <Plug>(openbrowser-smart-search)
nmap <C-CR> <Plug>(openbrowser-smart-search)
vmap <C-CR> <Plug>(openbrowser-smart-search)
endif
"}}}
"--------------------------------------
if neobundle#tap('vim-ref') "{{{
call neobundle#config({'autoload': {'commands': [{'name': 'Ref', 'complete': 'customlist,ref#complete'}, 'RefHistory'],
\ 'mappings': ['<Plug>(ref-']}})
function! neobundle#tapped.hooks.on_source(bundle)
let g:ref_cache_dir = $VIMCACHE. '/.vim_ref_cache'
let g:ref_phpmanual_path = 'D:/dic/vim-ref/php-chunked-xhtml'
let g:ref_javadoc_path = 'D:/dic/vim-ref/java6api'
let g:ref_javadoc_cmd = 'lynx -dump -width=120 -nonumbers %s'
au FileType ref-* nnoremap <silent><buffer> q :close<CR>
"webdictサイトの設定
let g:ref_source_webdict_sites = {}
let g:ref_source_webdict_sites.je = {'url': 'http://dictionary.infoseek.ne.jp/jeword/%s',}
let g:ref_source_webdict_sites.ej = {'url': 'http://dictionary.infoseek.ne.jp/ejword/%s',}
let g:ref_source_webdict_sites.alc = {'url': 'http://eow.alc.co.jp/%s', 'keyword_encoding': 'utf-8', 'cache': '0',}
let g:ref_source_webdict_sites.kok = {'url': 'http://dictionary.infoseek.ne.jp/word/%s?dic=daijisen',}
let g:ref_source_webdict_sites.wip = {'url': 'http://ja.wikipedia.org/wiki/%s',}
let g:ref_source_webdict_sites.default = 'ej'
let g:ref_source_webdict_encoding = 'cp932'
"出力に対するフィルタ。最初の数行を削除
function! g:ref_source_webdict_sites.je.filter(output)
return join(split(a:output, "\n")[15 :], "\n")
endfunction
"function! g:ref_source_webdict_sites.ej.filter(output)
"return join(split(a:output, "\n")[15 :], "\n")
"endfunction
function! g:ref_source_webdict_sites.alc.filter(output)
return join(split(a:output, "\n")[37 :], "\n")
endfunction
function! g:ref_source_webdict_sites.kok.filter(output)
return join(split(a:output, "\n")[15 :], "\n")
endfunction
function! g:ref_source_webdict_sites.wip.filter(output)
return join(split(a:output, "\n")[17 :], "\n")
endfunction
endfunction
nnoremap gx <Nop>
nnoremap gxh :<C-u>Ref webdict ej <C-r><C-w>
nnoremap gxj :<C-u>Ref webdict je <C-r><C-w>
nnoremap gxk :<C-u>Ref webdict kok <C-r><C-w>
nnoremap gxa :<C-u>Ref webdict alc <C-r><C-w>
nnoremap gxw :<C-u>Ref webdict wip <C-r><C-w>
endif
"}}}
"--------------------------------------
if neobundle#tap('J6uil.vim') "{{{
call neobundle#config({'autoload': {'unite_sources': ['J6uil_members', 'J6uil_rooms'], 'mappings': [['n', '<Plug>(J6uil_']], 'commands': ['J6uilReconnect', 'J6uilDisconnect', {'complete': 'custom,J6uil#complete#room', 'name': 'J6uil'}]}})
function! neobundle#tapped.hooks.on_source(bundle)
autocmd FileType J6uil :call s:J6uil_settings(expand('<abuf>'))
autocmd FileType J6uil_say :nunmap <buffer><C-j>| nmap <silent><buffer>q :<C-u>bd!<CR>
let g:J6uil_config_dir = $VIMCACHE. '/.J6uil'
endfunction
function! s:J6uil_settings(bufnr)
nmap <silent><buffer>q :<C-u>bd!<CR>
nmap <silent><buffer>dc <Plug>(J6uil_disconnect)
nmap <silent><buffer>r <Plug>(J6uil_reconnect)
let s:bufnr = str2nr(a:bufnr)
noremap ,xj :<C-u>exe 'e' s:bufnr<CR>
autocmd VimLeavePre * :if bufexists(s:bufnr)| exe 'bd '. s:bufnr| endif
endfunction
noremap ,xj :<C-u>J6uil<CR>
endif
"}}}
"======================================
"Development:
if neobundle#tap('vim-fugitive') "{{{
call neobundle#config({'augroup': 'fugitive', 'autoload': {'commands': ['Git', 'Gcd', 'Glcd', 'Gstatus', 'Gcommit', 'Ggrep', 'Glgrep', 'Glog', 'Gllog', 'Gedit', 'Gsplit', 'Gvsplit', 'Gtabedit', 'Gpedit', 'Gread', 'Gwrite', 'Gwq', 'Gdiff', 'Gsdiff', 'Gvdiff', 'Gmove', 'Gremove', 'Gblame', 'Gbrowse']}})
function! neobundle#tapped.hooks.on_post_source(bundle)
doautoall fugitive BufNewFile
endfunction
endif
"}}}
"--------------------------------------
if neobundle#tap('vim-quickrun') "{{{
let g:quickrun_config = {}
let g:quickrun_config._ = {'outputter/buffer/split': '', 'outputter/buffer/close_on_empty': 1, 'runner': 'vimproc', 'runner/vimproc/updatetime': 60}
let g:quickrun_config.markdown = {'type': 'markdown/kramdown', 'cmdopt': '-s', 'outputter': 'browser'}
nmap ,r <Plug>(quickrun)
"<C-c> でquickrun実行を強制終了させる
nnoremap <expr><silent> <C-c> quickrun#is_running() ? quickrun#sweep_sessions() : "\<C-c>"
endif
"}}}
"--------------------------------------
if neobundle#tap('vimtest') "{{{
call neobundle#config({'autoload': {'commands': [{'name': 'VimTest', 'complete': 'file'},
\ {'name': 'VimTestBuffer', 'complete': 'file'}, {'name': 'VimTestStdout', 'complete': 'file'},
\ {'name': 'VimTestQuickfix', 'complete': 'file'}]}})
function! neobundle#tapped.hooks.on_source(bundle)
let g:vimtest_config = {}
"let g:vimtest_config.outputter = 'stdout' "cmdline
let g:vimtest_config.outputter = 'buffer'
endfunction
autocmd StdinReadPost,BufWinEnter *_test.vim nnoremap <buffer>,t :<C-u>VimTest<CR>
endif
"}}}
"--------------------------------------
if neobundle#tap('vim-themis') "{{{
endif
"}}}
"--------------------------------------
if neobundle#tap('vimhelpgenerator') "{{{
call neobundle#config({'autoload': {'commands': ['VimHelpGenerator', 'VimHelpGeneratorVirtual']}, 'stay_same': 1})
aug vimhelpgenerator
autocmd!
autocmd FileType help command! -nargs=0 -range -buffer HelpIntoMarkdown call vimhelpgenerator#helpintomarkdown#generate(<line1>, <line2>)
aug END
function! neobundle#tapped.hooks.on_source(bundle)
let g:vimhelpgenerator_version = ''
let g:vimhelpgenerator_author = 'Author : LeafCage <leafcage+vim @ gmail.com>'
let g:vimhelpgenerator_contents = {'contents': 1, 'introduction': 1, 'usage': 1, 'interface': 1, 'variables': 1, 'commands': 1, 'key-mappings': 1, 'functions': 1, 'todo': 0, 'changelog': 0,}
let g:vimhelpgenerator_uri = 'https://github.com/LeafCage/'
let g:vimhelpgenerator_gitignore_lines = ['/doc/tags*', 'todo.md']
endfunction
endif
"}}}
"======================================
"Insert:
if neobundle#tap('lexima.vim') "{{{
let g:lexima_no_default_rules = 1
let g:lexima_no_map_to_escape = 1
function! s:lexima_init() "{{{
call lexima#clear_rules()
let rules = [
\ {'char': '(', 'input_after': ')', 'at': '\%#[^'']'},
\ {'char': '(', 'at': '\\\%#'},
\ {'char': '(', 'at': '\%#[^[:blank:]]'},
\ {'char': ')', 'at': '\%#)', 'leave': 1},
\ {'char': ')', 'at': '\%#\n\s*)', 'leave': 2},
\ {'char': '<BS>', 'at': '(\%#)', 'delete': 1},
\ {'char': '<CR>', 'at': '(\%#)', 'input_after': '<CR>'},
\ {'char': '{', 'input_after': '}'},
\ {'char': '}', 'at': '\%#}', 'leave': 1},
\ {'char': '}', 'at': '\%#\n\s*}', 'leave': 2},
\ {'char': '<BS>', 'at': '{\%#}', 'delete': 1},
\ {'char': '<CR>', 'at': '{\%#}', 'input_after': '<CR>'},
\ {'char': '[', 'input_after': ']'},
\ {'char': '[', 'at': '\\\%#'},
\ {'char': '[', 'at': '\%#[^[:blank:]]'},
\ {'char': ']', 'at': '\%#]', 'leave': 1},
\ {'char': ']', 'at': '\%#\n\s*]', 'leave': 2},
\ {'char': '<BS>', 'at': '\[\%#\]', 'delete': 1},
\ {'char': '<CR>', 'at': '\[\%#\]', 'input_after': '<CR>'},
\ ]
let rules += [
\ {'char': '"', 'input_after': '"', 'at': '[^[:alnum:]]\%#\|\%#[^[:alnum:]]'},
\ {'char': '"', 'at': '\%#"', 'leave': 1},
\ {'char': '"', 'at': '\\\%#'},
\ {'char': '"', 'at': '^\s*\%#', 'filetype': 'vim'},
\ {'char': '"', 'at': '\%#\s*$', 'filetype': 'vim'},
\ {'char': '<BS>', 'at': '"\%#"', 'delete': 1},
\ {'char': '"', 'at': '""\%#', 'input_after': '"""'},
\ {'char': '"', 'at': '\%#"""', 'leave': 3},
\ {'char': '<BS>', 'at': '"""\%#"""', 'input': '<BS><BS><BS>', 'delete': 3},
\ {'char': "'", 'input_after': "'", 'at': '[^[:alnum:]]\%#\|\%#[^[:alnum:]]'},
\ {'char': "'", 'at': '\%#''', 'leave': 1},
\ {'char': "'", 'at': '\w\%#''\@!'},
\ {'char': "'", 'at': '\\\%#'},
\ {'char': "'", 'at': '\\\%#', 'leave': 1, 'filetype': ['vim', 'sh', 'csh', 'ruby', 'tcsh', 'zsh']},
\ {'char': "'", 'filetype': ['haskell', 'lisp', 'clojure', 'ocaml', 'scala']},
\ {'char': '<BS>', 'at': "'\\%#'", 'delete': 1},
\ {'char': "'", 'at': "''\\%#", 'input_after': "'''"},
\ {'char': "'", 'at': "\\%#'''", 'leave': 3},
\ {'char': '<BS>', 'at': "'''\\%#'''", 'input': '<BS><BS><BS>', 'delete': 3},
\ {'char': '`', 'input_after': '`'},
\ {'char': '`', 'at': '\%#`', 'leave': 1},
\ {'char': '<BS>', 'at': '`\%#`', 'delete': 1},
\ {'char': '`', 'at': '``\%#', 'input_after': '```'},
\ {'char': '`', 'at': '\%#```', 'leave': 3},
\ {'char': '<BS>', 'at': '```\%#```', 'input': '<BS><BS><BS>', 'delete': 3},
\ ]
for rule in rules
call lexima#add_rule(rule)
endfor
"call lexima#add_rule({'char': '(', 'at': '\%#[''"{}[:alnum:]]'})
"call lexima#add_rule({'char': '[', 'at': '\%#[''"{}[:alnum:]]'})
call lexima#add_rule({'char': '(', 'input_after': ')', 'mode': 'c'})
call lexima#add_rule({'char': '<BS>', 'at': '(\%#)', 'delete': 1, 'mode': 'c'})
call lexima#insmode#define_altanative_key('<C-h>', '<BS>')
call lexima#cmdmode#define_altanative_key('<C-h>', '<BS>')
endfunction
"}}}
function! neobundle#tapped.hooks.on_source(bundle)
call s:lexima_init()
command! -nargs=0 LeximaReload call s:lexima_init()
endfunction
endif
"}}}
"--------------------------------------
if neobundle#tap('neocomplecache') "{{{
function! neobundle#tapped.hooks.on_source(bundle)
let g:neocomplcache_temporary_dir = $VIMCACHE. '/.neocon'
let g:neocomplcache_dictionary_filetype_lists = {}
let g:neocomplcache_dictionary_filetype_lists.default = ''
let g:neocomplcache_dictionary_filetype_lists.vim = $VIMUSERDIR. '/.neocon_dict/vim.dict'
let g:neocomplcache_dictionary_filetype_lists.java = $VIMUSERDIR. '/.neocon_dict/java.dict'
"let g:neocomplcache_dictionary_filetype_lists.vimshell = $HOME.'/.vimshell_hist'
let g:neocomplcache_dictionary_filetype_lists.scheme = $HOME.'/.gosh_completions'
let g:neocomplcache_enable_at_startup = 1 "ネオコン有効化
let g:neocomplcache_enable_prefetch = 1 "以前のバージョンの挙動にする。
"let g:neocomplcache_disable_auto_complete = 1 "自動補完を無効にする
let g:neocomplcache_enable_smart_case = 1 "スマートケィス(大文字が含まれている場合は区別する)
let g:neocomplcache_enable_underbar_completion = 1 "アンダーバー_を区切りとした曖昧検索
let g:neocomplcache_enable_camel_case_completion = 1 "大文字を区切りとした曖昧検索
"let g:neocomplcache_enable_auto_select = 1 "ポップアップを出すとき自動的に一番上の候補を選択状態
let g:neocomplcache_auto_completion_start_length = 2 "ポップアップを出し始める文字数(初期値2)
let g:neocomplcache_min_syntax_length = 3 "シンタックス最小キャッシュ文字数
let g:neocomplcache_min_keyword_length = 2 "補完を行うキーワードの最小長さ(初期値4)
"ネオコンが未対応のファイルタイプでのキーワード収集パターン(ファイルタイプ別に指定)
let g:neocomplcache_keyword_patterns = get(g:, 'neocomplecache_keyword_patterns', {})
let g:neocomplcache_keyword_patterns['default'] = '\h\w*' "単語のヘッド\単語を構成する文字(数字やアルファベット)*
"let g:neocomplcache_keyword_patterns['sfd'] = '\c\[:\%(\h\w*:\]\)\?\| &\h[[:alnum:]_:]*\| \$\h\w*\|-\h\w*=\?\| <SID>\%(\h\w*(\?\)\?\| <Plug>([^)]*)\?\| <\h[[:alnum:]_-]*>\?\| \h[[:alnum:]_:#]*\%(!\| ()\?\)\?\| `\h\w*'
endfunction
"Vim標準の補完をネオコンに置き換える
inoremap <expr><C-x><C-f> neocomplcache#manual_filename_complete()
inoremap <expr><C-x><C-o> neocomplcache#manual_omni_complete()
"inoremap <expr><C-n> pumvisible() ? "\<C-n>" : neocomplcache#manual_keyword_complete()
"候補の共通箇所まで補完する
inoremap <expr><C-l> neocomplcache#complete_common_string()
"決定してポップアップを閉じる
"inoremap <expr><C-j> pumvisible() ? neocomplcache#close_popup() : "\<C-j>"
"キャンセルしてポップアップを閉じる
inoremap <expr><C-e> pumvisible() ? neocomplcache#cancel_popup() : "\<End>"
"inoremap <expr><C-q> neocomplcache#cancel_popup()
"inoremap <expr><C-y> eocomplcache#cancel_popup()
"ネオコンによって挿入した補完を元に戻す
inoremap <expr><C-\> neocomplcache#undo_completion()
endif
"}}}
"--------------------------------------
if neobundle#tap('neosnippet') "{{{
call neobundle#config({'autoload': {'unite_sources': ['neosnippet_file', 'snippet', 'snippet_target'], 'mappings': [['sxi', '<Plug>(neosnippet_']], 'commands': [{'complete': 'file', 'name': 'NeoSnippetSource'}, {'complete': 'customlist,neosnippet#filetype_complete', 'name': 'NeoSnippetMakeCache'}, {'complete': 'customlist,neosnippet#edit_complete', 'name': 'NeoSnippetEdit'}]}})
function! neobundle#tapped.hooks.on_source(bundle)
let g:neosnippet#snippets_directory = $VIMUSERDIR. '/snippets'
au vimrc FileType neosnippet setl nobl nofoldenable tabstop=2 shiftwidth=2 softtabstop=2
au vimrc FileType neosnippet noremap <buffer>q <C-w>q
au vimrc FileType neosnippet inoremap <buffer><C-q> ${}<Left>
endfunction
au vimrc BufLeave *.snip setl nobl
imap <C-s> <Plug>(neosnippet_expand_or_jump)
smap <C-s> <Plug>(neosnippet_expand_or_jump)
xmap <C-s> <Plug>(neosnippet_expand_target)
"スニペットを編集する
nmap cos <SID>o_snip
nnoremap <SID>o_snip :<C-u>NeoSnippetEdit -split -horizontal -direction=aboveleft<CR>
nmap coS <SID>o_Snip
nnoremap <SID>o_Snip :<C-u>NeoSnippetEdit -runtime -split -horizontal -direction=aboveleft<CR>
nmap cors <SID>o_rsnip
nnoremap <SID>o_rsnip :<C-u>NeoSnippetEdit -runtime -split -horizontal -direction=aboveleft<CR>
nmap coas <SID>a_snip
nnoremap <SID>a_snip :NeoSnippetEdit -split -horizontal -direction=aboveleft _<CR>
nmap coaS <SID>a_Snip
nnoremap <SID>a_Snip :NeoSnippetEdit -runtime -split -horizontal -direction=aboveleft _<CR>
endif
"}}}
"--------------------------------------
if neobundle#tap('emmet-vim') "{{{
let g:user_emmet_leader_key = '<C-z>'
let g:user_emmet_settings = {'indentation' : ' '}
endif
"}}}
"--------------------------------------
if neobundle#tap('vim-abolish') "{{{
nmap cr <Plug>Coerce
function! LoadAbolish(arglead, cmdline, curpos) "{{{
call neobundle#config#source('vim-abolish')
call feedkeys("\<C-\>egetcmdline()\<CR>\<Tab>", 't')
return a:arglead
endfunction
"}}}
endif
"}}}
"--------------------------------------
if neobundle#tap('nerdcommenter') "{{{
call neobundle#config({})
function! neobundle#tapped.hooks.on_post_source(bundle)
doautocmd NERDCommenter BufEnter
endfunction
nmap gc [CM]
vmap gc [CM]
nmap [CM]c <Plug>NERDCommenterToggle
vmap [CM]c <Plug>NERDCommenterToggle
nmap [CM]a <Plug>NERDCommenterAppend
nmap [CM]9 <Plug>NERDCommenterToEOL
vmap [CM]x <Plug>NERDCommenterSexy
vmap [CM]b <Plug>NERDCommenterMinimal
endif
"}}}
"--------------------------------------
if neobundle#tap('yankround.vim') "{{{
let g:ctrlp_abailable = 1
let g:yankround_dir = $VIMCACHE. '/yankround'
let g:yankround_use_region_hl = 1
let g:ctrlp_enable = 1
nmap p <Plug>(yankround-p)
xmap p <Plug>(yankround-p)
nmap P <Plug>(yankround-P)
nmap gp <Plug>(yankround-gp)
xmap gp <Plug>(yankround-gp)
nmap gP <Plug>(yankround-gP)
nmap gp <Plug>(yankround-cursorfixed-p)
nmap gP <Plug>(yankround-cursorfixed-P)
nnoremap <silent><SID>(ctrlp) :<C-u>CtrlP<CR>
nnoremap <silent><expr><SID>(thumbnail) exists(':Thumbnail')==2 ? ":\<C-u>Thumbnail\<CR>" : ''
"nmap <expr><C-p> yankround#is_active() ? "\<Plug>(yankround-prev)" : "<SID>(ctrlp)"
"nmap <expr><C-n> yankround#is_active() ? "\<Plug>(yankround-next)" : "<SID>(thumbnail)"
nmap <expr><C-p> yankround#is_active() ? "\<Plug>(yankround-prev)" : "gT"
nmap <expr><C-n> yankround#is_active() ? "\<Plug>(yankround-next)" : "gt"
"nmap <C-n> <Plug>(yankround-next)
nnoremap <silent>[@]<C-p> :<C-u>CtrlPYankRound<CR>
cmap <C-r> <Plug>(yankround-insert-register)
cmap <C-r><C-e> <Plug>(yankround-insert-register)=substitute(substitute(@", '\n$', '', ''), '\n', '<Bar> ', 'g')<CR>
cmap <C-r><C-y> <Plug>(yankround-insert-register)=substitute(@+, '\n$', '', 'g')<CR>
cmap <C-y> <Plug>(yankround-pop)
cmap <C-x><C-y> <Plug>(yankround-backpop)
endif
"}}}
"--------------------------------------
if neobundle#tap('nebula.vim') "{{{
nnoremap <silent>,bl :<C-u>NebulaPutLazy<CR>
nnoremap <silent>,bc :<C-u>NebulaYankConfig<CR>
nnoremap <silent>,bp :<C-u>NebulaPutFromClipboard<CR>
nnoremap <silent>,bt :<C-u>NebulaYankTap!<CR>
endif
"}}}
"--------------------------------------
if neobundle#tap('vim-expand-region') "{{{
nmap * <Plug>(expand_region_expand)
xmap * <Plug>(expand_region_expand)
nmap - <Plug>(expand_region_shrink)
xmap - <Plug>(expand_region_shrink)
endif
"}}}
"--------------------------------------
if neobundle#tap('vim-operator-replace') "{{{
call neobundle#config({'depends': 'vim-operator-user', 'autoload': {'mappings': ['<Plug>(operator-replace)']}})
nmap yr <Plug>(operator-replace)
nmap cr <Plug>(operator-replace)
nmap cy <Plug>(operator-replace)
vmap P <Plug>(operator-replace)
endif
"}}}
"--------------------------------------
if neobundle#tap('vim-textobj-user') "{{{
call neobundle#config({'autoload': {'mappings': [['xo', '<Plug>(textobj-piece']]}})
let s:SFILE = expand('<sfile>')
function! neobundle#tapped.hooks.on_source(bundle)
call textobj#user#plugin('cword', {'-': {'pattern': '\k*\%#\k*', 'select': ['*',], }, })
let textobj_star = {'select-a': 'a*', 'select-i': 'i*',
\ 'select-a-function': 's:Textobj_star_a', 'select-i-function': 's:Textobj_star_i', 'sfile': s:SFILE}
let textobj_hash = {'select-a': 'a#', 'select-i': 'i#',
\ 'select-a-function': 's:Textobj_hash_a', 'select-i-function': 's:Textobj_hash_i', 'sfile': s:SFILE}
let textobj_bar = {'select-a': 'a<Bar>', 'select-i': 'i<Bar>',
\ 'select-a-function': 's:Textobj_bar_a', 'select-i-function': 's:Textobj_bar_i', 'sfile': s:SFILE}
let textobj_hyphen = {'select-a': 'a-', 'select-i': 'i-',
\ 'select-a-function': 's:Textobj_hyphen_a', 'select-i-function': 's:Textobj_hyphen_i', 'sfile': s:SFILE}
let textobj_dot = {'select-a': 'a.', 'select-i': 'i.',
\ 'select-a-function': 's:Textobj_dot_a', 'select-i-function': 's:Textobj_dot_i', 'sfile': s:SFILE}
let textobj_underscore = {'select-a': 'a_', 'select-i': 'i_',
\ 'select-a-function': 's:Textobj_underscore_a', 'select-i-function': 's:Textobj_underscore_i', 'sfile': s:SFILE}
let textobj_slash = {'select-a': 'a/', 'select-i': 'i/',
\ 'select-a-function': 's:Textobj_slash_a', 'select-i-function': 's:Textobj_slash_i', 'sfile': s:SFILE}
call textobj#user#plugin('piece', {'star': textobj_star, 'bar': textobj_bar, 'dot': textobj_dot, 'underscore': textobj_underscore, 'hash': textobj_hash, 'hyphen': textobj_hyphen, 'slash': textobj_slash})
endfunction
let g:textobj_piece_no_default_key_mappings = 1
xmap i* <Plug>(textobj-piece-star-i)
xmap a* <Plug>(textobj-piece-star-a)
omap i* <Plug>(textobj-piece-star-i)
omap a* <Plug>(textobj-piece-star-a)
xmap i# <Plug>(textobj-piece-hash-i)
xmap a# <Plug>(textobj-piece-hash-a)
omap i# <Plug>(textobj-piece-hash-i)
omap a# <Plug>(textobj-piece-hash-a)
xmap i<Bar> <Plug>(textobj-piece-bar-i)
xmap a<Bar> <Plug>(textobj-piece-bar-a)
omap i<Bar> <Plug>(textobj-piece-bar-i)
omap a<Bar> <Plug>(textobj-piece-bar-a)
xmap i- <Plug>(textobj-piece-hyphen-i)
xmap a- <Plug>(textobj-piece-hyphen-a)
omap i- <Plug>(textobj-piece-hyphen-i)
omap a- <Plug>(textobj-piece-hyphen-a)
xmap i. <Plug>(textobj-piece-dot-i)
xmap a. <Plug>(textobj-piece-dot-a)
omap i. <Plug>(textobj-piece-dot-i)
omap a. <Plug>(textobj-piece-dot-a)
xmap i_ <Plug>(textobj-piece-underscore-i)
xmap a_ <Plug>(textobj-piece-underscore-a)
omap i_ <Plug>(textobj-piece-underscore-i)
omap a_ <Plug>(textobj-piece-underscore-a)
function! s:Textobj_star_a() "{{{
return s:_textobj_piece('*', 'a')
endfunction
"}}}
function! s:Textobj_star_i() "{{{
return s:_textobj_piece('*', 'i')
endfunction
"}}}
function! s:Textobj_bar_a() "{{{
return s:_textobj_piece('|', 'a')
endfunction
"}}}
function! s:Textobj_bar_i() "{{{
return s:_textobj_piece('|', 'i')
endfunction
"}}}
function! s:Textobj_dot_a() "{{{
return s:_textobj_piece('.', 'a')
endfunction
"}}}
function! s:Textobj_dot_i() "{{{
return s:_textobj_piece('.', 'i')
endfunction
"}}}
function! s:Textobj_underscore_a() "{{{
return s:_textobj_piece('_', 'a')
endfunction
"}}}
function! s:Textobj_underscore_i() "{{{
return s:_textobj_piece('_', 'i')
endfunction
"}}}
function! s:Textobj_hash_a() "{{{
return s:_textobj_piece('#', 'a')
endfunction
"}}}
function! s:Textobj_hash_i() "{{{
return s:_textobj_piece('#', 'i')
endfunction
"}}}
function! s:Textobj_hyphen_a() "{{{
return s:_textobj_piece('-', 'a')
endfunction
"}}}
function! s:Textobj_hyphen_i() "{{{
return s:_textobj_piece('-', 'i')
endfunction
"}}}
function! s:Textobj_slash_a() "{{{
return s:_textobj_piece('/', 'a')
endfunction
"}}}
function! s:Textobj_slash_i() "{{{
return s:_textobj_piece('/', 'i')
endfunction
"}}}
function! s:_textobj_piece(char, i6a) "{{{
let save_view = winsaveview()
let crrline = line('.')
if a:i6a == 'i'
"charの後のcharじゃないものを探す
let _match_b = search('\M'. a:char.'\[^'.a:char .']', 'bce', crrline)
else
let _match_b = search('\M'. a:char, 'bce', crrline)
endif
let bgn = getpos('.')
if a:i6a == 'i'
let _match_e = search('\M\[^'. a:char .']\ze'. a:char, '', crrline)
else
let _match_e = search('\M'. a:char, '', crrline)
endif
let end = getpos('.')
if _match_b==0 || _match_e==0 || len(a:char)>1
return
endif
call winrestview(save_view)
return ['v', bgn, end]
endfunction
"}}}
endif
"}}}
"--------------------------------------
if neobundle#tap('vim-textobj-indent') "{{{
let g:textobj_indent_no_default_key_mappings = 1
omap a<C-i> <Plug>(textobj-indent-a)
omap i<C-i> <Plug>(textobj-indent-i)
omap ai <Plug>(textobj-indent-same-a)
omap ii <Plug>(textobj-indent-same-i)
xmap a<C-i> <Plug>(textobj-indent-a)
xmap i<C-i> <Plug>(textobj-indent-i)
xmap ai <Plug>(textobj-indent-same-a)
xmap ii <Plug>(textobj-indent-same-i)
endif
"}}}
"--------------------------------------
if neobundle#tap('vim-textovj-wiw') "{{{
let g:textobj_wiw_no_default_key_mappings = 1
xmap aw <Plug>(textobj-wiw-a)
xmap iw <Plug>(textobj-wiw-i)
omap aw <Plug>(textobj-wiw-a)
omap iw <Plug>(textobj-wiw-i)
endif
"}}}
"--------------------------------------
if neobundle#tap('vim-textobj-function') "{{{
call neobundle#config({'depends': 'kana/vim-textobj-user', 'autoload': {'mappings': [['xo', '<Plug>(textobj-function']]}})
let g:textobj_function_no_default_key_mappings = 1
omap a<C-f> <Plug>(textobj-function-a)
omap i<C-f> <Plug>(textobj-function-i)
xmap a<C-f> <Plug>(textobj-function-a)
xmap i<C-f> <Plug>(textobj-function-i)
endif
"}}}
"--------------------------------------
if neobundle#tap('vim-textobj-between') "{{{
call neobundle#config({'depends': 'kana/vim-textobj-user','autoload': {'mappings': [['xo', '<Plug>(textobj-between']]}})
let g:textobj_between_no_default_key_mappings = 1
omap a<C-b> <Plug>(textobj-between-a)
omap i<C-b> <Plug>(textobj-between-i)
xmap a<C-b> <Plug>(textobj-between-a)
xmap i<C-b> <Plug>(textobj-between-i)
endif
"}}}
"--------------------------------------
if neobundle#tap('vim-textobj-comment') "{{{
call neobundle#config({'depends': 'kana/vim-textobj-user','autoload': {'mappings': [['xo', '<Plug>(textobj-comment']]}})
let g:textobj_comment_no_default_key_mappings = 1
omap ac <Plug>(textobj-comment-a)
omap ic <Plug>(textobj-comment-i)
xmap ac <Plug>(textobj-comment-a)
xmap ic <Plug>(textobj-comment-i)
endif
"}}}
"--------------------------------------
if neobundle#tap('vim-textobj-xbrackets') "{{{
call neobundle#config({'depends': 'kana/vim-textobj-user', 'autoload': {'mappings': ['<Plug>(textobj-xbrackets']}})
let g:textobj_xbrackets_no_default_key_mappings = 1
" function declarations
omap ad <Plug>(textobj-xbrackets-ys(_)-a)
xmap ad <Plug>(textobj-xbrackets-ys(_)-a)
omap id <Plug>(textobj-xbrackets-ys(_)-i)
xmap id <Plug>(textobj-xbrackets-ys(_)-i)
" function definitions
omap aD <Plug>(textobj-xbrackets-ys(){_}-a)
xmap aD <Plug>(textobj-xbrackets-ys(){_}-a)
omap iD <Plug>(textobj-xbrackets-ys(){_}-i)
xmap iD <Plug>(textobj-xbrackets-ys(){_}-i)
endif
"}}}
"--------------------------------------
if neobundle#tap('vim-textobj-parameter') "{{{
let g:textobj_parameter_no_default_key_mappings = 1
xmap a<C-p> <Plug>(textobj-parameter-a)
xmap i<C-p> <Plug>(textobj-parameter-i)
omap a<C-p> <Plug>(textobj-parameter-a)
omap i<C-p> <Plug>(textobj-parameter-i)
endif
"}}}
"--------------------------------------
if neobundle#tap('vim-textobj-multiblock') "{{{
call neobundle#config({'depends': 'kana/vim-textobj-user', 'autoload': {'mappings': ['<Plug>(textobj-multiblock']}})
let g:textobj_multiblock_no_default_key_mappings = 1
omap a<C-m> <Plug>(textobj-multiblock-a)
omap i<C-m> <Plug>(textobj-multiblock-i)
vmap a<C-m> <Plug>(textobj-multiblock-a)
vmap i<C-m> <Plug>(textobj-multiblock-i)
endif
"}}}
"--------------------------------------
if neobundle#tap('vim-surround') "{{{
call neobundle#config({'autoload': {'mappings': ['<Plug>Ysurround', '<Plug>Csurround', '<Plug>Ygsurround', '<Plug>Dsurround', ['i', '<Plug>ISurround'], ['sx', '<Plug>VgSurround'], ['sx', '<Plug>Vsurround'], '<Plug>SurroundRepeat', '<Plug>Yssurround', ['i', '<Plug>Isurround'], ['sx', '<Plug>Vgsurround'], '<Plug>Ygssurround', ['sx', '<Plug>VSurround']]}})
function! neobundle#tapped.hooks.on_source(bundle)
let g:surround_no_mappings = 1
endfunction
nmap ds <Plug>Dsurround
nmap cs <Plug>Csurround
xmap s <Plug>Vsurround
nmap ys <Plug>Ysurround
nmap yS <Plug>Ygsurround
nmap yss <Plug>Yssurround
nmap ysys <Plug>Yssurround
nmap ySs <Plug>Ygssurround
nmap ySS <Plug>Ygssurround
endif
"}}}
"======================================
"Moving:
runtime macros/matchit.vim
let b:match_ignorecase = 1
let b:batch_words = &matchpairs . ",\<if\>:\<endif\>"
"--------------------------------------
if neobundle#tap('vim-smartword') "{{{
map w <Plug>(smartword-w)
map b <Plug>(smartword-b)
map e <Plug>(smartword-e)
map ge <Plug>(smartword-ge)
imap <C-b> <Esc><Plug>(smartword-b)i
endif
"}}}
"--------------------------------------
if neobundle#tap('jasegment.vim') "{{{
call neobundle#config({'autoload': {'mappings': [['sxno', '<Plug>JaSegment']], 'commands': ['JaSegmentSplit']}})
endif
"}}}
"--------------------------------------
if neobundle#tap('vim-easymotion') "{{{
let g:EasyMotion_keys='hklyuiopnm,qwertzxcvbasdgjf;'
let g:EasyMotion_smartcase = 1
let g:EasyMotion_use_migemo = 1
map 0f <Plug>(easymotion-s)
noremap <SID>(next_f) ;
nmap <expr>t g:Fpos.is_during_f(0) ? "<SID>(next_f)" : "\<Plug>(easymotion-s)"
let g:EasyMotion_startofline=0
nnoremap <expr>gj &wrap && winwidth(0) < col('$') ? "j" : ":call EasyMotion#JK(0, 0)\<CR>"
nnoremap <expr>gk &wrap && winwidth(0) < col('$') ? "k" : ":call EasyMotion#JK(0, 1)\<CR>"
vnoremap <expr>gj &wrap && winwidth(0) < col('$') ? "j" : ":\<C-u>call EasyMotion#JK(1, 0)\<CR>"
vnoremap <expr>gk &wrap && winwidth(0) < col('$') ? "k" : ":\<C-u>call EasyMotion#JK(1, 1)\<CR>"
else
nnoremap t ;
endif
"}}}
"--------------------------------------
if neobundle#tap('CamelCaseMotion') "{{{
map <silent> mw <Plug>CamelCaseMotion_w
map <silent> mb <Plug>CamelCaseMotion_b
map <silent> me <Plug>CamelCaseMotion_e
nmap <silent> mx <Plug>CamelCaseMotion_w
nmap <silent> mr <Plug>CamelCaseMotion_b
"nmap <silent> mc <Plug>CamelCaseMotion_e
omap <silent> x <Plug>CamelCaseMotion_w
omap <silent> r <Plug>CamelCaseMotion_b
omap <silent> c <Plug>CamelCaseMotion_e
nmap <silent> cd c<Plug>CamelCaseMotion_ie
"omap <silent> e <Plug>CamelCaseMotion_ie
"テキストオブジェクトに対応させる
"omap <silent> ib <Plug>CamelCaseMotion_ib
"vmap <silent> ib <Plug>CamelCaseMotion_ib
omap <silent> ie <Plug>CamelCaseMotion_ie
vmap <silent> ie <Plug>CamelCaseMotion_ie
endif
"}}}
"--------------------------------------
if neobundle#tap('accelerated-smooth-scroll') "{{{
let g:ac_smooth_scroll_no_default_key_mappings = 1
let g:ac_smooth_scroll_enable_accelerating = 0
nmap <silent> <C-d> <Plug>(ac-smooth-scroll-c-d)
nmap <silent> <C-u> <Plug>(ac-smooth-scroll-c-u)
xmap <silent> <C-d> <Plug>(ac-smooth-scroll-c-d_v)
xmap <silent> <C-u> <Plug>(ac-smooth-scroll-c-u_v)
endif
"}}}
"--------------------------------------
if neobundle#tap('clever-f.vim') "{{{
let g:clever_f_ignore_case = 1
let g:clever_f_smart_case = 1
let g:clever_f_use_migemo = 1
let g:clever_f_show_prompt = 1
let g:clever_f_chars_match_any_signs = ';'
let g:clever_f_not_overwrites_standard_mappings = 1
map f <Plug>(clever-f-f)
map F <Plug>(clever-f-F)
"map t <Plug>(clever-f-t)
"map T <Plug>(clever-f-T)
endif
"}}}
"--------------------------------------
if neobundle#tap('vim-poslist') "{{{
call neobundle#config({})
function! neobundle#tapped.hooks.on_post_source(bundle)
call poslist#save_current_pos()
endfunction
nmap <M-o> <Plug>(poslist-prev-pos)
nmap <M-i> <Plug>(poslist-next-pos)
endif
"}}}
"--------------------------------------
if neobundle#tap('vim-visualstar') "{{{
noremap <SID>put_searchstart_sign :<C-u>call <SID>put_searchstart_sign(0)<CR>
"nmap <silent>* <Plug>(visualstar-*)N<SID>put_searchstart_sign
"vmap <silent>* <SID>put_searchstart_sign<Plug>(visualstar-*)N
vmap <silent>+ <Plug>(visualstar-*)N
vmap <silent>S <Plug>(visualstar-*)N
"map # <Plug>(visualstar-#)N:<C-u>sign unplace 333<CR>
endif
"}}}
"======================================
"Writing:
"syster.vim
let g:Syster_dir = $BASEDIR. '/syster'
"======================================
"Buffer_and_Win_and_Tabpage_and_Jump:
"lastbuf
let g:lastbuf_level= 2
exe 'noremap <silent>'. s:bind.win. 'u :LastBuf<CR>'
"--------------------------------------
if neobundle#tap('vim-choosewin') "{{{
let g:choosewin_overlay_enable = 1
let g:choosewin_overlay_clear_multibyte = 1
let g:choosewin_label = 'ABCDEFGIJKMNOPQRSTUVWXYZ'
let g:choosewin_keymap = {'h': 'tab_prev', 'l': 'tab_next'}
nmap mf <Plug>(choosewin)
endif
"}}}
"--------------------------------------
if neobundle#tap('vim-altr') "{{{
map <F2> <Plug>(altr-forward)
map <S-F2> <Plug>(altr-back)
endif
"}}}
"--------------------------------------
if neobundle#tap('vim-gf-user') "{{{
function! neobundle#tapped.hooks.on_post_source(bundle)
NeoBundleSource vim-gf-autoload
endfunction
let g:gf_user_no_default_key_mappings = 1
nmap gf <Plug>(gf-user-gf)
vmap gf <Plug>(gf-user-gf)
nmap gF <Plug>(gf-user-gF)
vmap gF <Plug>(gf-user-gF)
nmap <C-w>f <Plug>(gf-user-<C-w>f)
vmap <C-w>f <Plug>(gf-user-<C-w>f)
nmap <C-w>F <Plug>(gf-user-<C-w>F)
vmap <C-w>F <Plug>(gf-user-<C-w>F)
nmap <C-w>gf <Plug>(gf-user-<C-w>gf)
vmap <C-w>gf <Plug>(gf-user-<C-w>gf)
endif
"}}}
"--------------------------------------
if neobundle#tap('vim-automatic') "{{{
let g:automatic_config = [{'match': {'bufname': '[\[\*]unite[\]\*]', 'any_unite_sources': ['quickfix']}, 'set': {'height': '30%'}}]
endif
"}}}
"======================================
"Bind_and_Command:
"if neobundle#tap('vim-arpeggio') "{{{
"let g:arpeggio_timeoutlen = 80
"call arpeggio#load()
"call arpeggio#map('nicv', '', 0, 'fj', '<Esc>')
"endif
"}}}
"--------------------------------------
if neobundle#tap('vim-ambicmd') "{{{
"cnoremap <expr> <C-l> getcmdtype()==':' && getcmdpos()==1 ? 'let ' : ambicmd#expand("\<Right>")
cnoremap <expr><C-n> ambicmd#expand("\<C-n>")
endif
"}}}
"--------------------------------------
if neobundle#tap('vim-submode') "{{{
let g:submode_timeoutlen = 5000
"; ,
call submode#enter_with('nextChar', 'nv', '', 'z;', ';')
call submode#enter_with('nextChar', 'nv', '', 'z,,', ',')
call submode#leave_with('nextChar', 'nv', '', 'z')
call submode#map('nextChar', 'nv', '', ';', ';')
call submode#map('nextChar', 'nv', '', ',', ',')
"cmdlineplus.vim
call submode#enter_with('cmdlineplus', 'c', 'r', '<C-x><C-f>', '<Plug>(cmdlineplus-forward-word)')
call submode#map('cmdlineplus', 'c', 'r', '<C-f>', '<Plug>(cmdlineplus-forward-word)')
"Fontzoom
let g:fontzoom_no_default_key_mappings = 1
call submode#enter_with('fontzoom', 'n', 'r', ',+', '<Plug>(fontzoom-larger)')
call submode#enter_with('fontzoom', 'n', 'r', ',-', '<Plug>(fontzoom-smaller)')
call submode#map('fontzoom', 'n', 'r', '+', '<Plug>(fontzoom-larger)')
call submode#map('fontzoom', 'n', 'r', '-', '<Plug>(fontzoom-smaller)')
"winmove
",zwmでgui窓を動かす
let [g:wm_move_down, g:wm_move_up, g:wm_move_left, g:wm_move_right] = ['', '', '', '']
call submode#enter_with('move-window', 'n', '', ',zwm', '<Nop>')
call submode#leave_with('move-window', 'n', '', '<Esc>')
call submode#map('move-window', 'n', 'r', 'j', '<Plug>(winmove-down)')
call submode#map('move-window', 'n', 'r', '<Down>', '<Plug>(winmove-down)')
call submode#map('move-window', 'n', 'r', 'k', '<Plug>(winmove-up)')
call submode#map('move-window', 'n', 'r', '<Up>', '<Plug>(winmove-up)')
call submode#map('move-window', 'n', 'r', 'h', '<Plug>(winmove-left)')
call submode#map('move-window', 'n', 'r', '<Left>', '<Plug>(winmove-left)')
call submode#map('move-window', 'n', 'r', 'l', '<Plug>(winmove-right)')
call submode#map('move-window', 'n', 'r', '<Right>', '<Plug>(winmove-right)')
",zwsで窓の高さ調整
call submode#enter_with('win-size', 'n', '', ',zws', '<Nop>')
call submode#enter_with('win-size', 'n', '', '<C-w>>', '<C-w>>')
call submode#enter_with('win-size', 'n', '', '<C-w><', '<C-w><')
call submode#enter_with('win-size', 'n', '', '<C-w>+', '<C-w>+')
call submode#enter_with('win-size', 'n', '', '<C-w>-', '<C-w>-')
call submode#leave_with('win-size', 'n', '', '<Esc>')
call submode#map('win-size', 'n', '', '+', '<C-w>+')
call submode#map('win-size', 'n', '', '-', '<C-w>-')
call submode#map('win-size', 'n', '', '<', '<C-w><')
call submode#map('win-size', 'n', '', '>', '<C-w>>')
call submode#map('win-size', 'n', 'x', '=', '<C-w>=')
"変更リストブラウズ
call submode#enter_with('changelist', 'n', '', 'g,', 'g,zv')
"call submode#enter_with('changelist', 'n', '', 'g;', 'g;zv')
call submode#leave_with('changelist', 'n', '', '<Esc>')
call submode#map('changelist', 'n', '', ',', 'g,zv')
call submode#map('changelist', 'n', '', ';', 'g;zv')
endif
"}}}
"--------------------------------------
if neobundle#tap('vim-mapswap') "{{{
endif
"}}}
"--------------------------------------
if neobundle#tap('vim-altercmd') "{{{
call altercmd#load()
"neobundle
AlterCommand nb Unite neobundle
AlterCommand nbi Unite neobundle/install
AlterCommand nbu Unite neobundle/update<C-r>=Eat_whitespace('\s')<CR>
AlterCommand nbl[g] Unite neobundle/log
AlterCommand nbus Unite neobundle/install:unite.vim:vimshell:vimfiler:vimproc:neobundle:neocomplcache:neosnippet
AlterCommand nbum Unite neobundle/install:vital.vim:lightline.vim:vim-anzu:vim-quickrun:vim-fugitive:vim-gf-autoload:current-func-info.vim:rainbowcyclone.vim:vim-themis:emmet-vim
AlterCommand nbls NeoBundleList
AlterCommand nbc NeoBundleClean
command! -nargs=0 NeoBundleUpdateShougo
\ NeoBundleUpdate
\ unite.vim vimshell vimfiler vimproc neobundle.vim neocomplcache neosnippet
command! -nargs=0 NeoBundleUpdateMain
\ NeoBundleUpdate
\ vim-quickrun vital.vim open-browser.vim vim-submode vim-surround CamelCaseMotion
"unite.vim
AlterCommand u[nite] Unite
AlterCommand ua Unite -auto-preview
AlterCommand una Unite -auto-preview
AlterCommand unp Unite -auto-preview
AlterCommand upp UPP
"ref.vim
AlterCommand zh Ref webdict ej
AlterCommand zj Ref webdict je
AlterCommand zk Ref webdict kok
AlterCommand za Ref webdict alc
AlterCommand zw Ref webdict wip
AlterCommand zv Ref javadoc
AlterCommand sc Script
AlterCommand ou Outputbuf
AlterCommand op[p] Outputbuf PP
AlterCommand gi[t] Git
AlterCommand gd Gsdiff
AlterCommand c[tags] !start ctags %
AlterCommand vit[alize] Vitalize --name=<C-r>=expand('%:p:h:h:t:r')<CR> <C-r>=expand('%:p:h:h')<CR>
AlterCommand sf setf
AlterCommand ft setf
AlterCommand so so %
AlterCommand me mes
AlterCommand rv source $MYVIMRC
AlterCommand fl h function-list
AlterCommand h41 h function-list
AlterCommand ja[va] !java
AlterCommand jc !javac -d ../classes
endif
"}}}
"--------------------------------------
if neobundle#tap('cmdlineplus.vim') "{{{
cmap <M-f> <Plug>(cmdlineplus-forward-word)
cmap <C-b> <Plug>(cmdlineplus-backward-word)
cmap <M-b> <Plug>(cmdlineplus-backward-word)
cmap <C-x><C-k> <Plug>(cmdlineplus-kill-line)
cmap <C-x><C-d> <Plug>(cmdlineplus-backward-kill-line)
cmap <C-\><C-\> <Plug>(cmdlineplus-escape-special)
cmap <C-\>i <Plug>(cmdlineplus-escape-input)
cmap <C-\><C-y> <Plug>(cmdlineplus-yank)
cmap <C-\><C-c> <Plug>(cmdlineplus-yank-clipboard)
cmap <C-x>f <Plug>(cmdlineplus-f)
cmap <C-x>F <Plug>(cmdlineplus-F)
cmap <C-x>t <Plug>(cmdlineplus-t)
cmap <C-x>T <Plug>(cmdlineplus-T)
cmap <C-x>; <Plug>(cmdlineplus-;)
cmap <C-x>, <Plug>(cmdlineplus-,)
cmap <C-x>df <Plug>(cmdlineplus-df)
cmap <C-x>dF <Plug>(cmdlineplus-dF)
endif
"}}}
"======================================
"Info:
if neobundle#tap('foldCC.vim') "{{{
set foldtext =FoldCCtext()
let g:foldCCtext_enable_autofdc_adjuster = 1
let g:foldCCnavi_maxchars = 30
endif
"}}}
"--------------------------------------
if neobundle#tap('visiblemarks.vim') "{{{
nnoremap <silent>m :<C-u>call visiblemarks#setmark()<CR>
"nmap m <Plug>(visiblemarks-m)
nmap ma <Plug>(visiblemarks-m,)
nmap m. <Plug>(visiblemarks-m.)
nmap dm <Plug>(visiblemarks-dm)
nmap m<C-g> <Plug>(visiblemarks-info-buf)
map gm <Plug>(visiblemarks-`)
map M <Plug>(visiblemarks-`)
map MM <Plug>(visiblemarks-``)
endif
"}}}
"--------------------------------------
if neobundle#tap('echos.vim') "{{{
let g:echos_enable_visible_str = 1
endif
"}}}
"--------------------------------------
if neobundle#tap('lastmess.vim') "{{{
let g:lastmess_ignore_pattern = 'スキャン中\|検索したので\|箇所変更しました;\|行 削除しました;\|行 追加しました\|\d\+L, \d\+C$\|行 --\d\+%--$\|--バッファに行がありません--$\|既に一番新しい変更です\|^\s*\d\+:\s\%(\~\|\u:\)/'
let g:lastmess_default_count = 30
let g:lastmess_special_highlight = [['MoreMsg', '^sourced:']]
nmap mz <Plug>(lastmess)
nnoremap mg :<C-u>mes<CR>
else
nnoremap mz :<C-u>mes<CR>
endif
"}}}
"--------------------------------------
if neobundle#tap('vim-anzu') "{{{
call neobundle#config({'autoload': {'mappings': ['<Plug>(anzu-', '<Plug>(anzu-jump-n)<Plug>', '<Plug>(anzu-jump-N)<Plug>']}})
let g:anzu_status_format = '%p(%i/%l) %#WarningMsg#%w'
let g:anzu_no_match_word = '%#ErrorMsg#E486: Pattern not found: %p'
nmap n <Plug>(anzu-jump-n)<Plug>(anzu-echo-search-status)zv
nmap N <Plug>(anzu-jump-N)<Plug>(anzu-echo-search-status)zv
nmap + <Plug>(anzu-star-with-echo)Nzz
nmap S <Plug>(anzu-star-with-echo)Nzz
endif
"}}}
"--------------------------------------
if neobundle#tap('vim-hier') "{{{
" ハイライトの設定
execute "highlight ucurl_my gui=undercurl guisp=Red"
let g:hier_highlight_group_qf = "ucurl_my"
" ハイライト箇所を更新
"nnoremap <Space>hiu :HierUpdate<CR>
" ハイライトを削除
"nnoremap <Space>hic :HierClear<CR>
endif
"}}}
"--------------------------------------
if neobundle#tap('unite-colorscheme') "{{{
function! neobundle#tapped.hooks.on_source(bundle)
"augroup LightLineColorscheme
" autocmd!
" autocmd ColorScheme * LightlineUpdate
"augroup END
endfunction
cnoreabb <expr>colorscheme getcmdtype()==':' && getcmdline()=~'^\s*Unite ' && getcmdline()!~'-auto-preview' ?
\ '-auto-preview colorscheme' : 'colorscheme'
endif
"}}}
"--------------------------------------
if neobundle#tap('taillight.vim') "{{{
autocmd vimrc BufEnter *.cms TailLight ; /\* \*/
endif
"}}}
"======================================
"GUI:
if neobundle#tap('rainbowcyclone.vim') "{{{
let g:rainwbow_cyclone_colors = []
call add(g:rainwbow_cyclone_colors, 'term=reverse ctermfg=1 ctermbg=12 gui=bold guifg=Black guibg=Red')
call add(g:rainwbow_cyclone_colors, 'term=reverse ctermfg=1 ctermbg=6 gui=bold guifg=Black guibg=Orange')
call add(g:rainwbow_cyclone_colors, 'term=reverse ctermfg=1 ctermbg=14 gui=bold guifg=Black guibg=Khaki')
call add(g:rainwbow_cyclone_colors, 'term=reverse ctermfg=1 ctermbg=10 gui=bold guifg=Black guibg=ForestGreen')
call add(g:rainwbow_cyclone_colors, 'term=reverse ctermfg=1 ctermbg=9 gui=bold guifg=Black guibg=Blue')
call add(g:rainwbow_cyclone_colors, 'term=reverse ctermfg=1 ctermbg=1 gui=bold guifg=Black guibg=SlateBlue')
call add(g:rainwbow_cyclone_colors, 'term=reverse ctermfg=1 ctermbg=5 gui=bold guifg=Black guibg=Purple')
nmap c/ <Plug>(rc_search_forward)
nmap c? <Plug>(rc_search_backward)
nmap cS <Plug>(rc_search_forward_with_cursor)N
nmap c, <Plug>(rc_highlight_with_last_pattern)
endif
"}}}
"--------------------------------------
if neobundle#tap('lightline.vim') "{{{
command! -bar LightlineUpdate call lightline#init()| call lightline#colorscheme()| call lightline#update()
let g:lightline = {'subseparator': {'left': '', 'right': ''}, 'tabline_subseparator': {'left': '|', 'right': ''}}
let g:lightline.tabline = {'right': [['rows'], ['cd'], ['tabopts'], ['fugitive']]}
let g:lightline.tab = {'active': ['prefix', 'filename']}
let g:lightline.tab.inactive = g:lightline.tab.active
let g:lightline.active = {}
let g:lightline.inactive = {}
let g:lightline.active.left = [['winbufnum'], ['dir'], ['filename'], ['filetype', 'readonly', 'modified'], ['currentfuncrow']]
let g:lightline.active.right = [['lineinfo'], ['percent'], ['fileformat', 'fileencoding'], ['cfi']]
let g:lightline.inactive.left = [['winbufnum'], ['dir'], ['filename'], ['filetype', 'readonly', 'modified']]
let g:lightline.inactive.right = [['lineinfo'], ['percent'], ['fileformat', 'fileencoding']]
let g:lightline.component = {'dir': '%.35(%{expand("%:h:s?\\S$?\\0/?")}%)', 'filename': '%t%{get(w:, "quickfix_title", "")}', 'winbufnum': '%n%{repeat(",", winnr())}%<', 'rows': '%L', 'cd': '%.35(%{fnamemodify(getcwd(), ":~")}%)', 'readonly': '%{&ro ? "=" : ""}', 'tabopts': '%{&et?"et":""}%{&ts}:%{&sw}:%{&sts},%{&tw}', 'lineinfo': '%3l:%-3v'}
let g:lightline.component_function = {'fugitive': 'StlFugitive', 'cfi': 'StlCurrentFuncInfo', 'currentfuncrow': 'StlCurrentFuncRow', 'anzu': 'anzu#search_status'}
function! StlFugitive() "{{{
try
if &ft !~? 'vimfiler\|gundo' && exists('*fugitive#head')
return fugitive#head()
endif
catch
return ''
endtry
return ''
endfunction
"}}}
function! StlCurrentFuncInfo() "{{{
if exists('*cfi#format')
return cfi#format('%.43s()', '')
end
return ''
endfunction
"}}}
function! StlCurrentFuncRow() "{{{
if &ft != 'vim'
return ''
end
let funcbgn = search('^\s*\<fu\%[nction]\>', 'bcnW', search('^\s*\<endf\%[unction]\>', 'bcnW'))
if funcbgn > 0
let row = line('.') - funcbgn
return row ? row : ''
endif
return ''
endfunction
"}}}
let g:lightline.tab_component_function = {'prefix': 'TalPrefix', 'filename': 'TalFilename'}
function! TalPrefix(n) "{{{
return lightline#tab#tabnum(a:n). TalTabwins(a:n)
endfunction
"}}}
function! TalTabwins(n) "{{{
return repeat(',', len(tabpagebuflist(a:n)))
endfunction
"}}}
function! TalFilename(n) "{{{
return TalBufnum(a:n). '-'. substitute(lightline#tab#filename(a:n), '.\{16}\zs.\{-}\(\.\w\+\)\?$', '~\1', '')
endfunction
"}}}
function! TalBufnum(n) "{{{
let buflist = tabpagebuflist(a:n)
let winnr = tabpagewinnr(a:n)
return buflist[winnr - 1]
endfunction
"}}}
let g:lightline.colorscheme = 'lclightline'
let s:p = {'inactive': {}, 'normal': {}, 'insert': {}, 'visual': {}, 'tabline': {}}
let s:STL_BASECOLOR = ['black', 'Gray80', 16, 0]
let s:STL_ATTRIBUTECOLOR = ['white', 'SlateGray', 231, 0]
let s:p.inactive.middle = [s:STL_BASECOLOR]
let s:p.inactive.left = [s:STL_BASECOLOR, ['black', 'azure', 16, 0], ['black', 'MistyRose', 16, 0], s:STL_ATTRIBUTECOLOR, ['black', 'azure', 16, 0]]
let s:p.inactive.right = [['black', 'NavajoWhite1', 16, 0], ['black', 'MistyRose', 16, 0], s:STL_ATTRIBUTECOLOR, ['black', 'azure', 16, 0]]
let s:p.normal.middle = s:p.inactive.middle
let s:p.normal.left = map(deepcopy(s:p.inactive.left), 'extend(v:val, ["bold"])')
let s:p.normal.right = map(deepcopy(s:p.inactive.right), 'extend(v:val, ["bold"])')
let s:p.insert.middle = [['black', 'DarkKhaki', 16, 0, 'bold']]
let s:p.insert.left = [s:p.insert.middle[0], ['black', 'LightSkyBlue1', 16, 0, 'bold'], ['black', 'RosyBrown1', 16, 0, 'bold'], ['white', 'SlateGray', 231, 0, 'bold'], ['black', 'LightSkyBlue1', 16, 0, 'bold']]
let s:p.insert.right = [s:p.insert.middle[0], ['black', 'RosyBrown1', 16, 0, 'bold'], ['white', 'SlateGray', 231, 0, 'bold'], ['black', 'LightSkyBlue1', 16, 0, 'bold']]
"let s:p.visual.middle = [['black', 'thistle3', 0, 0, 'bold']]
let s:p.visual.middle = [['white', 'darkslateblue', 231, 0, 'bold']]
let s:p.visual.middle = [['white', 'mediumpurple4', 231, 0, 'bold']]
let s:p.visual.middle = [['black', 'thistle2', 16, 0, 'bold']]
let s:p.visual.left = deepcopy(s:p.insert.left)
let s:p.visual.left[0] = s:p.visual.middle[0]
let s:p.visual.right = deepcopy(s:p.insert.right)
let s:p.visual.right[0] = s:p.visual.middle[0]
let s:p.tabline.middle = [['black', 'gray', 16, 0]]
let s:p.tabline.left = [['black', 'gray60', 16, 0]]
let s:p.tabline.tabsel = [['white', '#002451', 231, 17, 'underline']]
let s:p.tabline.right = [['black', 'Gray80', 16, 0], ['white', '#002451', 231, 17], ['black', 'DarkGray', 16, 0], s:STL_ATTRIBUTECOLOR]
let g:lightline#colorscheme#lclightline#palette = s:p
unlet s:p s:STL_BASECOLOR s:STL_ATTRIBUTECOLOR
else
"let pathstr = '%.40(%{empty(bufname("%")) ? "" : expand(''%:p:h'')."/"}%9*%t %0*%)'
"let fencstr = '%([%{&fenc}/%{&ff[:0]}]%)'
"let &stl = '%{repeat(",", winnr()).","}%4P'. '%9*%3n-%0*'. pathstr. '%m%R%H%W%y '. fencstr. '%=%4l(%4L),%3v(%3{virtcol("$")-1})%<'
endif
"}}}
"--------------------------------------
if neobundle#tap('vim-ezbar') "{{{
let g:ezbar = {'separator_L': '', 'separator_R': ''}
let g:ezbar.active = [
\ 'winbufnum',
\ 'dir',
\ 'filename',
\ {'chg_color': {'gui': ['SlateGray', 'white', 'bold']}},
\ 'filetype',
\ 'modified',
\ 'currentfuncrow',
\ {'__SEP__': 'StatusLine'},
\ 'cfi',
\ 'fileformat',
\ 'encoding',
\ 'percent',
\ 'line_col',
\ ]
let g:ezbar.inactive = [
\ 'winbufnum',
\ 'dir',
\ 'filename',
\ {'chg_color': 'StlProperty'},
\ 'filetype',
\ 'modified',
\ {'__SEP__': 'StatusLine'},
\ 'encoding',
\ 'percent',
\ 'line_col',
\ ]
let s:u = {}
function! s:u._init(n) "{{{
let self.mode = mode()
let self.bufname = bufname(winbufnr(a:n))
if self.__is_active && self.mode==#'i'
let self.__default_color = {'gui': ['DarkKhaki', 'black', 'bold']}
end
endfunction
"}}}
function! s:u._filter(layout, parts) "{{{
if self.mode == 'i'
let a:parts.__SEP__.ac = {'gui': ['DarkKhaki', 'black', 'bold']}
end
if has_key(a:parts, 'filename')
let a:parts.filename.ac = {'gui': [(self.mode==#'i' ? 'RosyBrown1': 'MistyRose'), 'black', 'bold']}
let a:parts.filename.ic = {'gui': ['MistyRose', 'black']}
end
call extend(a:parts.line_col, {'ac': {'gui': ['NavajoWhite1', 'black', 'bold']}, 'c': {'gui': ['NavajoWhite1', 'black']}})
call extend(a:parts.percent, {'ac': {'gui': ['MistyRose', 'black', 'bold']}, 'c': {'gui': ['MistyRose', 'black']}})
return a:layout
endfunction
"}}}
function! s:u.winbufnum(n) "{{{
return '%n%{repeat(",", winnr())}%<'
endfunction
"}}}
function! s:u.dir(n) "{{{
let bg = self.mode==#'i' ? 'LightSkyBlue1': 'azure'
return {'s': '%.35('. fnamemodify(self.bufname, ':h'). '%)',
\ 'ac': {'gui': [bg, 'black', 'bold']}, 'ic': {'gui': ['azure', 'black']}}
endfunction
"}}}
function! s:u.currentfuncrow(n) "{{{
if &ft != 'vim'
return ''
end
let funcbgn = search('^\s*\<fu\%[nction]\>', 'bcnW', search('^\s*\<endf\%[unction]\>', 'bcnW'))
if funcbgn > 0
let row = line('.') - funcbgn
return row ? {'s': row, 'c': {'gui': ['azure', 'black', 'bold']}} : ''
endif
return ''
endfunction
"}}}
function! s:u.cfi(n) "{{{
if exists('*cfi#format')
return {'s': cfi#format('%.43s()', ''), 'c': {'gui': ['azure', 'black', 'bold']}}
end
return ''
endfunction
"}}}
let g:ezbar.parts = extend(s:u, ezbar#parts#default#new(), 'keep')
unlet s:u
endif
"}}}
"--------------------------------------
if neobundle#tap('rainbow_parentheses.vim') "{{{
autocmd vimrc VimEnter * RainbowParenthesesToggle
autocmd vimrc Syntax * RainbowParenthesesLoadRound
autocmd vimrc Syntax * RainbowParenthesesLoadSquare
autocmd vimrc Syntax * RainbowParenthesesLoadBraces
endif
"}}}
"--------------------------------------
if neobundle#tap('vim-quickhl') "{{{
call neobundle#config({'autoload': {'mappings': ['<Plug>(quickhl-'], 'commands':
\ ['QuickhlList', 'QuickhlReset', 'QuickhlDump', 'QuickhlColors', 'QuickhlReloadColors', 'QuickhlAdd', 'QuickhlLock', 'QuickhlMatch']}})
function! neobundle#tapped.hooks.on_source(bundle)
endfunction
map ,xh <Plug>(quickhl-toggle)
map ,xH <Plug>(quickhl-reset)
endif
"}}}
"======================================
"Maintenance:
if neobundle#tap('savevers.vim') "{{{
set patchmode=.vbcu
let g:savevers_types = "*"
"let g:savevers_dirs = &backupdir
let g:savevers_dirs = '/tmp/auBcu/,$TEMP,$TMP,.'
let g:versdiff_no_resize=1
nmap <silent> <F7> :VersDiff -<cr>
nmap <silent> <F8> :VersDiff +<cr>
nmap <silent> <F9> :VersDiff -c<cr>
endif
"}}}
"======================================
"Helper:
if neobundle#tap('vim-diff') "{{{
set diffexpr=diff#diffexpr()
endif
"}}}
"--------------------------------------
if neobundle#tap('qfixgrep') "{{{
call neobundle#config({'autoload': {'commands': ['ToggleGrepRecursiveMode', 'REGrepadd', 'OpenQFixWin', 'RFGrep', 'MoveToQFixWin', 'BGrepadd', 'ToggleGrepCurrentDirMode', 'VGrepadd', 'RFGrepadd', 'MyGrepWriteResult', 'MyGrepReadResult', 'Vimgrep', 'BGrep', 'RGrepadd', 'Vimgrepadd', 'FGrep', 'QFixCopen', 'ToggleMultiEncodingGrep', 'QFixAltWincmd', 'REGrep', 'QFdo', 'QFixCclose', 'RGrep', 'CloseQFixWin', 'EGrep', 'ToggleDamemoji', 'Grepadd', 'EGrepadd', 'ToggleLocationListMode', 'Grep', 'VGrep', 'ToggleQFixWin', 'FList', 'FGrepadd']}})
let g:MyGrep_Key = ','
let g:MyGrep_KeyB = 'g'
let g:mygrepprg = 'grep'
"let g:mygrepprg = 'jvgrep'
endif
"}}}
"======================================
"Neobundle_END:
call neobundle#untap()
filetype plugin indent on "ファイル判定をonにする
let g:loaded_getscriptPlugin = 1 | let g:loaded_netrwPlugin = 1 | let g:loaded_vimballPlugin = 1
if filereadable(fnamemodify('~/.privacy/.vimrc_privacy.vim', ':p'))
source ~/.privacy/.vimrc_privacy.vim "lingr.vimのパスワードとか
endif
"=========================================================
"Autocmd:
autocmd vimrc VimResized * exe "normal! \<c-w>="
autocmd vimrc QuickfixCmdPost * if !empty(getqflist()) | cwindow | endif
autocmd vimrc VimLeavePre * set verbosefile=/tmp/vim.log
"改行時にコメントしない(上手く動いていない(上書きされてる))
"autocmd vimrc FileType * setlocal fo-=ro
"--------------------------------------
"au_filetype
autocmd vimrc BufWinEnter *.markdown,*.md setl ft=markdown nofoldenable
autocmd vimrc FileType js setlocal ft=javascript
"--------------------------------------
"au_option
autocmd vimrc FileType gitcommit setl nofoldenable nomodeline tw=60 fenc=utf-8
autocmd vimrc FileType vim setl ff=unix
autocmd vimrc Filetype qf set nobl
"--------------------------------------
"au_keymappings
autocmd vimrc FileType help nnoremap <buffer><expr>q winnr('$')==1 ? ":\<C-u>bd\<CR>" : "\<C-w>c"
autocmd vimrc BufWinEnter option-window nnoremap <buffer><expr>q winnr('$')==1 ? ":\<C-u>bd\<CR>" : "\<C-w>c"
autocmd vimrc FileType qf noremap <buffer>q :cclose<CR>
autocmd vimrc FileType qf noremap <buffer><CR> :<C-u>.cc<CR>zvzz
autocmd vimrc FileType qf noremap <buffer><C-n> :<C-u>exe v:count. 'cn'<CR>zvzz<C-w>p
autocmd vimrc FileType qf noremap <buffer><C-p> :<C-u>exe v:count. 'cp'<CR>zvzz<C-w>p
autocmd vimrc FileType vim inoremap <expr><buffer>\
\ getline('.') =~ '^\s*$' ? "\\\<Space>" : match(getline('.'), '\S')+1 >= col('.') ? "\\\<Space>" : '\'
autocmd vimrc Filetype vim inoreabb <buffer> ecs Echos
autocmd vimrc Filetype vim inoreabb <buffer> echs Echos
autocmd vimrc Filetype vim inoreabb <buffer> echos Echos
autocmd vimrc Filetype vim inoreabb <buffer> ect Echot
autocmd vimrc FileType markdown inoremap <buffer><expr><CR> getline('.')=~'\S\s$' ? "\<Space>\<CR>" : "\<CR>"
autocmd vimrc FileType markdown inoremap <buffer><expr>- match(getline('.'), '^\s*\zs[^-]')==col('.')-1 ? "- " : '-'
autocmd vimrc FileType markdown inoremap <buffer><expr>+ match(getline('.'), '^\s*\zs[^+]')==col('.')-1 ? "+ " : '+'
autocmd vimrc FileType markdown inoremap <buffer><expr>* match(getline('.'), '^\s*\zs[^+]')==col('.')-1 ? "* " : '*'
autocmd vimrc FileType markdown nnoremap <buffer><silent><CR> :<C-u>if getline('.')=~'\s$'<Bar>call setline('.', substitute(getline('.'), '\s\+$', '', ''))<Bar>else<Bar>call setline('.', substitute(getline('.'), '$', ' ', ''))<Bar>endif<CR>
autocmd vimrc FileType java inoremap <expr><C-q> <SID>IsEndSemicolon() ? "<C-O>$;<CR>" : "<C-O>$<CR>"
function! s:IsEndSemicolon() "{{{
let c = getline(".")[col("$")-2]
if c != ';'
return 1
else
return 0
endif
endfunction
"}}}
autocmd vimrc FileType java inoremap <C-_> <C-o>${<CR>
autocmd vimrc FileType java nnoremap ,c :!javac %<CR>
"--------------------------------------
"autocmd vimrc FileType javascript call s:on_javascript()
function! s:on_javascript() "{{{
setlocal conceallevel=2
syntax keyword JavaScriptLambda function conceal cchar=λ
highlight clear Conceal
highlight link Conceal Identifier
highlight link JavaScriptLambda Identifier
endfunction
"}}}
"--------------------------------------
aug vimrc_colorscheme
au!
autocmd ColorScheme * call <SID>define_CursorIM_on_highlight() | call <SID>define_other_highlight()
autocmd Syntax,BufNewFile,BufRead,StdinReadPost * syntax match ZenkakuSpace containedin=ALL / /
aug END
function! s:define_CursorIM_on_highlight() "{{{
if has('multi_byte_ime') || has('xim')
hi CursorIM guibg=#ffb700 guifg=NONE
endif
endfunction
"}}}
function! s:define_other_highlight() "{{{
hi StlProperty guifg=white guibg=SlateGray
hi TabLineSel guifg=white guibg=#002451 gui=underline
hi TabLine guifg=black guibg=Gray60
hi Pmenu guifg=white guibg=#6A5CB4 gui=NONE
hi Visual term=reverse cterm=reverse ctermbg=0 guibg=Gray50
"hi Cursor guifg=Black guibg=Green
"hi CursorTrack guibg=darkslategray4
hi ZenkakuSpace cterm=underline ctermfg=darkgrey gui=underline guifg=darkgrey
endfunction
"}}}
"窓にカーソルの痕跡を残す
"autocmd vimrc_colorscheme WinLeave * match CursorTrack /\%#/
"autocmd vimrc_colorscheme WinEnter * match none
"--------------------------------------
"Window位置の保存と復帰
let s:infofile = expand($VIMCACHE. '/.vimpos')
function! s:save_windowsize() "{{{
if !has('gui_running')
return
end
let options = ['set columns='. &columns, 'set lines='. &lines, 'winpos '. getwinposx(). ' '. getwinposy()]
try
call writefile(options, s:infofile)
catch /E482/
call delete(s:infofile)
call writefile(options, s:infofile)
endtry
endfunction
"}}}
augroup SaveWindowSize
autocmd!
autocmd VimLeavePre * call s:save_windowsize()
autocmd GUIEnter * if filereadable(s:infofile) | execute 'source' s:infofile | endif
augroup END
"--------------------------------------
"ファイルを開いたら前回のカーソル位置へ移動
"autocmd vimrc BufReadPost * if line("'\"")>1 && line("'\"")<=line('$') | exe 'norm! g`"' | endif
aug vimrc
autocmd BufLeave * if expand('%')!='' && &buftype=='' | mkview | endif
autocmd BufReadPost * if !has_key(b:, 'view_loaded') && expand('%')!='' && &buftype==''
\ | silent! loadview | let b:view_loaded = 1 | endif
autocmd VimLeave * call map(split(glob(&viewdir . '/*'), "\n"), 'delete(v:val)')
aug END
"--------------------------------------
aug vimrc
"直前の検索パターンと'hlsearch'をバッファローカルにする
"autocmd WinLeave * let b:vimrc_pattern = @/ | let b:vimrc_hlsearch = &hlsearch
"autocmd WinEnter * let @/ = get(b:, 'vimrc_pattern', @/) | let &l:hlsearch = get(b:, 'vimrc_hlsearch', &l:hlsearch)
aug END
"=========================================================
"Commands:
function! s:trim_blank_line() range "{{{
exe a:firstline
let lastrow = a:lastline
let erow = line('$')
let crrrow = line('.')
while crrrow <= lastrow && crrrow<erow
if getline(crrrow)=='' && getline(crrrow+1)!=''
join
let lastrow -= 1| let erow -= 1
else
norm! j
end
let crrrow = line('.')
endwhile
endfunction
"}}}
command! -nargs=0 -range=% TrimBlankLine <line1>,<line2>call s:trim_blank_line()
function! s:outputbuf(cmd) "{{{
redir => output
silent exe a:cmd
redir END
if output==''
return
end
tabnew
set nobl
nnoremap <buffer>q :<C-u>close<CR>
call append('.', split(output, '\n'))
del _
setl nomod
endfunction
"}}}
command! -nargs=+ -complete=expression Outputbuf call s:outputbuf(<q-args>)
command! -complete=var -nargs=+ OPP Outputbuf PP <args>
command! -nargs=? ExtractMatches let s:pat = empty(<q-args>) ? @/ : <q-args> | let s:result = filter(getline(1, '$'), 'v:val =~# s:pat') | new | put =s:result | unlet s:pat s:result
function! s:highlight_preview(args) "{{{
highlight clear HighlightPreview
exe 'highlight HighlightPreview' a:args
echoh HighlightPreview
echo 'HighlightPreview'
echoh NONE
endfunction
"}}}
command! -nargs=+ HighlightPreview call s:highlight_preview(<q-args>)
command! -nargs=* VimElements UPP lib#vimelements#collect(<f-args>)
command! Hitest silent! source $VIMRUNTIME/syntax/hitest.vim
command! MessageClear for n in range(200) | echom "" | endfor| unlet n| ec 'Cleared Message'
nnoremap mc :<C-u>MessageClear<CR>
function! s:scriptid(...) "{{{
let arg = a:0 ? a:1 : expand('%')
if arg=~'^\d\+$'
return lily#sid_to_path(arg)
end
return lily#scriptnames(arg)
endfunction
"}}}
command! -nargs=? Script echo s:scriptid(<f-args>)
command! -nargs=1 Func fu {<args>}
"command! -bar Tasks execute 'vimgrep /\C\v<(TODO|FIXME|XXX)>/ **/*.'. expand('%:e')
command! -bar Tasks execute 'vimgrep /\C\v<(TODO|FIXME|XXX)>/ ' expand('%:h'). '**/*.'. expand('%:e')
"Vim script計測
command! -bar TimerStart let start_time = reltime()
command! -bar TimerEnd echo reltimestr(reltime(start_time)) | unlet start_time
"plugin撮影用にウィンドウのサイズを一時的に変更する
command! GuiWin exe &lines>27 ? 'set lines=27 columns=87' : 'set lines=40 columns=140'
function! s:grep_for_cmdprompt(cmd, argstr) "{{{
let args = split(a:argstr, '\%(\\\@<!\s\)\+')
let i = 0
while match(args, '^-', i)!=-1
let i+=1
endwhile
let dflbase = expand('%:p:h')
let dflbase = dflbase==?expand('$HOME') ? expand('%') : dflbase.'/**/*'
let opts = i==0 ? '' : join(args[:i-1])
let pat = has('win32') ? iconv(escape(args[i], '#%'), 'utf-8', 'cp932') : escape(args[i], '#%')
let target = i+1>=len(args) ? dflbase : join(args[(i+1):])
let g:greped = a:cmd. ' '. opts. ' -8 '. pat. ' '. target
silent exe g:greped
endfunction
"}}}
command! -nargs=+ -complete=file Grep call s:grep_for_cmdprompt('grep', '<args>')
"失敗したaugを無効にする
command! -nargs=1 -complete=augroup KillAug autocmd! <args>
command! -nargs=1 -complete=augroup AugKiller autocmd! <args>
"Rename
function! s:rename(name, bang) "{{{
let crrpath = expand("%:p")
let v:errmsg = ""
silent! exe "saveas" . a:bang a:name
if v:errmsg =~# '^$\|^E329'
if expand("%:p") !=# crrpath && filewritable(expand("%:p"))
silent exe "bwipe! " . crrpath
if delete(crrpath)
echoerr "Could not delete " . crrpath
endif
endif
else
echoerr v:errmsg
endif
endfunction
"}}}
command! -nargs=* -complete=file -bang Rename :call <SID>rename("<args>", "<bang>")
function! s:git_log_viewer() "{{{
let crrfiledir = expand('%:h')
new [gitdiff]
exe 'lcd!' crrfiledir
if &sh=~'command\.com\|cmd\.exe'
VimProcRead git log --encoding=sjis -u 'ORIG_HEAD..HEAD'
else
VimProcRead git log -u 'ORIG_HEAD..HEAD'
end
setl filetype=git bt=nofile noma
setl foldmethod=expr foldexpr=getline(v:lnum)=~'^commit'?'>1':getline(v:lnum+1)=~'^commit'?'<1':'='
setl foldtext=FoldTextOfGitLog()
nnoremap <buffer>q :bd<CR>
endfunction
"}}}
function! FoldTextOfGitLog() "{{{
let month_map = {'Jan' : '01', 'Feb' : '02', 'Mar' : '03', 'Apr' : '04', 'May' : '05', 'Jun' : '06', 'Jul' : '07', 'Aug' : '08', 'Sep' : '09', 'Oct' : '10', 'Nov' : '11', 'Dec' : '12', }
if getline(v:foldstart) !~ '^commit'
return getline(v:foldstart)
endif
if getline(v:foldstart + 1) =~ '^Author:'
let author_lnum = v:foldstart + 1
elseif getline(v:foldstart + 2) =~ '^Author:'
" commitの次の行がMerge:の場合があるので
let author_lnum = v:foldstart + 2
else
" commitの下2行がどちらもAuthor:で始まらなければ諦めて終了
return getline(v:foldstart)
endif
let date_lnum = author_lnum + 1
let message_lnum = date_lnum + 2
let author = matchstr(getline(author_lnum), '^Author: \zs.*\ze <.\{-}>')
let date = matchlist(getline(date_lnum), ' \(\a\{3}\) \(\d\{1,2}\) \(\d\{2}:\d\{2}:\d\{2}\) \(\d\{4}\)')
let message = getline(message_lnum)
let month = date[1]
let day = printf('%02s', date[2])
let time = date[3]
let year = date[4]
let datestr = join([year, month_map[month], day], '-')
return join([datestr, time, author, message], ' ')
endfunction
"}}}
command! GitLogViewer call s:git_log_viewer()
if exists(':AlterCommand')
if has('win32')
AlterCommand gr[e] Grep
end
AlterCommand re[name] Rename <C-r>=expand('%:p:h').'/'<CR><C-r>=Eat_whitespace('\s')<CR>
AlterCommand fu Func
end
"command! -nargs=1 -complete=var Echos redir => s:msg | silent exe 'echo '. <q-args> | redir END | echom s:msg[1:] | unlet s:msg
"=========================================================
"Misc:
function! Eat_whitespace(pat) "{{{
let c = nr2char(getchar(0))
if c=~a:pat
return ''
elseif c=~'\r'
return ''
end
return c
endfunction
"}}}
let g:Fpos = {'bufnr': 0, 'row': 0, 'is_vmode': -1}
function! g:Fpos.save(is_vmode) "{{{
let self.bufnr = bufnr('%')
let self.row = line('.')
let self.is_vmode = a:is_vmode
endfunction
"}}}
function! g:Fpos.reset() "{{{
let self.bufnr = 0
let self.row = 0
let self.is_vmode = -1
endfunction
"}}}
function! g:Fpos.is_during_f(is_vmode) "{{{
let ret = a:is_vmode==self.is_vmode && bufnr('%')==self.bufnr && line('.')==self.row
if !ret
call self.reset()
end
return ret
endfunction
"}}}
function! s:imoff_f(is_vmode, bind) "{{{
let save_gcr = &gcr
set gcr=n:hor20
let c = nr2char(getchar())
if c=="\<Esc>"
call g:Fpos.reset()
else
call g:Fpos.save(a:is_vmode)
end
let &gcr = save_gcr
return 'norm! '. (a:is_vmode ? visualmode() : ''). v:count1. a:bind. c
endfunction
"}}}
"=============================================================================
"KeyMappings:
let mapleader = '\'
let maplocalleader = '\\'
noremap [space] <nop>
nmap <Space> [space]
nmap <C-k> [C-k]
map @ [@]
"--------------------------------------
"No operation
"誤爆防止
nnoremap ZZ <Nop>
nnoremap q <Nop>
nnoremap <C-q> <Nop>
"noremap m <Nop>
noremap! <S-Up> _
"インサートモードで間違って出してほしくないキー
noremap <F15> <Nop>
noremap! <F15> <Nop>
noremap <F16> <Nop>
noremap! <F16> <Nop>
noremap! <S-F16> <Nop>
inoremap <M-j> <Nop>
"--------------------------------------
"インサートモードでの削除コマンドにundoを有効化させる
inoremap <expr><C-h> pumvisible() ? "\<C-h>" : "\<C-g>u\<C-h>"
inoremap <C-u> <C-g>u<C-u>
"inoremap <c-w> <c-g>u<c-w>
"--------------------------------------
"参照操作
cnoremap <F1> <C-u>h function-list<CR>
nnoremap <expr><F1> v:count==1 ? ":\<C-u>h :command-completion-custom\<CR>" : v:count==2 ? ":\<C-u>h complete-functions\<CR>" : ":\<C-u>h function-list\<CR>"
nnoremap <C-h> :<C-u>h<Space>
cnoremap <expr><C-h> getcmdtype()==':' ? getcmdpos()==1 ? 'h ' : "\<C-h>" : "\<C-h>"
cnoremap <expr><C-e> getcmdtype()==':' ? getcmdline()=~'^\s*$\\|^h $' ? "<C-u>ec " : "\<C-e>" : "\<C-e>"
"--------------------------------------
"クリップボード
noremap ,y "*y
nnoremap <silent>,yu :<C-u>let @* = @"<CR>
noremap ,Y "*y$
noremap ,p "*p
noremap ,P "*P
noremap <F3> "+
inoremap <C-r><C-y> <C-r>+
"cnoremap <C-r><C-y> <C-r>=substitute(@+, '\n$', '', 'g')<CR>
vnoremap <C-c> "+y
vnoremap <C-y> "+y
snoremap <C-c> <C-c>a
vnoremap <expr><C-v> mode()=="\<C-v>" ? "\<Esc>\"+p" : "\<C-v>"
"レジスタ
exe 'nnoremap '. s:bind.reg. ' "'
exe 'nnoremap '. s:bind.reg. '+ "+'
exe 'vnoremap '. s:bind.reg. ' "'
exe 'vnoremap '. s:bind.reg. '+ "+'
"--------------------------------------
"Sticky Keys
"nmap <expr> ,; <SID>sticky_func()
"omap <expr> ; <SID>sticky_func()
"xmap <expr> ; <SID>sticky_func()
"nnoremap .. .
"nnoremap z.. z.
exe 'map <expr> '. s:bind.sticky ' <SID>sticky_func()'
exe 'nmap <expr> g'. s:bind.sticky ' "g". <SID>sticky_func()'
exe 'nmap <expr> z'. s:bind.sticky ' "z". <SID>sticky_func()'
exe 'map <expr> ,'. s:bind.sticky ' ",". <SID>sticky_func()'
exe 'map <expr> "'. s:bind.sticky ' "\"". <SID>sticky_func()'
exe 'omap <expr> i'. s:bind.sticky ' "i". <SID>sticky_func()'
exe 'omap <expr> a'. s:bind.sticky ' "a". <SID>sticky_func()'
exe 'xmap <expr> i'. s:bind.sticky ' "i". <SID>sticky_func()'
exe 'xmap <expr> a'. s:bind.sticky ' "a". <SID>sticky_func()'
function! s:sticky_func() "{{{
let l:sticky_table = { ',' : '<', '.' : '>', '/' : '?',
\'1' : '!', '2' : '"', '3' : '#', '4' : '$', '5' : '%', '6' : '&', '7' : "'", '8' : '(', '9' : ')', '0' : '_',
\ '-' : '=', '^' : '~', ';' : '+', ':' : '*', '[' : '{', ']' : '}', '@' : '`', '\' : '|'}
let l:special_table = {"\<ESC>" : "\<ESC>", "\<Space>" : "\<Space>", "\<CR>" : ";\<CR>"}
let key = nr2char(getchar())
if key =~ '\l'
return toupper(key)
elseif has_key(l:sticky_table, key)
return l:sticky_table[key]
elseif has_key(l:special_table, key)
return l:special_table[key]
else
return mode()=='n'? "\<Esc>" : ''
endif
endfunction
"}}}
"======================================
"Normal mode
map Y y$
nnoremap ; :
vnoremap ; :
nnoremap <silent># :<C-u>let @/ = '\C\<'.expand("<cword>").'\>'<Bar>call histadd('/', @/)<CR>
nnoremap [space]/ :<C-u>%s/
nnoremap j gj|nnoremap k gk
vnoremap <expr>j mode()==#'V' ? 'j' : 'gj'|vnoremap <expr>k mode()==#'V' ? 'k' : 'gk'
nnoremap <expr>l foldclosed('.') != -1 ? 'zo' : 'l'
nnoremap zq q
nnoremap z@ @
nnoremap : ;
nnoremap <silent>,w :<C-u>up<CR>
nnoremap ,qu :<C-u>qa<CR>
nnoremap ,7 :<C-u>se fenc=euc-jp<CR>
nnoremap ,8 :<C-u>se fenc=utf-8<CR>
nnoremap ,9 :<C-u>se fenc=cp932<CR>
nnoremap <silent>,0 :<C-u>let &ff = &ff=='dos' ? 'unix' : &ff=='unix' ? 'mac' : 'dos'<CR>
"Normal mode 編集
nnoremap guu gU
"Normal modeで挿入
nnoremap <silent><C-j> :<C-u>call append(foldclosedend('.')==-1 ? '.': foldclosedend('.'), repeat([''], v:count1))<Bar>exe 'norm!' v:count1. 'j'<CR>
nnoremap [C-k]<C-j> :i<CR><CR>.<CR>
"空白を挿入する
nnoremap [space]a a<Space><Esc>
"nnoremap <C-Space> a<Space><Esc>
nnoremap [space]i i<Space><Esc>
nnoremap [space]s i<Space><Esc>la<Space><Esc>h
"--------------------------------------
"Win/Buf Open/Close
exe 'nnoremap '. s:bind.win. 's <C-w>s'
exe 'nnoremap '. s:bind.win. 'v <C-w>v'
exe 'nnoremap '. s:bind.win. 'o <C-w>o'
exe 'nnoremap <silent> '. s:bind.win. 't :tab split<CR>'
nmap dv <SID>bd
nnoremap <SID>bd :bd<CR>
nmap dn <SID>KeepWinBd
nnoremap <silent><SID>KeepWinBd :KeepWinBd<CR>
"ウィンドウレイアウトを保持したままバッファを閉じる
com! KeepWinBd let save_bufnr= bufnr("%") |bnext |exe "bd ".save_bufnr |unlet save_bufnr
nmap dq <C-w>c
exe 'nnoremap '. s:bind.win. 'dd <C-w>c'
exe 'nnoremap '. s:bind.win. 'q <C-w>c'
"Window Layout
nnoremap ,0 <C-w>=
exe 'nnoremap '. s:bind.win. '0 <C-w>='
nnoremap ,\ <C-w>_
nnoremap <C-w>\ <C-w>_
exe 'nnoremap '. s:bind.win. '\ <C-w>_'
exe 'nnoremap '. s:bind.win. 'J <C-w>J'
exe 'nnoremap '. s:bind.win. 'K <C-w>K'
exe 'nnoremap '. s:bind.win. 'H <C-w>H'
exe 'nnoremap '. s:bind.win. 'L <C-w>L'
"ある窓を大きく開く
"nnoremap <silent>,0 :call <SID>enlarge_win(0)<CR>
nnoremap <silent>,1 :call <SID>enlarge_win(1)<CR>
nnoremap <silent>,2 :call <SID>enlarge_win(2)<CR>
nnoremap <silent>,3 :call <SID>enlarge_win(3)<CR>
nnoremap <silent>,4 :call <SID>enlarge_win(4)<CR>
nnoremap <silent>,5 :call <SID>enlarge_win(5)<CR>
nnoremap <silent>,6 :call <SID>enlarge_win(6)<CR>
function! s:enlarge_win(winnr) "{{{
let targetWinnr = a:winnr ? a:winnr : winnr()
let [save_winnr, save_wh, save_wiw] = [winnr(), &winheight, &winwidth]
set wh=20 wiw=20
exe targetWinnr. 'wincmd w'
exe 'wincmd ='
let [&wh, &wiw] = [save_wh, save_wiw]
exe save_winnr. 'wincmd w'
endfunction
"}}}
"指定した番号の窓を閉じる
nmap c1 <SID>close_remotewin1
nmap c2 <SID>close_remotewin2
nmap c3 <SID>close_remotewin3
nmap c4 <SID>close_remotewin4
nmap c5 <SID>close_remotewin5
nmap c6 <SID>close_remotewin6
nmap d,t <SID>close_remotewin1
nmap d,z <SID>close_remotewin$
nmap d,1 <SID>close_remotewin1
nmap d,2 <SID>close_remotewin2
nmap d,3 <SID>close_remotewin3
nmap d,4 <SID>close_remotewin4
nmap d,5 <SID>close_remotewin5
nmap d,6 <SID>close_remotewin6
nmap mdt <SID>close_remotewin1
nmap mdz <SID>close_remotewin$
nmap md1 <SID>close_remotewin1
nmap md2 <SID>close_remotewin2
nmap md3 <SID>close_remotewin3
nmap md4 <SID>close_remotewin4
nmap md5 <SID>close_remotewin5
nmap md6 <SID>close_remotewin6
nnoremap <SID>close_remotewin$ :call <SID>close_remotewin(winnr('$'))<CR>
nnoremap <SID>close_remotewin1 :call <SID>close_remotewin(1)<CR>
nnoremap <SID>close_remotewin2 :call <SID>close_remotewin(2)<CR>
nnoremap <SID>close_remotewin3 :call <SID>close_remotewin(3)<CR>
nnoremap <SID>close_remotewin4 :call <SID>close_remotewin(4)<CR>
nnoremap <SID>close_remotewin5 :call <SID>close_remotewin(5)<CR>
nnoremap <SID>close_remotewin6 :call <SID>close_remotewin(6)<CR>
function! s:close_remotewin(winnr)
let save_winnr = winnr()
if a:winnr < save_winnr
let save_winnr -= 1
endif
exe a:winnr. 'wincmd w'
hide
exe save_winnr. 'wincmd w'
endfunction
"Specialwin Open/Close
nnoremap <silent><SID>close_whole_specialwins :call <SID>close_whole_specialwins(['&previewwindow'], ['quickfix'], ['unite'])<CR>
nmap cq <SID>close_whole_specialwins
nmap d,q <SID>close_whole_specialwins
function! s:close_whole_specialwins(options, buftypes, filetypes) "{{{
let save_winnr = winnr()
let closable_winnrs = []
windo if !(index(map(a:options, 'eval(v:val)'), 1)==-1 && index(a:buftypes, &bt)==-1 && index(a:filetypes, &ft)==-1) | call add(closable_winnrs, winnr()) | endif
for winnr in reverse(closable_winnrs)
if winnr < save_winnr
let save_winnr -= 1
endif
exe winnr. 'wincmd w'
hide
endfor
exe save_winnr. 'wincmd w'
endfunction
"}}}
function! s:closewin_remote(should_close) "{{{
if !a:should_close
return
endif
let winnr = winnr()
hide
return winnr
endfunction "}}}
function! s:_get_ajusted_savewinnr(save_winnr, killedwinnr_list) "{{{
let save_winnr = a:save_winnr
for killedwinnr in reverse(a:killedwinnr_list)
if killedwinnr == 0
continue
elseif killedwinnr < save_winnr
let save_winnr -= 1
endif
endfor
return save_winnr
endfunction
"}}}
"Tabpage Open/Close
noremap <SID>tabc :tabc<CR>
nmap <silent>dy <SID>tabc
nmap <silent>du <SID>tabc
nnoremap <silent> myo :tabonly<CR>
nnoremap <silent> myv :tabe $VIM/.vimrc<CR>
nnoremap <silent> my] :execute "tab tag ".expand('<cword>')<CR>|"カーソルドタグを新規タブページで開く
nnoremap <silent> myK :execute "tab help ".expand('<cword>')<CR>|"カーソルドワードを新規タブページで:helpする
"--------------------------------------
"Buf Switching
nnoremap <silent> [space]h :bp<CR>
nnoremap <silent> [space]l :bn<CR>
"Win Switching
nnoremap [space]n gt
nnoremap [space]p gT
"noremap <S-C-i> gt
nnoremap