scriptencoding utf-8 "========================================================== " 汎用スクリプト "========================================================== " {{{ " :autocmd is listed in |:bar| {{{ augroup my_vimrc autocmd! augroup END command! -bang -nargs=* \ MyAutocmd \ autocmd my_vimrc " }}} function! s:mkdir(dir) if !isdirectory(a:dir) call mkdir(a:dir, "p") endif endfunction " シンタックス情報の取得 " https://raw.github.com/cohama/.vim/master/.vimrc function! GetSyntaxID(transparent) let synid = synID(line("."), col("."), 1) if a:transparent return synIDtrans(synid) else return synid endif endfunction function! GetSyntaxAttr(synid) let name = synIDattr(a:synid, "name") let ctermfg = synIDattr(a:synid, "fg", "cterm") let ctermbg = synIDattr(a:synid, "bg", "cterm") let guifg = synIDattr(a:synid, "fg", "gui") let guibg = synIDattr(a:synid, "bg", "gui") return { \ "name": name, \ "ctermfg": ctermfg, \ "ctermbg": ctermbg, \ "guifg": guifg, \ "guibg": guibg} endfunction function! GetSyntaxInfo() let baseSyn = GetSyntaxAttr(GetSyntaxID(0)) echo "name: " . baseSyn.name . \ " ctermfg: " . baseSyn.ctermfg . \ " ctermbg: " . baseSyn.ctermbg . \ " guifg: " . baseSyn.guifg . \ " guibg: " . baseSyn.guibg let linkedSyn = GetSyntaxAttr(GetSyntaxID(1)) echo "link to" echo "name: " . linkedSyn.name . \ " ctermfg: " . linkedSyn.ctermfg . \ " ctermbg: " . linkedSyn.ctermbg . \ " guifg: " . linkedSyn.guifg . \ " guibg: " . linkedSyn.guibg endfunction command! SyntaxInfo call GetSyntaxInfo() " }}} "========================================================== " スクリプトの初期値 "========================================================== " {{{ let s:is_starting = has('vim_starting') let s:is_windows = has("gui_win32") let s:vimrc = expand(":p") " }}} "========================================================== " 外部ファイルの読み込み "========================================================== " {{{ let g:no_vimrc_example = 0 source :h/scripts/kaoriya.vim unlet! g:skip_loading_mswin source $VIMRUNTIME/mswin.vim let g:skip_loading_mswin = 0 " ノーマルモードでは元のキーマッピングを利用する nnoremap nnoremap nnoremap nnoremap silent! unmap " }}} "========================================================== " 初期設定 "========================================================== " {{{ " ユーザ名 if !exists("$VIMUSERNAME") let $VIMUSERNAME=$USERNAME endif let $VIMLOCALUSER=$VIMUSER."/local/".$VIMUSERNAME call s:mkdir($VIMLOCALUSER) " }}} "========================================================== " 環境変数 "========================================================== " {{{ if s:is_starting " VIM データ let $VIMHOME=$VIMUSER."/.vim" "vimfiles let $VIMFILES=$VIMUSER."/vimfiles" " ユーザローカル let $VIMUSERLOCAL=$VIMUSER."/".$VIMUSERNAME "ソースディレクトリ let $SOURCE_ROOT=$WORK_ROOT."/software/src" " development let $DEVELOPMENT=$WORK_ROOT."/software/development" "c++ のテストディレクトリ let $TEST_CPP=$SOURCE_ROOT."/test/cpp" let $TEST_BOOST=$TEST_CPP."/boost" " vim のテストディレクトリ let $TEST_VIM=$SOURCE_ROOT."/test/vim" " vim plugin ディレクトリ let $VIMPLUGIN=$VIMUSER."/runtime/bundle" let $BOOST_ROOT=$BOOST_LATEST_ROOT let $BOOST_BUILD_PATH=$BOOST_ROOT."/tools/build/v2" let $CLANG_SDK=$LLVM_SDK.'/tools/clang' let $LLVM_BIN=$LLVM_ROOT."/bin" " Vim で使用する bin の path " let $PATH=$PATH.";".$HOME."/bin" endif " }}} "========================================================== " 基本的な設定 "========================================================== " {{{ "shell のパスを設定 if s:is_windows set shell=C:\WINDOWS\system32\cmd.exe endif "バックアップファイルを作るディレクトリ set backupdir=$HOME/.cache/vimbackup call s:mkdir(&backupdir) " undo ファイルを保存するディレクトリ set undodir=$HOME/vimundo call s:mkdir(&undodir) set undofile "ファイル保存の初期ディレクトリをバッファファイル位置に設定 set browsedir=buffer "スワップファイル用のディレクトリ set directory=$HOME/.cache/vimbackup call s:mkdir(&directory) " Windows set splitbelow " 横分割したら新しいウィンドウは下に set splitright " 縦分割したら新しいウィンドウは右に " 常に開いているファイルと同じディレクトリをカレントディレクトリにする " http://www15.ocn.ne.jp/~tusr/vim/vim_text2.html#mozTocId567011 " MyAutocmd BufEnter * if file_readable(expand("%:p")) | execute ":lcd " expand("%:p:h") |endif " MyAutocmd BufEnter * execute ":lcd " . (isdirectory(expand("%:p:h")) ? expand("%:p:h") : "") " Undo 回数の設定 (デフォルト = 1000) set undolevels=5000 " バッファを切り替えても、undo を効くように設定 " (変更をセーブせずにバッファを切り替えたいときにも、 :set hidden は役に立つが、 " 変更に気づかないまま":qa! "するという危険も伴う、諸刃の剣) set hidden " indent eol start を超えて、 を有効にする set backspace=indent,eol,start set iminsert=0 " インサートモードで日本語入力を ON にしない set imsearch=0 " 検索モードで日本語入力を ON にしない set noimdisable " で英字も増減させる set nrformats=alpha,hex " 折り返しを無効にする set textwidth=0 " いくりめんたるさーち set incsearch " コマンド履歴 set history=10000 " スペルチェックから日本語を除外 set spelllang+=cjk " 折りたたまない set nofoldenable " :help W11 set autoread silent! set regexpengine=1 let g:omni_sql_no_default_maps = 1 " 補完入力中に関連のメッセージを表示しないようにする " e.g. 1 番目の該当 (全該当 2 個中) set shortmess+=c "========================================================== "ビジュアルの設定 "========================================================== " {{{ " 常にカーソル位置を中心に " set scrolloff=999 " 行間のピクセル数 set linespace=2 "タブ文字、改行文字を表示 set list "改行、タブ文字の設定 " set listchars=tab:^\ ,trail:-,eol:\ set listchars=tab:^-,trail:- "行番号を表示 set number "閉じカッコが入力されたとき、対応するカッコを表示する " set showmatch " 括弧を入力した時にカーソルが移動しないように設定 set matchtime=0 " タブページのラベルを常に表示する set showtabline=2 " ツールバーを削除 set guioptions+=M set guioptions-=T let g:did_install_default_menus = 1 "メニューを削除 set guioptions-=m " スクロールバーを削除 set guioptions-=r set guioptions-=L "チラツキ防止 set completeopt=menuone " バッファを閉じる時にバッファリストから削除 " autocmd BufReadPre * setlocal bufhidden=delete " ウィンドウのリサイズを抑える set noequalalways " スクロール時に前後の行を空ける set scrolloff=8 " 数値の左に余白 set numberwidth=4 " wrap 時に2行目以降もインデントする if exists("+breakindent") set breakindent let &showbreak = '> ' endif " set foldmethod=marker " 1行が長い場合に重いのを回避する " http://blog.kaihatsubu.com/?p=1713 " 幅 " set synmaxcol=460 set synmaxcol=2000 " set synmaxcol=350 " ウィンドウの最後の行を出来る限り表示する set display=lastline " Ambiguous な文字の幅を 2 にする set ambiwidth=double " Workaround " http://qiita.com/amagawawaw/items/4a46d08f6c3e456e18d0 if has("Mac") set imdisable MyAutocmd InsertEnter * set imdisable " let g:mapleader = "¥" endif " }}} "========================================================== "コーディング "========================================================== " {{{ "新しい行のインデントを同じ行にする set autoindent " filetype plugin indent on set nocindent " 改行時にコメントしない set formatoptions-=ro set formatoptions+=j MyAutocmd FileType * setlocal formatoptions-=ro MyAutocmd CursorHold * setlocal formatoptions-=ro " 桁が長くても自動補完するようにする MyAutocmd InsertEnter * setlocal formatoptions-=c "クリップボードをWindowsと連携 if has("unnamedplus") set clipboard=unnamedplus else set clipboard=unnamed endif "タブ文字の長さ set tabstop=4 set shiftwidth=4 " ファイルを読み込んだり書き込んだりする時に使われる を設定 set fileformat=unix set fileformats=unix,dos set maxfuncdepth=1000 set noimdisable " v:oldfiles で保存するファイル数を設定 " vimrc に書いておく必要がある set viminfo+='10000 set viminfo-='100 " デフォルトの設定を削除しておかないと反映されない " 検索をキャンセルした場合に前回の検索ワードをハイライトしない cnoremap getcmdtype() == '/' ? "\:nohlsearch\" : "\" " }}} "================================== "文字コード "================================== " {{{ " 改行コードが unix でなければ unix にする function! s:set_fileformat() if !filereadable(expand("%:p")) setlocal fileformat=unix return endif if &fileformat != "unix" \ && !get(b:, "set_fileformat_checked", 0) \ && (empty(readfile(expand("%:p"))) || input("setlocal fileformat=unix?[y/n]") == "y") try setlocal fileformat=unix catch endtry endif let b:set_fileformat_checked = 1 endfunction MyAutocmd BufWritePre * :call set_fileformat() set encoding=utf-8 set fileencodings=ucs-bom,utf-8,cp932,sjis "========================================================== " pathogen "========================================================== " {{{ " runtimepath の初期化 if s:is_starting "vim plugin の読み込み let $BUNDLE_ROOT=$VIMUSER."/runtime/bundle" set runtimepath+=$BUNDLE_ROOT/vim-pathogen call pathogen#infect($BUNDLE_ROOT . "/{}") endif " }}} "========================================================== " neobundle "========================================================== " {{{ let s:neobundle_root = $HOME."/neobundle" filetype off filetype plugin indent off " required! call neobundle#begin(expand($HOME."/neobundle")) source :h/plugins/bundles.vim let g:neobundle#log_filename = $HOME . "/neobundle.log" filetype plugin indent on call neobundle#end() syntax enable " }}} "========================================================== " キーマッピング "========================================================== " {{{ " 雑多 {{{ " スペースを挿入 nnoremap i " C-@ の誤爆防止 inoremap " 検索のハイライトを消す nnoremap :nohlsearch " カーソル位置の上に改行を挿入 " カーソル位置のテキストを下に動かすような挙動 nnoremap :call append(line(".")-1, "") " カーソル位置の上の行を削除 " カーソル位置を上に動かすような挙動 nnoremap dd " カーソル位置を基準として開業する nnoremap i nnoremap i " }}} " https://sites.google.com/site/fudist/Home/vim-nihongo-ban/tips#TOC-4 " カーソルを表示行で移動する。物理行移動は, nnoremap j gj nnoremap k gk vnoremap j gj vnoremap k gk nnoremap gj nnoremap gk " カーソルキーで行末/行頭の移動可能に設定。 set whichwrap=b,s,[,],<,> nnoremap h nnoremap l " l を に置き換えて、折りたたみを l で開くことができるようにする。 if has('folding') nnoremap l foldlevel(line('.')) ? "\zo" : "\" endif " 検索後画面の中心に。 nnoremap n nzzzv nnoremap N Nzzzv " 縦に連番を入力する nnoremap co :ContinuousNumber vnoremap co :ContinuousNumber function! s:continuous_number(count, key) let c = col('.') for n in range(1, a:count ? a:count - line('.') : 1) exec 'normal! j' . n . a:key call cursor('.', c) endfor endfunction command! -range -nargs=1 ContinuousNumber call s:continuous_number(, ) " command! -count -nargs=1 ContinuousNumber let c = col('.')|for n in range(1, ?-line('.'):1)|exec 'normal! j' . n . |call cursor('.', c)|endfor " 最後の編集位置へ戻る " https://sites.google.com/site/fudist/Home/vim-nihongo-ban/tips#TOC-12 map gb `.zz nnoremap g;zz nnoremap g; g, " インデントを連続で出来るように設定 " nnoremap > >> " nnoremap < << vnoremap > >gv vnoremap < / :keeppatterns s/\\/\//g:nohlsearch nnoremap / :keeppatterns s/\\/\//g:nohlsearch " タブの移動 nnoremap :tabnext nnoremap :tabprevious nnoremap :tabnext " で改行した場合にインデントをスペースで揃える " inoremap :set expandtaba :set noexpandtaba " Y を y$ の変わりに使う nmap Yl y$ nmap YL y$ nmap yl y$ " カーソル位置から行末までを削除 nnoremap Dl D$ nnoremap dl D$ " カーソル位置から行末までを編集 nnoremap Cl c$ nnoremap cl c$ " フォントサイズを変更するマッピングを変更 nnoremap - nnoremap + " タブページの移動 command! -bar TabMoveNext :execute "tabmove " tabpagenr() % tabpagenr("$") + (tabpagenr("$") == tabpagenr() ? 0 : 1) command! -bar TabMovePrev :execute "tabmove" (tabpagenr() + tabpagenr("$") - 2) % tabpagenr("$") + (tabpagenr() == 1 ? 1 : 0) nnoremap :TabMoveNext nnoremap :TabMovePrev " nnoremap :TabMoveNext " nnoremap :TabMovePrev " ウィンドウを分割してから検索 nnoremap _ / " 検索する度にハイライトする " nnoremap / :set hlsearch/ nmap q [q] noremap [q]: q: noremap [q]/ q/ nnoremap q " 選択して zc で折りたたむ vnoremap zc zf " 検索時に / をエスケープ cnoremap / getcmdtype() == '/' ? '\/' : '/' cnoremap ? getcmdtype() == '?' ? '\?' : '?' " 最後に選択したテキストをOperator-pending modeで使用可能に onoremap gv :normal! gv " Insert mode中で単語単位/行単位の削除をアンドゥ可能にする inoremap u inoremap u " 最後にインクルードした位置へ移動する nnoremap ii :execute "?".&include :noh o " 連続してペースト出来るようにするため " vnoremap p "0p " spell をトグル nnoremap ss :setlocal spell! " カーソル位置を移動しない nnoremap J mzJ`z " " 誤爆防止 " inoremap " textobj の再マップ " onoremap l $ onoremap $ " onoremap h ^ onoremap ^ onoremap t " 最後に変更したテキストの範囲 nnoremap gc '[v'] vnoremap gc :normal gc onoremap gc :normal gc " 新しいタブを開く nnoremap tt :tabnew " カーソル移動 inoremap " SQLUFormatter " 余計なキーマッピングがされているので無効化 nnoremap :SQLUFormatter " 選択した範囲を jq コマンドを使ってフォーマッティングする " 範囲選択しない場合は現在の行を対象とする command! -range JSONFormatter :,!jq . " 現在開いているファイルのパスをコピーする nnoremap cp :call setreg(v:register, expand("%:p")) " }}} "========================================================== " autocmd "========================================================== " {{{ command! \ -bar -nargs=1 \ Nop \ command! -bar -bang -nargs=* : MyAutocmd FileType cpp setlocal comments-=:\/\/ MyAutocmd BufReadPost *.scala set filetype=scala MyAutocmd BufNewFile,BufReadPost *.pug set filetype=pug " 前回終了したカーソル行に移動 MyAutocmd BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal g`\"" | endif " Aliases let g:markdown_syntax_conceal = 0 MyAutocmd FileType mkd set filetype=markdown MyAutocmd FileType md set filetype=markdown MyAutocmd FileType js set filetype=javascript MyAutocmd FileType ts set filetype=typescript MyAutocmd FileType hs set filetype=haskell MyAutocmd FileType c++ set filetype=cpp MyAutocmd FileType py set filetype=python MyAutocmd FileType pl set filetype=perl MyAutocmd FileType rb set filetype=ruby MyAutocmd FileType scm set filetype=scheme MyAutocmd BufReadPost *.ruby set filetype=ruby MyAutocmd BufReadPost *.pryrc.local set filetype=ruby MyAutocmd CmdwinEnter * nnoremap q c " プラグイン開発時の g:loaded_xxx を無効に if neobundle#is_installed("neosnippet") MyAutocmd SourcePre */plugin/*.vim unlet! g:loaded_{substitute(matchstr(neosnippet#util#expand('%:p:r'), '/plugin/\zs.*$'), '/', '_', 'g')} endif " コマンドラインウィンドウの無駄な行を削除 " 20個までしか出さない MyAutocmd CmdwinEnter * :silent! 1,$-20 delete _ | call cursor("$", 1) " MyAutocmd CmdwinEnter * silent execute printf("1,%ddelete _", min([&history - 20, line("$") - 20])) | call cursor("$", 1) " /usr/local/share/vim/vim82/vimrc_example.vim:42 で textwidth を設定しているのでそれを上書きする MyAutocmd FileType text setlocal textwidth=0 " }}} "========================================================== " command "========================================================== " {{{ " エンコーディング指定オープン {{{ command! -bang -bar -complete=file -nargs=? Cp932 edit ++encoding=cp932 command! -bang -bar -complete=file -nargs=? Eucjp edit ++encoding=euc-jp command! -bang -bar -complete=file -nargs=? Jis edit ++encoding=iso-2022-jp command! -bang -bar -complete=file -nargs=? Utf8 edit ++encoding=utf-8 command! -bang -bar -complete=file -nargs=? Dos edit ++fileformat=dos command! -bang -bar -complete=file -nargs=? Mac edit ++fileformat=mac command! -bang -bar -complete=file -nargs=? Unix edit ++fileformat=unix " }}} " カーソル下のハイライト名を出力 {{{ " by yomi322 vimrc command! -bar EchoHighlight echo synIDattr(synID(line('.'),col('.'),0),'name') synIDattr(synIDtrans(synID(line('.'),col('.'),1)),'name') " }}} " see http://vim-users.jp/2009/05/hack17/ command! -nargs=1 -complete=file Rename file | call delete(expand('#')) " メッセージのクリア command! MessageClear message clear " }}} "========================================================== " Vim scirpt "========================================================== " source :h/auto_tweet.vim " Hack #125: 矩形選択で自由に移動する {{{ " http://vim-users.jp/2010/02/hack125/ set virtualedit+=block " バッファの削除 {{{ function! s:delete_hide_buffer() let list = filter(range(1, bufnr("$")), "bufexists(v:val) && !buflisted(v:val)") for v in list execute "bw ".v endfor endfunction command! -bar DeleteHideBuffer :call s:delete_hide_buffer() function! s:delete_no_file_buffer() let list = filter(range(1, bufnr("$")), \ 'bufexists(v:val) && !filereadable(expand("#".v:val.":p"))' \ ) for v in list execute "bw ".v endfor endfunction command! -bar DeleteNoFileBuffer :call s:delete_no_file_buffer() " }}} " 各 filetype ごとの設定ファイル {{{ " after/ftplugin/{&filetype}.vim ファイルを開く " ディレクトリは各環境にあわせて let $AFTER_FTPLUGIN = $NEOBUNDLE_ORIGIN."/after/after/ftplugin" nnoremap :execute ":tab drop ".$AFTER_FTPLUGIN."/".&filetype.".vim" " }}} nnoremap ns :execute "tabnew\|:NeoSnippetEdit ".&filetype " }}} nnoremap gw gf nnoremap gf gf " }}} " スワップファイルの削除 {{{ function! s:remove_swapfile() let target = &directory let list = split(glob(target."**/*.*.sw{p,o}"), '\n') echo "remove" for file in list echo file call delete(file) endfor endfunction command! RemoveSwapfile :call remove_swapfile() " }}} " 改行コードを unix にする {{{ " https://twitter.com/ShougoMatsu/status/179558102847336449 " https://twitter.com/ShougoMatsu/status/179557789599924224 command! -bang -complete=file -nargs=? WUnix write ++fileformat=unix | edit " }}} " vital.import {{{ function! Vital_import(target, libname, ...) let plugin_name = get(a:, "1", "vital") if !has_key(a:target, plugin_name) let a:target[plugin_name] = vital#of(plugin_name) endif let vital = a:target[plugin_name] let libname = substitute(a:libname, '\.', '_', "g") if !has_key(a:target, libname) let a:target[libname] = vital.import(a:libname) call extend(a:target, a:target[libname]) endif endfunction " }}} " }}} "========================================================== " プラグインの設定 "========================================================== " {{{ " neobundle.vim {{{ let s:hooks = neobundle#get_hooks("neobundle.vim") function! s:hooks.on_source(bundle) let g:neobundle#install_process_timeout=600 endfunction unlet s:hooks " 呼び出し function! s:vimshell_opened_tabpage() return filter(range(1, tabpagenr("$")), "type(gettabvar(v:val, 'vimshell')) == type({})") endfunction function! s:vimshell_tabopen(...) let vimshell_tabs = filter(range(1, tabpagenr("$")), "type(gettabvar(v:val, 'vimshell')) == type({})") if empty(vimshell_tabs) execute "VimShellTab" get(a:, 1, "") return endif let tabpagenr = vimshell_tabs[0] execute "tabnext" tabpagenr endfunction " nnoremap vs :call vimshell_tabopen() nnoremap vs :execute "VimShellTab -create ".expand("%:p:h") nnoremap vss :execute "VimShellPop -create ".expand("%:p:h") nnoremap vsi :VimShellInteractive --split='split \| resize 12' " }}} " vimshell {{{ let s:bundle = neobundle#get("vimshell.vim") let s:bundle.hooks = get(s:bundle, "hooks", {}) function! s:bundle.hooks.on_source(bundle) let g:vimshell_enable_start_insert = 1 let g:vimshell_split_command = "split" let g:vimshell_interactive_update_time = 0 let g:vimshell_scrollback_limit = 100000 let g:vimshell_data_directory = expand("~/.vim/vimshell") let g:vimshell_max_command_history = 10000 " 表示形式 let g:vimshell_user_prompt = 'substitute(fnamemodify(getcwd(), ":~"), "\\", "/", "g")' let g:vimshell_user_prompt = "" let g:vimshell_prompt = '$ ' let s:leave_insert_patterns = '\%(' . join(map([ \ '^git status', \ '^git push', \ '^git pull', \ '^git submodule add', \ '^foreman start', \ '^bundle exec foreman start', \ 'middleman server', \ 'middleman deploy', \], '''\%('' . v:val . ''\)'''), '\|') . '\)' function! LeaveInsert_in_vimshell(args, context) if a:args =~ s:leave_insert_patterns call feedkeys("\", "n") endif endfunction MyAutocmd FileType vimshell \ call vimshell#hook#add('preexec', 'leave_insert', "LeaveInsert_in_vimshell") endfunction unlet s:bundle " }}} " ref.vim {{{ nnoremap ra :Ref webdict aaaaa nnoremap rc :Ref webdict codic let s:bundle = neobundle#get("vim-ref") let s:bundle.hooks = get(s:bundle, "hooks", {}) function! s:bundle.hooks.on_source(bundle) let g:ref_use_vimproc = 0 " let g:ref_open="tabnew" let lynx = g:lynx_dir.'/lynx.exe' let lynx = g:lynx_dir.'lynx' let cfg = g:lynx_dir.'/lynx.cfg' let cfg = g:lynx_dir.'' let g:ref_alc_cmd = lynx . ' -dump -nonumbers %s' let g:ref_alc_use_cache = 1 let g:ref_alc_start_linenumber = 39 " 余計な行を読み飛ばす let g:ref_alc_encoding = 'Shift-JIS' if exists('*ref#register_detection') " filetypeが分からんならalc call ref#register_detection('_', 'alc') endif " let g:ref_lynx_cmd = lynx.' -cfg='.cfg.' -dump %s' let g:ref_lynx_cmd = g:ref_alc_cmd let g:ref_lynx_use_cache = 1 let g:ref_lynx_encoding = 'Shift-JIS' let g:ref_lynx_start_linenumber = 0 " 余計な行を読み飛ばす let g:ref_source_webdict_cmd = lynx . ' -dump -nonumbers %s' let g:ref_source_webdict_sites = { \ 'wikipedia:ja': 'http://ja.wikipedia.org/wiki/%s', \ 'aaaaa': { \ "url" : 'http://eow.alc.co.jp/search?q=%s', \ "line" : '66', \ }, \ 'codic': { \ 'url': 'http://codic.jp/search?q=%s', \ 'keyword_encoding': 'utf-8', \ 'cache': 1 \ } \ } function g:ref_source_webdict_sites.codic.filter(output) return join( split(a:output, "\n")[15 :], "\n" ) endfunction endfunction unlet s:bundle " }}} " qfixhowm {{{ let QFixHowm_Key = 'g' " let howm_dir = $HOWM let howm_dir = $VIMFILES."/howm" let howm_filename = '%Y/%m/%Y-%m-%d-%H%M%S.howm' let howm_fileencoding = 'utf-8' let howm_fileformat = 'unix' let g:qfixmemo_use_keyword = 0 " let howm_fileformat = 'dos' let QFix_PreviewEnable = 0 let QFix_CursorLine = 0 let g:unite_qfixhowm_new_memo_cmd = "tabnew" let g:qfixmemo_calendar = 0 let g:calendar_howm_syntax = 0 function! s:clear_autocmd_qfix() augroup QFix au! augroup END endfunction MyAutocmd VimEnter * call s:clear_autocmd_qfix() " }}} " reanimate.vim {{{ let s:bundle = neobundle#get("vim-reanimate") let s:bundle.hooks = get(s:bundle, "hooks", {}) function! s:bundle.hooks.on_source(bundle) let g:reanimate_save_dir = $VIMLOCALUSER."/_vim/save_point" let g:reanimate_default_save_name = "latest" let g:reanimate_sessionoptions="curdir,folds,help,localoptions,slash,tabpages,winsize" " let g:reanimate_sessionoptions="tabpages,winsize" let g:reanimate_event_disables = { \ "_" : { \ "reanimate_confirm" : 1, \ "reanimate_viminfo" : 1, \ }, \ "default_category/test" : { \ "reanimate_window" : 1, \ }, \ "session/.*" : { \ "reanimate_window" : 1, \ }, \ "test2" : { \ "reanimate_.*" : 1, \ }, \} " ユーザで hook する event let s:event = { \ "name" : "user_event", \} " function! s:event.load_pre(...) function! s:event.load_pre_post(...) " 読み込み前に全てのバッファを保存 wall " 復元前にタブを削除する tabnew DeleteNoActiveBuffers tabonly " スワップファイルの削除 RemoveSwapfile endfunction function! s:event.save_pre(...) " 保存前に args を削除する try argd * DeleteNoActiveBuffers catch endtry endfunction call reanimate#hook(s:event) unlet s:event " let s:event = { \ "name" : "vimfiler", \} " function! s:event.load_pre(...) function! s:event.load(...) " let dir = a:context.path " if filereadable(dir."/vimfiler.vim") " execute "source ".dir."/vimfiler.vim" " endif endfunction function! s:event.save(...) " echom "reanimate saved" " let dir = a:context.path " if !filereadable(dir.'/vimwinpos.vim') || filewritable(dir.'/vimwinpos.vim') " if has("gui") " let options = [ " \ 'set columns=' . &columns, " \ 'set lines=' . &lines, " \ 'winpos ' . getwinposx() . ' ' . getwinposy(), " \ ] " call writefile(options, dir.'/vimwinpos.vim') " endif " endif " let context = getbufvar(bufnr, 'vimfiler').context " let context.create = 1 " call add(append, printf( " \ 'call vimfiler#switch_filer(%s, %s)', " \ string(context.path), string(context))) endfunction call reanimate#hook(s:event) unlet s:event function! Last_point() return reanimate#is_saved() ? matchstr(reanimate#last_point(), '.*/\zs.*') : "no save" endfunction MyAutocmd VimLeavePre * ReanimateSave " MyAutocmd CursorHold * ReanimateSaveCursorHold " MyAutocmd User ReunionsTimer8000 :ReanimateSaveCursorHold let g:reanimate_vimrc_local_filename = "vimrc_local" endfunction unlet s:bundle " }}} " kaoriya {{{ """""""""""""""""""""""""""""" "Kaoriya版に添付されているプラグインの無効化 "問題があるものもあるので一律に無効化します。 "ファイルを参照(コメント部分で gf を実行)した上で、必要なプラグインは "let plugin_..._disableの設定行をコメント化(削除)して有効にして下さい。 """""""""""""""""""""""""""""" " "$VIM/plugins/kaoriya/autodate.vim let plugin_autodate_disable = 1 " "$VIM/plugins/kaoriya/cmdex.vim let plugin_cmdex_disable = 1 " "$VIM/plugins/kaoriya/dicwin.vim let plugin_dicwin_disable = 1 " "$VIMRUNTIME/plugin/format.vim " let plugin_format_disable = 1 " "$VIM/plugins/kaoriya/hz_ja.vim let plugin_hz_ja_disable = 1 " "$VIM/plugins/kaoriya/scrnmode.vim let plugin_scrnmode_disable = 1 " "$VIM/plugins/kaoriya/verifyenc.vim " let plugin_verifyenc_disable = 1 " }}} " EasyMotion {{{ " let g:EasyMotion_leader_key = 'e' let s:bundle = neobundle#get("vim-easymotion") let s:bundle.hooks = get(s:bundle, "hooks", {}) function! s:bundle.hooks.on_source(bundle) let EasyMotion_do_mapping = 0 map ff (easymotion-bd-w) "let g:EasyMotion_leader_key = '' highlight EasyMotionTarget2Second term=bold ctermfg=2 gui=bold guifg=#2aa198 endfunction unlet s:bundle " }}} " caw.vim {{{ " コメントアウトする nmap c (caw:zeropos:toggle) vmap c (caw:zeropos:toggle) " コメントアウトを解除する nmap C (caw:i:uncomment) vmap C (caw:i:uncomment) nmap cp p`[v`](caw:i:comment) " コメントアウトをトグルする nmap (operator-caw-I-toggle) \ operator#exec_command#mapexpr_v_keymapping("\(caw:zeropos:toggle)") nmap (operator-caw-I-uncomment) \ operator#exec_command#mapexpr_v_keymapping("\(caw:I:uncomment))") nmap c (operator-caw-I-toggle)ii nmap C (operator-caw-I-uncomment)ii nmap gcy yyp(caw:I:toggle)k vmap gcy ygvgcIP " vim-quickhl {{{ nmap m (quickhl-manual-this) xmap m (quickhl-manual-this) nmap M (quickhl-manual-reset) xmap M (quickhl-manual-reset) let g:quickhl_cword_enable_at_startup = 0 " }}} " restart.vim {{{ let g:restart_sessionoptions = 'blank,buffers,winpos,winsize,curdir,folds,help,localoptions,tabpages,winsize' nnoremap res :Restart " }}} " OpenBrowser {{{ command! OpenBrowserCurrentDir execute "OpenBrowser" "file:///" . expand('%:p:h') nnoremap ecd :OpenBrowserCurrentDir nmap op (openbrowser-smart-search) command! OpenBrowserCurrent execute "OpenBrowser" expand("%:p") let s:bundle = neobundle#get("open-browser.vim") let s:bundle.hooks = get(s:bundle, "hooks", {}) function! s:bundle.hooks.on_source(bundle) let g:openbrowser_open_filepath_in_vim = 0 endfunction unlet s:bundle " }}} " TweetVim{{{ " ポスト " nnoremap tp :execute "TweetVimSwitchAccount manga_osyo" \| TweetVimSay " nnoremap ttp :execute "TweetVimSwitchAccount osyo_manga" \| TweetVimSay " nnoremap TT :execute "TweetVimSwitchAccount pink_bangbi" \| TweetVimSay nnoremap TT :execute "TweetVimSwitchAccount black_bangbi" \| TweetVimSay let g:tweetvim_display_icon = 1 " let g:tweetvim_default_account = "osyo_memo" " let g:tweetvim_default_account = "manga_osyo" " let g:tweetvim_default_account = "osyo_manga" let g:tweetvim_say_open_cmd = "botright" let g:tweetvim_async_post = 1 let g:tweetvim_silent_say = 1 let g:tweetvim_debug=0 " }}} " vimfiler {{{ let s:bundle = neobundle#get("vimfiler.vim") let s:bundle.hooks = get(s:bundle, "hooks", {}) function! s:bundle.hooks.on_source(bundle) let g:vimfiler_safe_mode_by_default=0 let g:unite_kind_file_use_trashbox = 1 let g:vimfiler_as_default_explorer = 1 let g:vimfiler_split_rule="botright" let g:vimfiler_force_overwrite_statusline = 0 let g:vimfiler_enable_auto_cd = 1 let g:vimfiler_ignore_pattern = "" let g:vimfiler_restore_alternate_file = 0 endfunction unlet s:bundle command! -nargs=* MyFiler execute "Defx -buffer-name=defx-buffer-" . tabpagenr() . " " . expand() . " " . "-search=" . expand('%:p') " command! -nargs=* MyFiler tabnew | VimFiler nnoremap vfvf :MyFiler $VIMFILES nnoremap vftc :MyFiler $TEST_CPP nnoremap vftb :MyFiler $TEST_BOOST nnoremap vftv :MyFiler $TEST_VIM nnoremap vfvp :MyFiler $VIMPLUGIN nnoremap vf :MyFiler command! VFE VimFilerExplorer -buffer-name=explorer -direction=botright -winwidth=24 -project nnoremap vfe :VFE " }}} " neocomplete.vim {{{ let s:bundle = neobundle#get("neocomplete.vim") let s:bundle.hooks = get(s:bundle, "hooks", {}) function! s:bundle.hooks.on_source(bundle) return let g:neocomplete#enable_at_startup = 1 let g:neocomplete#enable_ignore_case = 0 let g:neocomplete#enable_smart_case = 0 let g:neocomplete#skip_auto_completion_time = "" let g:neocomplete#max_list = 1000 let g:neocomplete#force_overwrite_completefunc = 1 let g:neocomplete#max_keyword_width = 300 let g:marching_enable_neocomplete = 1 let config = { \ 'cpp' : '\s*[a-zA-z_()<>]\+\d*\%(\.\|->\)\|::', \ 'jsx' : '\.', \ 'cs' : '[^.[:digit:] *\t]\.', \ 'python' : '[^. \t]\.\w*', \ } call extend(g:neocomplete#force_omni_input_patterns, config) unlet config let g:jedi#completions_enabled = 0 let g:jedi#auto_vim_configuration = 0 call extend(g:neocomplete#sources#omni#input_patterns, { \ 'python' : '[^. \t]\.\w*', \ }) let g:neocomplete#enable_fuzzy_completion = 0 call neocomplete#custom#source('_', 'matchers', ['matcher_head']) call neocomplete#custom#source('_', 'converters', []) call neocomplete#custom#source('include', \ 'disabled_filetypes', {'_' : 1}) call neocomplete#custom#source('tag', \ 'disabled_filetypes', {'_' : 1}) inoremap neocomplete#undo_completion() inoremap neocomplete#smart_close_popup()."\" inoremap neocomplete#close_popup() inoremap neocomplete#cancel_popup() let g:neocomplete#text_mode_filetypes = { "_" : 1 } call neocomplete#custom#source("look", "min_pattern_length", 10) inoremap neocomplete#start_manual_complete("look") return endfunction unlet s:bundle " }}} " ddc.nvim {{{ let s:bundle = neobundle#get("ddc.vim") let s:bundle.hooks = get(s:bundle, "hooks", {}) function! s:bundle.hooks.on_source(bundle) execute "source" fnamemodify(s:vimrc, ":h")."/plugins/ddc.vim" " ddc.vimの機能を有効にする call ddc#enable() endfunction unlet s:bundle " }}} " deoplete.nvim {{{ let s:bundle = neobundle#get("deoplete.nvim") let s:bundle.hooks = get(s:bundle, "hooks", {}) function! s:bundle.hooks.on_source(bundle) let g:deoplete#enable_at_startup = 1 if has("Mac") call deoplete#custom#option('num_processes', 1) endif " call deoplete#mappings#manual_complete() " call deoplete#custom#option('profile', v:true) call deoplete#enable_logging('DEBUG', expand('~/vim-deoplete.log')) " let $NVIM_PYTHON_LOG_FILE="/tmp/nvim_log" " let $NVIM_PYTHON_LOG_LEVEL="DEBUG" " call deoplete#custom#source("vimshell_history", "sorters", ["sorter_word"]) " call deoplete#custom#option('omni_patterns', { " \ 'ruby': ['[a-zA-Z_]\w*::'], " \}) " call deoplete#custom#var('omni', 'input_patterns', { " \ 'ruby': [], " \}) " call deoplete#custom#var('omni', 'input_patterns', { " \ 'ruby': ['[a-zA-Z_]\w*::'], " \}) call deoplete#custom#var('omni', 'input_patterns', { \ 'ruby': ['[^. *\t]\.\w*', '[a-zA-Z_]\w*::'], \}) call deoplete#custom#option('nofile_complete_filetypes', ["denite-filter", "scrapbox", "vimshell"]) endfunction unlet s:bundle " }}} " neosnippets {{{ let s:bundle = neobundle#get("neosnippet") let s:bundle.hooks = get(s:bundle, "hooks", {}) function! s:bundle.hooks.on_source(bundle) "スニペットのディレクトリ let g:neosnippet#snippets_directory=$VIMUSER.'/snippets' " スニペットを無効 " \ "vim" : 1 let g:neosnippet#disable_runtime_snippets = { \ "cpp" : 1 \} "でスニペット補完 imap neosnippet#expandable() neosnippet#jumpable() ? "\(neosnippet_jump_or_expand)" : pumvisible() ? "\" : "\" " imap neosnippet#expandable_or_jumpable() ? "\(neosnippet_expand_or_jump)" : pumvisible() ? "\" : "\" " スニペットで単語が選択されている場合でも で次のプレースホルダへ移動する smap neosnippet#expandable() neosnippet#jumpable() ? "\(neosnippet_jump_or_expand)" : "\" MyAutocmd InsertLeave * NeoSnippetClearMarkers " 選択している時に抜けてもマーカーを消す snoremap :NeoSnippetClearMarkers MyAutocmd InsertLeave * syntax clear neosnippetConcealExpandSnippets let g:neosnippet#scope_aliases = {} let g:neosnippet#scope_aliases['ruby'] = 'ruby,ruby-rails,ruby-rspec' endfunction unlet s:bundle " }}} " unite.vim {{{ " キーマッピング {{{ " nnoremap ufm :Unite frill " nnoremap uff :Unite file file/new -hide-source-names nnoremap unb :Unite neobundle nnoremap umes :Unite messages -wrap nnoremap uqh :Unite qfixhowm/new qfixhowm:nocache -hide-source-names -truncate nnoremap ll :Unite menu:shortcut -hide-source-names " }}} " 使わないデフォルト Unite ソースをロードしない let g:loaded_unite_source_bookmark = 1 command! -nargs=* -complete=customlist,unite#complete#source \ Messages \ Unite messages -wrap -direction=botright -log -buffer-name=messages let s:bundle = neobundle#get("unite.vim") let s:bundle.hooks = get(s:bundle, "hooks", {}) function! s:bundle.hooks.on_source(bundle) execute "source" fnamemodify(s:vimrc, ":h")."/plugins/unite.vim" " unite-shortcut {{{ if !exists("g:unite_source_menu_menus") let g:unite_source_menu_menus = {} endif let g:unite_source_menu_menus.shortcut = { \ "description" : "shortcut" \} let g:unite_source_menu_menus.shortcut.candidates = [ \ [ "vimrc" , s:vimrc ], \ [ "test vimrc", $WORK_ROOT."/vim/vimrcs/test/vimrc" ], \ [ "bundles", fnamemodify(s:vimrc, ":h")."/bundles.vim" ], \ [ "local vimrc", $VIMLOCALUSER."/vimrc" ], \ [ "quickrun", fnamemodify(s:vimrc, ":h")."/quickrun.vim" ], \ [ "unite", fnamemodify(s:vimrc, ":h")."/unite.vim" ], \ [ "lexima", fnamemodify(s:vimrc, ":h")."/lexima.vim" ], \ [ "neobundle.log", g:neobundle#log_filename ], \ [ "Blog Edit", "OpenBrowser http://d.hatena.ne.jp/osyo-manga/edit" ], \ [ "Blog Edit2", "OpenBrowser http://www.blogger.com/blogger.g?blogID=1095434617350591309#editor" ], \ [ "Blog Edit3", "OpenBrowser http://secret-garden.hatenablog.com/#edit" ], \ [ "ideone", "OpenBrowser http://ideone.com/" ], \ [ "wandbox", "OpenBrowser http://melpon.org/wandbox/" ], \ [ "Vim Advent Calendar 2013", "OpenBrowser http://atnd.org/events/45072" ], \ [ "neobundles", s:neobundle_root ], \ [ "original plugin", $NEOBUNDLE_ORIGIN ], \ [ "boost", $BOOST_LATEST_ROOT ], \ [ "AllMap", "Unite output:AllMap" ], \ [ "Unite Beautiful Attack", "Unite -auto-preview colorscheme" ], \ [ "Boost.MPL Ref", "OpenBrowser http://www.boost.org/doc/libs/release/libs/mpl/doc/refmanual/refmanual_toc.html" ], \] function! g:unite_source_menu_menus.shortcut.map(key, value) let [word, value] = a:value if isdirectory(value) return { \ "word" : "[directory] ".word, \ "kind" : "directory", \ "action__directory" : value, \ "action__path" : value \ } elseif !empty(glob(value)) return { \ "word" : "[file] ".word, \ "kind" : "file", \ "default_action" : "tabdrop", \ "action__path" : value, \ } else return { \ "word" : "[command] ".word, \ "kind" : "command", \ "action__command" : value \ } endif endfunction " }}} " loading autoload function if neobundle#is_installed("vim-airline") call airline#add_statusline_func("airline#extensions#unite#apply") endif let g:airline#extensions#anzu#enabled = 1 endfunction unlet s:bundle " }}} " neobundle {{{ command! -nargs=0 -bar NeoBundleUpdateInstalled \ execute 'NeoBundleUpdate' \ join(map(filter(neobundle#config#get_neobundles(), 'isdirectory(v:val.path)'), 'v:val.name')) " }}} " hier.vim {{{ highlight hier_warning gui=undercurl guisp=blue let g:hier_highlight_group_qfw = "hier_warning" highlight hier_warning gui=undercurl guisp=Blue let g:hier_highlight_group_qfw = "hier_warning" " }}} " quickrun {{{ let s:bundle = neobundle#get("vim-quickrun") let s:bundle.hooks = get(s:bundle, "hooks", {}) function! s:bundle.hooks.on_source(bundle) " execute "source" fnamemodify(s:vimrc, ":h")."/plugins/quickrun.old.vim" execute "source" fnamemodify(s:vimrc, ":h")."/plugins/quickrun.vim" command! UniteQuickRunConfig :Unite quickrun_config -buffer-name=quickrun_config endfunction unlet s:bundle nnoremap r :QuickRun nnoremap R :execute ":QuickRun ".get(GetNowQuickrunConfig(), "subtype", "")." -hook/close_buffer/enable_exit 0" nnoremap :QuickRun -hook/run_prevconfig/enable 1 nnoremap qr :UniteQuickRunConfig " }}} " watchdogs {{{ let s:bundle = neobundle#get("vim-watchdogs") let s:bundle.hooks = get(s:bundle, "hooks", {}) function! s:bundle.hooks.on_post_source(bundle) " 無 endfunction unlet s:bundle " }}} " anzu {{{ let s:bundle = neobundle#get("vim-anzu") let s:bundle.hooks = get(s:bundle, "hooks", {}) function! s:bundle.hooks.on_source(bundle) " nmap n (anzu-n-with-echo)(anzu-smart-sign-matchline) " nmap N (anzu-N-with-echo)(anzu-smart-sign-matchline) " nmap n (anzu-n-with-echo)zvzz " nmap N (anzu-N-with-echo)zvzz " nmap * (anzu-star-with-echo) " nmap # (anzu-sharp-with-echo) " nmap * (anzu-star-with-echo)(anzu-smart-sign-matchline) " nmap # (anzu-sharp-with-echo)(anzu-smart-sign-matchline) " " nmap n (anzu-n-with-echo) " nmap N (anzu-N-with-echo) " nmap * (anzu-star-with-echo) " nmap # (anzu-sharp-with-echo) " nmap * (anzu-star)N " nmap # (anzu-sharp)n nmap * (asterisk-z*)(anzu-mode) nmap # (asterisk-z#)(anzu-mode) vmap * (asterisk-z*)(anzu-mode) nnoremap n anzu#mode#mapexpr("n", "", "zzzv") nnoremap N anzu#mode#mapexpr("N", "", "zzzv") let g:anzu_status_format = "%p(%i/%l) %w" let g:anzu_enable_CursorHold_AnzuUpdateSearchStatus = 0 let g:airline#extensions#default#section_truncate_width = { \ 'b': 40, \ 'y': 40, \ } MyAutocmd BufLeave * AnzuClearSearchStatus endfunction unlet s:bundle " }}} " vim-operator-replace {{{ " nmap s (operator-replace) " vmap s (operator-replace) let s:bundle = neobundle#get("vim-operator-replace") let s:bundle.hooks = get(s:bundle, "hooks", {}) function! s:bundle.hooks.on_source(bundle) endfunction unlet s:bundle omap ip (textobj-parameter-i) omap ap (textobj-parameter-a) vmap ip (textobj-parameter-i) vmap ap (textobj-parameter-a) " omap af (textobj-between-a) " omap if (textobj-between-i) " vmap af (textobj-between-a) " vmap if (textobj-between-i) omap iF (textobj-function-i) omap aF (textobj-function-a) vmap iF (textobj-function-i) vmap aF (textobj-function-a) omap ab (textobj-multiblock-a) omap ib (textobj-multiblock-i) vmap ab (textobj-multiblock-a) vmap ib (textobj-multiblock-i) " omap ib (textobj-multitextobj-i) " vmap ib (textobj-multitextobj-i) " omap ab (textobj-multitextobj-a) " vmap ab (textobj-multitextobj-a) omap im (textobj-multitextobj-i) vmap im (textobj-multitextobj-i) omap am (textobj-multitextobj-a) vmap am (textobj-multitextobj-a) omap is (textobj-multitextobj-i) vmap is (textobj-multitextobj-i) omap as (textobj-multitextobj-a) vmap as (textobj-multitextobj-a) " omap ic (textobj-context-i) " vmap ic (textobj-context-i) let g:textobj#multiblock#default_blocks = [] let g:textobj#multiblock#enable_block_in_cursor = 0 let g:textobj_multiblock_blocks = [ \ [ '(', ')' ], \ [ '[', ']' ], \ [ '{', '}' ], \ [ '<', '>', 1 ], \ [ '"', '"', 1 ], \ [ "'", "'", 1 ], \ [ "|", "|", 1 ], \ [ "`", "`", 1 ], \ [ "「", "」" ], \ [ "(", ")" ], \] let g:textobj_multitextobj_textobjects_i = [ \ "\(textobj-enclosedsyntax-i)", \ "\(textobj-url-i)", \ "\(textobj-multiblock-i)", \ "\(textobj-ruby-any-i)", \ "\(textobj-function-i)", \ "\(textobj-entire-i)", \] let g:textobj_multitextobj_textobjects_a = [ \ "\(textobj-enclosedsyntax-a)", \ "\(textobj-url-a)", \ "\(textobj-multiblock-a)", \ "\(textobj-ruby-any-i)", \ "\(textobj-function-a)", \ "\(textobj-entire-a)", \] let g:textobj_multitextobj_textobjects_group_i = { \ "A" : [ \ "\(textobj-url-i)", \ "\(textobj-wiw-i)", \ "iw", \ ], \ "B" : [ \ "\(textobj-multiblock-i)", \ "\(textobj-function-i)", \ "\(textobj-indent-i)", \ ], \ "region" : [ \ "\(textobj-multiblock-i)", \ "\(textobj-indent-i)", \ "\(textobj-function-i)", \ ] \} let g:textobj_multitextobj_textobjects_group_a = { \ "region" : [ \ "\(textobj-multiblock-a)", \ "\(textobj-indent-a)", \ "\(textobj-function-a)", \ ] \} map (textobj-word-i) (textobj-multitextobj-A-i) map (textobj-smartblock-i) (textobj-multitextobj-B-i) " map (textobj-word-i) (textobj-multitextobj-A-i) " omap imw (textobj-word-i) " vmap imw (textobj-word-i) " }}} " columnjump {{{ let s:bundle = neobundle#get("columnjump") let s:bundle.hooks = get(s:bundle, "hooks", {}) function! s:bundle.hooks.on_source(bundle) nmap (columnjump-backward) nmap (columnjump-forward) endfunction unlet s:bundle " }}} " context_filetype.vim {{{ let s:bundle = neobundle#get("context_filetype.vim") let s:bundle.hooks = get(s:bundle, "hooks", {}) function! s:bundle.hooks.on_source(bundle) let g:context_filetype#filetypes = { \ "howm_memo" : [ \ { "start" : '^>|\(\h\w*\)|$', 'end' : '^||<$', "filetype" : '\1'}, \ ] + context_filetype#default_filetypes().markdown, \ "rd" : [ \ { "start" : '^#@samplecode .*$', 'end' : '^#@end$', "filetype" : 'ruby'}, \ ], \ 'markdown': [ \ { \ 'start' : '^\s*```\s*\(\h\w*\).*$', \ 'end' : '^\s*```$', 'filetype' : '\1', \ }, \ ], \ } endfunction unlet s:bundle " }}} " precious.vim {{{ nmap q (precious-quickrun-op) " omap ip (textobj-precious-i) " vmap ip (textobj-precious-i) let g:textobj_precious_no_default_key_mappings = 0 let s:bundle = neobundle#get("vim-precious") let s:bundle.hooks = get(s:bundle, "hooks", {}) function! s:bundle.hooks.on_source(bundle) MyAutocmd User PreciousFiletypeLeave_vim iunmap MyAutocmd User PreciousFiletypeLeave_vim nunmap r MyAutocmd InsertEnter * :PreciousSwitch let g:precious_enable_switchers = { \ "vimshell" : { \ "setfiletype" : 0 \ } \ } let g:precious_enable_switch_CursorMoved = { \ "help" : 0 \ } " let g:precious_enable_switch_CursorMoved_i = { " \ "help" : 0 " \ } let g:precious_enable_switch_CursorMoved = { \ "*" : 0 \ } " MyAutocmd CursorHold * PreciousSwitchAutcmd " コンテキストが切り替わった時にその filetype を表示 endfunction unlet s:bundle " }}} " jplus {{{ let s:bundle = neobundle#get("vim-jplus") let s:bundle.hooks = get(s:bundle, "hooks", {}) function! s:bundle.hooks.on_source(bundle) " nmap J (jplus-input) vmap J (jplus-input) nmap J (jplus-getchar) vmap J (jplus-getchar) nmap (jplus-getchar) vmap (jplus-getchar) nmap J (jplus) vmap J (jplus) let g:jplus#input_config = { \ "__DEFAULT__" : { \ "delimiter_format" : " %d " \ }, \ "__EMPTY__" : { \ "delimiter" : "", \ "delimiter_format" : "%d" \ }, \ ")" : { \ "delimiter" : "", \ "delimiter_format" : "%d" \ }, \ "," : { \ "delimiter_format" : "%d " \ }, \ ";" : { \ "delimiter_format" : "%d " \ }, \ "_" : { \ "delimiter_format" : "%d" \ } \ } endfunction unlet s:bundle " }}} " vim-milfeulle {{{ let s:bundle = neobundle#get("vim-milfeulle") let s:bundle.hooks = get(s:bundle, "hooks", {}) function! s:bundle.hooks.on_source(bundle) return " nmap (milfeulle-prev)zz nmap (milfeulle-prev)zz nmap (milfeulle-next)zz " nmap n (anzu-n)(milfeulle-overlay) " nmap N (anzu-N)(milfeulle-overlay) " " nmap n (anzu-mode-n) " nmap N (anzu-mode-N) nnoremap n anzu#mode#mapexpr("n", "", "zzzv") nnoremap N anzu#mode#mapexpr("N", "", "zzzv") " nmap n n(milfeulle-overlay) " nmap N N(milfeulle-overlay) let g:milfeulle_default_jumper_name = "win_tab_bufnr_pos_line" let g:milfeulle_enable_CursorHold = 0 " MyAutocmd User ReunionsTimer2000 :MilfeulleOverlay endfunction unlet s:bundle " }}} " vim-airline {{{ let s:bundle = neobundle#get("vim-airline") let s:bundle.hooks = get(s:bundle, "hooks", {}) function! s:bundle.hooks.on_source(bundle) let g:airline_theme='bubblegum' let g:airline_theme='monochrome' let g:airline_theme='kolor' let g:airline#extensions#whitespace#checks = [] let g:airline#extensions#anzu#enabled = 1 let g:airline#extensions#hunks#enabled = 0 let g:airline#extensions#branch#enabled = 1 endfunction unlet s:bundle " }}} " vim-frill {{{ command! FrillRefresh call frill#refresh_file("file") let s:bundle = neobundle#get("vim-frill") let s:bundle.hooks = get(s:bundle, "hooks", {}) function! s:bundle.hooks.on_source(bundle) let g:frill_root_env = "$WORK_ROOT" let g:frill_data_dir = $VIMLOCALUSER . "/.vim/.frill" let g:frill_data_sizes = { \ "file_short" : 300, \ } MyAutocmd BufEnter * \ if &buftype !=# 'help' \| call frill#add_file("file_short", expand("")) \| endif MyAutocmd FocusLost * call frill#save_all() endfunction unlet s:bundle " }}} " vim-textobj-user {{{ let s:hooks = neobundle#get_hooks("vim-textobj-user") function! s:hooks.on_source(bundle) " 無 endfunction unlet s:hooks " }}} " vim-operator-exec_command {{{ let s:hooks = neobundle#get_hooks("vim-operator-exec_command") function! s:hooks.on_source(bundle) nmap S operator#exec_command#mapexpr_gn("\(operator-stay-cursor-replace)", 0, { "stay_cursor" : 1 }) nmap Si<> operator#exec_command#mapexpr_gn("\(operator-replace)", 0, { "stay_cursor" : 1, "search_register_format" : '%t' }) . "i\" nmap C operator#exec_command#mapexpr_gn("c", 1) nmap Ci<> operator#exec_command#mapexpr_gn("c", 1, {"search_register_format" : '%t' }) . "i\" endfunction unlet s:hooks " }}} " vim-marching {{{ let s:hooks = neobundle#get_hooks("vim-marching") function! s:hooks.on_source(bundle) let g:marching_clang_command = "clang++-5.0" let g:marching_enable_refresh_always = 0 let g:marching_clang_command_option = "-std=gnu++1y" " let g:marching#clang_command#options = { " \ "cpp" : "-std=gnu++1y -include-pch /home/worker/build/cpp/pch/header.h.pch" " \ } let g:marching#clang_command#options = { "cpp" : "-std=gnu++1y" } let g:marching#default_config = { \ "ignore_pat" : '^_\D' \} let g:marching_debug = 1 endfunction unlet s:hooks " }}} " vim-altercmd {{{ let s:hooks = neobundle#get_hooks("vim-altercmd") function! s:hooks.on_post_source(bundle) if exists(":Messages") AlterCommand mes Messages AlterCommand Mes mes endif endfunction unlet s:hooks " }}} " vim-over {{{ nnoremap : :OverCommandLine vnoremap : :OverCommandLine let s:hooks = neobundle#get_hooks("vim-over") function! s:hooks.on_post_source(bundle) nnoremap %s :OverCommandLine%s/ vnoremap %s :OverCommandLines/ nnoremap s :OverCommandLine%s/ vnoremap s :OverCommandLines/ xnoremap re y:OverCommandLine%s/=substitute(@0, '/', '\\/', 'g')//gI OverCommandLineNoremap (over-cmdline-scroll-e) OverCommandLineNoremap (over-cmdline-scroll-y) OverCommandLineNoremap (over-cmdline-scroll-u) OverCommandLineNoremap (over-cmdline-scroll-d) let g:over#debug_vital_over = 0 call over#load() endfunction unlet s:hooks " }}} " vim-stargate {{{ let s:hooks = neobundle#get_hooks("vim-stargate") function! s:hooks.on_source(bundle) let g:stargate#use_cache = 1 endfunction unlet s:hooks " }}} " vim-wandbox {{{ let s:hooks = neobundle#get_hooks("wandbox-vim") function! s:hooks.on_source(bundle) let g:wandbox#default_compiler = { \ '-' : 'clang-head', \ 'cpp' : 'clang-head', \ 'ruby' : 'ruby-2.5.1', \ } let g:wandbox#default_options = { \ 'c' : 'c11', \ 'cpp' : 'warning,c++1z,boost-1.64,sprout', \ } let g:wandbox#default_extra_options = { \ "clang-head" : "-fno-color-diagnostics" \ } let g:wandbox#disable_python_client = 1 endfunction unlet s:hooks " }}} " vim-snowdrop {{{ let s:hooks = neobundle#get_hooks("vim-snowdrop") function! s:hooks.on_source(bundle) let g:snowdrop#goto_definition_open_cmd = "Tabdrop" let g:snowdrop#command_options = { \ "cpp" : "-std=c++1y -Wall -Wunreachable-code", \} let g:snowdrop#command_options = { \ "cpp" : "-std=gnu++1y -include-pch /home/worker/build/cpp/pch/header.h.pch -Wall -Wunreachable-code", \} let g:snowdrop#command_options = { "cpp" : "-std=gnu++1y", } let g:snowdrop#libclang#default_binding = "python_interpreter" let g:snowdrop#libclang#default_binding = "python" " let g:snowdrop#debug#enable = 1 " let g:marching_backend = "snowdrop" endfunction unlet s:hooks " }}} " vim-gitgutter {{{ let s:hooks = neobundle#get_hooks("vim-gitgutter") function! s:hooks.post_source(bundle) autocmd! gitgutter CursorHold,CursorHoldI let g:gitgutter_map_keys = 0 let g:gitgutter_escape_grep = 1 let g:gitgutter_eager = 1 endfunction unlet s:hooks " }}} " vim-operator-jump_side {{{ let s:hooks = neobundle#get_hooks("vim-operator-jump_side") function! s:hooks.on_source(bundle) nmap h (operator-jump-head) nmap l (operator-jump-tail) nmap (operator-jump-toggle) endfunction unlet s:hooks " }}} " vim-choosewin {{{ let s:hooks = neobundle#get_hooks("vim-choosewin") function! s:hooks.on_source(bundle) let g:choosewin_blink_on_land = 0 let g:choosewin_return_on_single_win = 1 function! s:choosewin_is_ignore_window(action, winnr) if a:action ==# "open" return index(["unite", "vimfiler", "vimshell"], getbufvar(winbufnr(a:winnr), "&filetype")) >= 0 else return 0 endif endfunction let g:Unite_kinds_choosewin_is_ignore_window_func = function("s:choosewin_is_ignore_window") endfunction unlet s:hooks " }}} " vim-textobj-multitextobj {{{ let s:hooks = neobundle#get_hooks("vim-textobj-multitextobj") function! s:hooks.on_source(bundle) " omap imw textobj#multitextobj#mapexpr_i("region") " vmap imw textobj#multitextobj#mapexpr_i("region") " omap amw textobj#multitextobj#mapexpr_a("region") " vmap amw textobj#multitextobj#mapexpr_a("region") endfunction unlet s:hooks " }}} " vim-operator-surround {{{ " let operator#surround#input_block_in_advance = 0 nmap sa (operator-surround-append) nmap sr (operator-surround-replace) nmap sd (operator-surround-delete) nmap sdd (operator-surround-delete)(textobj-multiblock-a) nmap srr (operator-surround-replace)(textobj-multiblock-a) " sr( でカーソル左右の " を削除する nmap sr( (operator-surround-replace)(textobj-multiblock-a)( nmap sr[ (operator-surround-replace)(textobj-multiblock-a)[ nmap sr" (operator-surround-replace)(textobj-multiblock-a)" nmap sr' (operator-surround-replace)(textobj-multiblock-a)' nmap sr{ (operator-surround-replace)(textobj-multiblock-a){ nmap sr< (operator-surround-replace)(textobj-multiblock-a)< " s( で textobj を () で囲む nmap sa (operator-surround-append-input-in-advance) nmap s( (operator-surround-append-input-in-advance)( nmap sb (operator-surround-append-input-in-advance)( nmap s{ (operator-surround-append-input-in-advance){ nmap s[ (operator-surround-append-input-in-advance)[ nmap s" (operator-surround-append-input-in-advance)" nmap s' (operator-surround-append-input-in-advance)' nmap s` (operator-surround-append-input-in-advance)` nmap s(( (operator-surround-append-input-in-advance)(iw nmap sb (operator-surround-append-input-in-advance)(iw nmap s{} (operator-surround-append-input-in-advance){iw nmap s{{ (operator-surround-append-input-in-advance){iw nmap s[] (operator-surround-append-input-in-advance)[iw nmap s[[ (operator-surround-append-input-in-advance)[iw nmap s"" (operator-surround-append-input-in-advance)"iw nmap s'' (operator-surround-append-input-in-advance)'iw nmap s`` (operator-surround-append-input-in-advance)`iw let s:hooks = neobundle#get_hooks("vim-operator-surround") function! s:hooks.on_source(bundle) endfunction unlet s:hooks " }}} " " vim-textobj-blockwise.vim {{{ vmap l mode() == "\" && v:count >= 1 ? textobj#blockwise#mapexpr("l") : "l" vmap h mode() == "\" && v:count >= 1 ? textobj#blockwise#mapexpr("h") : "h" let s:hooks = neobundle#get_hooks("vim-textobj-blockwise") function! s:hooks.on_source(bundle) endfunction unlet s:hooks " }}} " vim-operator-blockwise.vim {{{ nmap YY (operator-blockwise-yank-head) nmap DD (operator-blockwise-delete-head) nmap CC (operator-blockwise-change-head) nmap SS operator#blockwise#mapexpr_head("\(operator-replace)") " vmap l mode() == "\" ? textobj#blockwise#mapexpr_i("l") : "l" let s:hooks = neobundle#get_hooks("vim-operator-blockwise") function! s:hooks.on_source(bundle) endfunction unlet s:hooks " }}} " vim-operator-swap {{{ let s:hooks = neobundle#get_hooks("vim-operator-swap") function! s:hooks.on_source(bundle) nmap (operator-swap) " nmap (operator-swap-last-yank) nmap (operator-swap-marking) " nmap (operator-swap-paste) " omap (operator-swap-reset) " nmap (operator-swap-last-yank) endfunction unlet s:hooks " }}} " vim-operator-block {{{ nmap (operator-block-yank) nmap (operator-block-paste) nmap (operator-block-delete) nmap (operator-block-yank)axb " nmap (operator-block-yank)aysb nmap (operator-block-paste)iw nmap (operator-block-delete)axb " nmap (operator-block-delete)aysb let s:hooks = neobundle#get_hooks("vim-operator-block") function! s:hooks.on_source(bundle) endfunction unlet s:hooks " }}} " indentline {{{ let s:hooks = neobundle#get_hooks("indentLine") function! s:hooks.on_source(bundle) " let g:indentLine_color_term = 111 " let g:indentLine_color_gui = '#708090' " let g:indentLine_char = '¦' "use ¦, ┆ or │ let g:indentLine_noconcealcursor = 1 MyAutocmd BufEnter * IndentLinesReset MyAutocmd User PreciousFileType IndentLinesReset " MyAutocmd CursorHold * IndentLinesEnable endfunction unlet s:hooks " }}} " textmanip {{{ let s:hooks = neobundle#get_hooks("vim-textmanip") function! s:hooks.on_source(bundle) xmap (textmanip-move-down) xmap (textmanip-move-up) endfunction unlet s:hooks " }}} " vim-versions {{{ let s:hooks = neobundle#get_hooks("vim-versions") function! s:hooks.on_source(bundle) command! GitCommit execute "Unite versions/git/status:" . vital#of("vital").import("Prelude").path2project_directory(expand("%:p")) . " -default-action=commit" command! GitBranch execute "Unite versions/git/branch:" . vital#of("vital").import("Prelude").path2project_directory(expand("%:p")) . " -default-action=commit" command! GitDiff Unite versions/git/status endfunction unlet s:hooks " }}} " vim-textobj-from_regexp {{{ let s:hooks = neobundle#get_hooks("vim-textobj-from_regexp") function! s:hooks.on_source(bundle) omap i textobj#from_regexp#mapexpr('\w\+') xmap i textobj#from_regexp#mapexpr('\w\+') omap i textobj#from_regexp#mapexpr('[A-Za-z0-9]\+') xmap i textobj#from_regexp#mapexpr('[A-Za-z0-9]\+') omap ig textobj#from_regexp#mapexpr('\%V') xmap ig textobj#from_regexp#mapexpr('\%V') omap ik textobj#from_regexp#mapexpr('[[:keyword:].]\+') vmap ik textobj#from_regexp#mapexpr('[[:keyword:].]\+') endfunction unlet s:hooks " }}} " vim-operator-alignta {{{ nmap (operator-alignta) let s:hooks = neobundle#get_hooks("vim-operator-alignta") function! s:hooks.on_source(bundle) endfunction unlet s:hooks " }}} " qfixhowm {{{ let g:qfixmemo_default_keymap=0 " }}} " wildfire.vim {{{ let g:wildfire_fuel_map = "" let g:wildfire_water_map = "" let g:wildfire_objects = ["i'", 'i"', "i)", "i]", "i}", "ip", "it"] let s:hooks = neobundle#get_hooks("wildfire") function! s:hooks.on_source(bundle) endfunction unlet s:hooks " }}} " vim-expand-region {{{ let s:hooks = neobundle#get_hooks("vim-expand-region") function! s:hooks.on_source(bundle) nmap (expand_region_expand) nmap (expand_region_shrink) MyAutocmd CmdWinEnter * nnoremap let g:expand_region_text_objects = { \ "i'" : 0, \ 'i"' : 0, \ 'i)' : 0, \ 'i}' : 0, \ 'ip' : 0, \ 'it' : 0, \} endfunction unlet s:hooks " }}} " vim-from_regexp-xbrackets {{{ let s:hooks = neobundle#get_hooks("vim-textobj-xbrackets") function! s:hooks.on_source(bundle) let g:textobj_xbrackets_extra_iskeyword=':,.' if !exists("g:textobj_multitextobj_textobjects_group_a") let g:textobj_multitextobj_textobjects_group_a = {} endif let g:textobj_multitextobj_textobjects_group_a.xbracket = [ \ "aysb", \ "ays[", \ "ays{", \ ] omap av textobj#multitextobj#mapexpr_a("xbracket") vmap av textobj#multitextobj#mapexpr_a("xbracket") " omap av aysb " vmap av aysb endfunction unlet s:hooks " }}} " vim-gista {{{ let s:hooks = neobundle#get_hooks("vim-gista") function! s:hooks.on_source(bundle) let g:gista#github_user = 'osyo-manga' let g:gista#default_yank_method = 'url' let g:gista#auto_yank_after_post = 'url' let g:gista#suppress_not_owner_acwrite_info_message = 1 let g:gista#suppress_acwrite_info_message = 1 endfunction unlet s:hooks " }}} " vim-brightest {{{ let s:hooks = neobundle#get_hooks("vim-brightest") function! s:hooks.on_source(bundle) " let g:brightest_highlight_pattern = '[A-Za-z0-9]\+' " let g:brightest#highlight_format = '%s' " let g:brightest#highlight = { "group" : "BrightestUnderline" } " let g:brightest#highlight = { " \ "priority" : 10000 " \ } let g:brightest#pattern = '\k\+' " let g:brightest#ignore_syntax_list = [ "Statement", "Keyword" ] return let g:brightest#enable_on_CursorHold = 0 let g:brightest#enable_insert_mode = 0 let g:brightest#enable_highlight_all_window = 0 let g:brightest#enable_clear_highlight_on_CursorMoved = 0 " let g:brightest#enable_on_CursorHold = 1 " let g:brightest#enable_insert_mode = 1 " let g:brightest#enable_highlight_all_window = 1 " let g:brightest#enable_clear_highlight_on_CursorMoved = 0 endfunction unlet s:hooks " }}} " incsearch.vim {{{ let s:hooks = neobundle#get_hooks("incsearch.vim") function! s:hooks.on_post_source(bundle) " nmap / (incsearch-stay) " nmap / (incsearch-forward) nmap / (incsearch-forward) vmap / (incsearch-forward) nmap / (incsearch-forward) vmap / (incsearch-forward) " nmap / (incsearch-stay) " vmap / (incsearch-stay) IncSearchNoreMap (buffer-complete) IncSearchNoreMap (incsearch-next) IncSearchNoreMap (incsearch-prev) noremap incsearch#go({'pattern': histget('/', -1)}) endfunction unlet s:hooks " }}} " vim-monster {{{ let s:hooks = neobundle#get_hooks("vim-monster") function! s:hooks.on_post_source(bundle) let g:monster#completion#rcodetools#backend = "async_rct_complete" let g:monster#debug#enable = 1 endfunction unlet s:hooks " }}} " unite-vital-module {{{ command! UniteVitalize \ execute "Unite vital-module:" . vital#of("vital").import("Prelude").path2project_directory(expand("%")) let s:hooks = neobundle#get_hooks("unite-vital-module") function! s:hooks.on_source(bundle) endfunction unlet s:hooks " }}} " unite-vital-module {{{ let s:hooks = neobundle#get_hooks("vim-itunes-bgm") function! s:hooks.on_source(bundle) let g:itunes_bgm#default_itunes_api_request = { "limit" :200 } endfunction unlet s:hooks " }}} " vim-textobj-indent {{{ nmap <(textobj-indent-i) nmap >(textobj-indent-i) omap ii (textobj-indent-i) vmap ii (textobj-indent-i) omap ia (textobj-indent-a) vmap ia (textobj-indent-a) " }}} " vim-operator-stay-cursor {{{ let s:hooks = neobundle#get_hooks("vim-operator-stay-cursor") function! s:hooks.on_source(bundle) nmap y (operator-stay-cursor-yank) omap y (operator-stay-cursor-yank) map y (operator-stay-cursor-yank) nmap s (operator-stay-cursor-replace) nmap gu (operator-stay-cursor-gu) nmap gU (operator-stay-cursor-gU) endfunction unlet s:hooks " }}} " asterisk.vim {{{ let s:hooks = neobundle#get_hooks("vim-asterisk") function! s:hooks.on_source(bundle) " nmap ciw (asterisk-z*):nohlsearchcgn endfunction unlet s:hooks " }}} " hopping.vim {{{ let s:hooks = neobundle#get_hooks("vim-hopping") function! s:hooks.on_source(bundle) nmap / (hopping-start) vmap / (hopping-start) let g:hopping#keymapping = { \ "\" : "(hopping-next)", \ "\" : "(hopping-prev)", \ "\" : "(scroll-u)", \ "\" : "(scroll-d)", \ } let g:hopping#debug_vital = 0 let g:hopping#enable_migemo = 0 let g:hopping#prompt = "/" endfunction unlet s:hooks " }}} " vigemo.vim {{{ let s:hooks = neobundle#get_hooks("vim-vigemo") function! s:hooks.on_source(bundle) " nmap / (vigemo-search) " nmap ciw (asterisk-z*):nohlsearchcgn let g:unite#filters#matcher_vigemo#filtering_input_length = 3 endfunction unlet s:hooks " }}} " lexima.vim {{{ let s:hooks = neobundle#get_hooks("lexima.vim") function! s:hooks.on_source(bundle) execute "source" fnamemodify(s:vimrc, ":h")."/plugins/lexima.vim" " cunmap endfunction unlet s:hooks " }}} " trip.vim {{{ let s:hooks = neobundle#get_hooks("vim-trip") function! s:hooks.on_source(bundle) nmap (trip-increment) nmap (trip-decrement) endfunction unlet s:hooks " }}} " stripe.vim {{{ let s:hooks = neobundle#get_hooks("vim-stripe") function! s:hooks.on_source(bundle) MyAutocmd VimEnter * hi EvenLbg ctermbg=235 guibg=#090909 let g:stripe_config = { \ "group_odd" : "EvenLbg" \} endfunction unlet s:hooks " }}} " vim-operator-highlighter {{{ let s:hooks = neobundle#get_hooks("vim-operator-highlighter") function! s:hooks.on_source(bundle) let g:operator#highlighter#config = { "clear_time" : 1000 } noremap (yank) y noremap (yank-highlight) operator#sequence#map("\(operator-highlighter)", "\(yank)") " map y operator#stay_cursor#wrapper("\(yank-highlight)", { "noremap" : 0 }) nmap y operator#stay_cursor#wrapper("\(yank-highlight)", { "noremap" : 0 }) noremap s operator#sequence#map("\(operator-stay-cursor-replace)", "\(operator-highlighter)") endfunction unlet s:hooks " }}} " swindle.vim {{{ let s:hooks = neobundle#get_hooks("vim-swindle") function! s:hooks.on_source(bundle) set guitablabel=%{swindle#get_tablabel()} let g:swindle_default_config = { \ "ignore_pat" : "(vimfiler:default|defx)", \ } nmap (swindle-jump-next) nmap (swindle-jump-prev) nmap Q (swindle-close-buffer) endfunction unlet s:hooks " }}} " parenmatch.vim {{{ let s:hooks = neobundle#get_hooks("vim-parenmatch") function! s:hooks.on_source(bundle) highlight ParenMatch term=reverse ctermbg=11 guifg=#85EB6A guibg=#135B00 endfunction unlet s:hooks " }}} " tyru/empty-prompt.vim {{{ let s:hooks = neobundle#get_hooks("empty-prompt.vim") function! s:hooks.on_source(bundle) function! s:empty_prompt_mappings() abort call empty_prompt#map(#{lhs: ':', rhs: ":"}) call empty_prompt#map(#{lhs: '', rhs: "N"}) endfunction MyAutocmd VimEnter * ++once call s:empty_prompt_mappings() endfunction unlet s:hooks " }}} " vimfiler {{{ let s:bundle = neobundle#get("vim-clurin") let s:bundle.hooks = get(s:bundle, "hooks", {}) function! s:bundle.hooks.on_source(bundle) nmap (clurin-next) nmap (clurin-prev) function! g:CountUp(strs, cnt, def) abort " a:strs: matched text list " a:cnt: non zero. " a:def: definition return str2nr(a:strs[0]) + a:cnt endfunction function! g:CtrlAX(cnt) abort if a:cnt >= 0 execute 'normal!' a:cnt . "\" else execute 'normal!' (-a:cnt) . "\" endif endfunction let g:clurin = { \ '-': { \ 'def': [ \ [ \ {'pattern': '\', 'replace': 'true'}, \ {'pattern': '\', 'replace': 'false'}, \ ], \ [ \ 'on', 'off' \ ] \ ], \ 'nomatch': function('g:CtrlAX') \ }, \ 'vim': { \ 'def': [ \ [ \ {'pattern': '''\(\k\+\)''', 'replace': '''\1'''}, \ {'pattern': '"\(\k\+\)"', 'replace': '"\1"'}, \ ] \ ] \ }, \ 'ruby': { \ 'def': [ \ [ \ {'pattern': '\', 'replace': 'if'}, \ {'pattern': '\', 'replace': 'unless'}, \ ], \ [ \ {'pattern': '\', 'replace': 'puts'}, \ {'pattern': '\', 'replace': 'pp'}, \ ], \ ] \ }, \} endfunction unlet s:bundle " }}} " denite.nvim {{{ let s:hooks = neobundle#get_hooks("denite.nvim") function! s:hooks.on_post_source(bundle) execute "source" fnamemodify(s:vimrc, ":h")."/plugins/denite.vim" endfunction unlet s:hooks " }}} " defx.nvim {{{ let s:hooks = neobundle#get_hooks("defx.nvim") function! s:hooks.on_post_source(bundle) execute "source" fnamemodify(s:vimrc, ":h")."/plugins/defx.vim" endfunction unlet s:hooks " }}} " defx-icons {{{ let s:hooks = neobundle#get_hooks("defx-icons") function! s:hooks.on_source(bundle) execute "source" fnamemodify(s:vimrc, ":h")."/plugins/defx_icons.vim" let g:defx_icons_gui_colors = { \ "default" : "E0E0E0" \} endfunction unlet s:hooks " }}} " vim-lsp {{{ let s:hooks = neobundle#get_hooks("vim-lsp") function! s:hooks.on_source(bundle) execute "source" fnamemodify(s:vimrc, ":h")."/plugins/lsp.vim" endfunction unlet s:hooks " }}} " vim-ghost {{{ let s:hooks = neobundle#get_hooks("vim-ghost") function! s:hooks.on_source(bundle) function! s:SetupGhostBuffer() if match(expand("%:a"), '\v/ghost-(github|reddit)\.com-') set ft=markdown endif endfunction augroup vim-ghost au! au User vim-ghost#connected call s:SetupGhostBuffer() augroup END endfunction unlet s:hooks " }}} " vim-devicons {{{ let s:hooks = neobundle#get_hooks("vim-devicons") function! s:hooks.on_source(bundle) function! s:init_devicons() " このタイミングで設定してもうまく呼べなかったので直接初期化関数を呼ぶ " let g:webdevicons_enable_denite = 1 " let g:webdevicons_enable_unite = 1 call devicons#plugins#denite#init() call denite#custom#source('unite', 'converters', ['devicons_denite_converter', 'converter/abbr_word']) " call devicons#plugins#unite#init() " call unite#custom#source('frill,grep', 'converters', 'devicons_unite_converter') endfunction MyAutocmd VimEnter * call s:init_devicons() endfunction unlet s:hooks " }}} " vim-plugin-AnsiEsc {{{ let s:hooks = neobundle#get_hooks("vim-plugin-AnsiEsc") function! s:hooks.on_source(bundle) execute "source" fnamemodify(s:vimrc, ":h")."/plugins/ansi_esc.vim" endfunction unlet s:hooks " }}} " Align {{{ let s:hooks = neobundle#get_hooks("Align") function! s:hooks.on_post_source(bundle) " 余計なキーマッピングがされているので無効化 unmap swp unmap rwp endfunction unlet s:hooks " }}} " ddc {{{ let s:hooks = neobundle#get_hooks("ddc") function! s:hooks.on_post_source(bundle) " ddc 側で が上書きされているので再定義する imap neosnippet#expandable() neosnippet#jumpable() ? "\(neosnippet_jump_or_expand)" : pumvisible() ? "\" : "\" endfunction unlet s:hooks " }}} set updatetime=500 " if !has('vim_starting') " endif call neobundle#call_hook('on_source') " }}} "========================================================== " 各言語の設定 "========================================================== " {{{ " ruby{{{ let g:rubycomplete_buffer_loading = 1 let g:rubycomplete_classes_in_global = 1 " }}} " cpp{{{ let c_comment_strings=1 " let c_no_curly_error=1 " filetype = cpp の時 autocmd FileType cpp call s:cpp_loaded() function! s:cpp_loaded() set nocindent setlocal matchpairs+=<:> endfunction " }}} " Python {{{ MyAutocmd FileType python let b:did_ftplugin = 1 " }}} " }}} " モードメッセージを表示しない " http://blog.basyura.org/entry/2013/01/27/153522 hi ModeMsg guifg=bg guibg=bg function! s:on_colorscheme_solarized() let g:solarized_degrade = 0 let g:solarized_termtrans = 0 let g:solarized_bold = 1 let g:solarized_underline = 1 let g:solarized_italic = 0 if (has("gui_running") && g:solarized_degrade == 0) let vmode = "gui" let base03 = "#002b36" let base02 = "#073642" let base01 = "#586e75" let base00 = "#657b83" let base0 = "#839496" let base1 = "#93a1a1" let base2 = "#eee8d5" let base3 = "#fdf6e3" elseif (has("gui_running") && g:solarized_degrade == 1) let vmode = "gui" let base03 = "#1c1c1c" let base02 = "#262626" let base01 = "#4e4e4e" let base00 = "#585858" let base0 = "#808080" let base2 = "#d7d7af" let base3 = "#ffffd7" elseif g:solarized_termcolors != 256 && &t_Co >= 16 let vmode = "cterm" let base03 = "8" let base02 = "0" let base01 = "10" let base00 = "11" let base0 = "12" let base1 = "#8a8a8a" let base1 = "14" let base2 = "7" let base3 = "15" elseif g:solarized_termcolors == 256 let vmode = "cterm" let base03 = "234" let base02 = "235" let base01 = "239" let base00 = "240" let base0 = "244" let base1 = "245" let base2 = "187" let base3 = "230" else let vmode = "cterm" let base0 = "LightBlue" " 4* let base03 = "DarkGray" " 0* let base02 = "Black" " 0 let base01 = "LightGreen" " 2* let base00 = "LightYellow" " 3* let base0 = "LightBlue" " 4* let base1 = "LightCyan" " 6* let base2 = "LightGray" " 7 let base3 = "White" " 7* endif let none = "NONE" let none = "NONE" let t_none = "NONE" let n = "NONE" let c = ",undercurl" let r = ",reverse" let s = ",standout" let ou = "" let ob = "" if (has("gui_running") || g:solarized_termtrans == 0) let back = base03 else let back = "NONE" endif if &background == "light" let temp03 = base03 let temp02 = base02 let temp01 = base01 let temp00 = base00 let base03 = base3 let base02 = base2 let base01 = base1 let base00 = base0 let base0 = temp00 let base1 = temp01 let base2 = temp02 let base3 = temp03 " if (back != "NONE") " let back = base03 " endif endif " --------------------------------------------------------------------- if &background == "high" let base01 = base00 let base00 = base0 let base0 = base1 let base1 = base2 let base2 = base3 let back = back endif if &background == "low" let back = base02 let ou = ",underline" endif " --------------------------------------------------------------------- " --------------------------------------------------------------------- if (g:solarized_bold == 0 || &t_Co == 8 ) let b = "" let bb = ",bold" else let b = ",bold" let bb = "" endif if g:solarized_underline == 0 let u = "" else let u = ",underline" endif exe "let bg_none = ' ".vmode."bg=".none ."'" exe "let bg_back = ' ".vmode."bg=".back ."'" exe "let bg_base03 = ' ".vmode."bg=".base03 ."'" exe "let bg_base02 = ' ".vmode."bg=".base02 ."'" exe "let bg_base01 = ' ".vmode."bg=".base01 ."'" exe "let bg_base00 = ' ".vmode."bg=".base00 ."'" exe "let bg_base0 = ' ".vmode."bg=".base0 ."'" exe "let bg_base1 = ' ".vmode."bg=".base1 ."'" exe "let bg_base2 = ' ".vmode."bg=".base2 ."'" exe "let bg_base3 = ' ".vmode."bg=".base3 ."'" exe "let fg_none = ' ".vmode."fg=".none ."'" exe "let fg_back = ' ".vmode."fg=".back ."'" exe "let fg_none = ' ".vmode."fg=".none ."'" exe "let fg_back = ' ".vmode."fg=".back ."'" exe "let fg_base03 = ' ".vmode."fg=".base03 ."'" exe "let fg_base02 = ' ".vmode."fg=".base02 ."'" exe "let fg_base01 = ' ".vmode."fg=".base01 ."'" exe "let fg_base00 = ' ".vmode."fg=".base00 ."'" exe "let fg_base0 = ' ".vmode."fg=".base0 ."'" exe "let fg_base1 = ' ".vmode."fg=".base1 ."'" exe "let fg_base2 = ' ".vmode."fg=".base2 ."'" exe "let fg_base3 = ' ".vmode."fg=".base3 ."'" exe "let fmt_none = ' ".vmode."=NONE". " term=NONE". "'" exe "let fmt_bold = ' ".vmode."=NONE".b. " term=NONE".b."'" exe "let fmt_revr = ' ".vmode."=NONE".r. " term=NONE".r."'" exe "let fmt_revbb = ' ".vmode."=NONE".r.bb. " term=NONE".r.bb."'" exe "let fmt_revbbu = ' ".vmode."=NONE".r.bb.u. " term=NONE".r.bb.u."'" exe "hi! StatusLine" . fg_base0 .bg_base02 .fmt_none exe "hi! StatusLineNC" . fg_base1 .bg_base02 .fmt_none exe "hi! SpecialKey" . fg_base01 .bg_none .fmt_none exe "hi! NonText" . fg_base02 .bg_none .fmt_bold exe "hi! WildMenu" . fg_base1 .bg_base02 .fmt_bold exe "hi! Cursor" . fg_base0 .bg_none .fmt_revr exe "hi! Pmenu" . fg_base0 .bg_base02 .fmt_none exe "hi! PmenuSel" . fg_base2 .bg_base01 .fmt_none exe "hi! PmenuSbar" . fg_base0 .bg_base2 .fmt_none exe "hi! PmenuThumb" . fg_base03 .bg_base0 .fmt_none endfunction function! s:on_colorscheme_risto() highlight! DiffAdd term=bold ctermbg=9 guibg=#004000 highlight! DiffChange term=bold ctermbg=9 guibg=#004000 highlight! DiffDelete term=bold ctermbg=9 guibg=#B22222 highlight! DiffText term=bold ctermbg=9 guibg=#0000CD endfunction MyAutocmd ColorScheme * :if exists("*s:on_colorscheme_".g:colors_name)| call s:on_colorscheme_{g:colors_name}() | endif " 全角スペースの表示 function! ZenkakuSpace() highlight ZenkakuSpace cterm=underline ctermfg=darkgrey gui=underline guifg=darkgrey endfunction if has('syntax') augroup ZenkakuSpace autocmd! " ZenkakuSpaceをカラーファイルで設定するなら次の行は削除 MyAutocmd ColorScheme * call ZenkakuSpace() " 全角スペースのハイライト指定 MyAutocmd VimEnter,WinEnter * match ZenkakuSpace / / augroup END call ZenkakuSpace() endif function! s:on_colorscheme() hi link IncSearchCursor Error endfunction MyAutocmd ColorScheme * call s:on_colorscheme() function! s:numberwidth(value) if &l:numberwidth != a:value let &l:numberwidth = a:value endif endfunction augroup numberwidth autocmd! autocmd BufEnter,WinEnter,BufWinEnter * let &l:numberwidth = len(line("$")) + 2 augroup END " MyAutocmd FocusGained * redraw! function! WebPageTitle(url) if a:url !~ '^https\?:\/\/.*$' return "" endif let body = webapi#http#get(a:url).content let enc = matchstr(body, ']\+content=["''][^;"'']\+;\s*charset=\zs[^;"'']\+\ze["''][^>]*>') if len(enc) == 0 let enc = matchstr(body, ']*>') endif if empty(enc) let enc = matchstr(body, 'charset=["'']\zs[^"'']*\ze["'']') endif return iconv(matchstr(body, '\zs.\{-}\ze<\/title>'), empty(enc) ? 'uft-8' : enc, &enc) endfunction augroup hi-clumns autocmd! " autocmd WinEnter * :81HlColumnsOn ErrorMsg augroup END " filetype MyAutocmd BufEnter *_spec.rb set ft=ruby.rspec MyAutocmd BufEnter *.rbs set ft=rbs " MyAutocmd BufEnter *.rbs set ft=ruby let g:ruby_path="" command! -nargs=* \ Debug \ try \| echom <q-args> ":" string(<args>) \| catch \| echom <q-args> \| endtry function! s:remove_last_space() if !&modified || &filetype == "markdown" || &filetype == "howm_memo" return end " context の範囲だけに絞って末尾のスペースを削除する let context_range = context_filetype#get(precious#base_filetype())["range"] let top = max([line("w0"), context_range[0][0]]) let bottom = max([line("w$"), context_range[1][0]]) let pos = getpos(".") silent keepjump keeppatterns execute printf('%d,%ds/ \+$//ge', top, bottom) call setpos(".", pos) endfunction command! RemoveLastSpace call s:remove_last_space() MyAutocmd InsertLeave * RemoveLastSpace function! s:upjump() execute "normal! \<C-w>k" if &filetype == "vimfiler" execute "normal! \<C-w>l" endif endfunction nnoremap <silent> <buffer> <C-w>k :call <SID>upjump()<CR> nnoremap <silent> <buffer> <C-w><C-k> :call <SID>upjump()<CR> MyAutocmd Syntax * syn sync minlines=500 maxlines=1000 " markdown のコードハイライト " https://mattn.kaoriya.net/software/vim/20140523124903.htm let g:markdown_fenced_languages = [ \ 'css', \ 'erb=eruby', \ 'javascript', \ 'js=javascript', \ 'json=javascript', \ 'ruby', \ 'sass', \ 'xml', \ 'cpp', \ 'vim', \] if filereadable($VIMLOCALUSER."/vimrc") source $VIMLOCALUSER/vimrc endif " CUI で起動した時にインサートモードのカーソルを | にする if has('vim_starting') && !has("gui_running") " 挿入モード時に点滅の縦棒タイプのカーソル let &t_SI .= "\e[5 q" " ノーマルモード時に点滅のブロックタイプのカーソル let &t_EI .= "\e[1 q" " 置換モード時に非点滅の下線タイプのカーソル let &t_SR .= "\e[4 q" endif function! s:eval_ruby(expr) echo vimproc#system(printf("ruby -e '%s'", tr(a:expr, "'", '"'))) endfunction command! -nargs=* R call s:eval_ruby(<q-args>) if !has("gui_running") set notitle endif " 雑多なスクリプトファイルの読み込み source <sfile>:h/scripts/windowbuffer.vim source <sfile>:h/scripts/window.vim source <sfile>:h/scripts/git.vim source <sfile>:h/scripts/scrapbox.vim source <sfile>:h/scripts/projector.vim source <sfile>:h/scripts/rurema.vim if has("terminal") source <sfile>:h/scripts/terminal.vim endif