"=============================================================== " Plugin Settings {{{ "=============================================================== " plugin installed check let s:plug = { 'plugs': get(g:, 'plugs', {}) } function! s:plug.is_installed(name) abort return has_key(self.plugs, a:name) ? isdirectory(self.plugs[a:name].dir) : 0 endfunction "=============================== " ColorScheme {{{ "=============================== "------------------------------- " gruvbox-material if s:plug.is_installed('gruvbox-material') " let s:lightline_colorscheme = 'gruvbox_material' let s:lightline_colorscheme = 'wombat' set background=dark let g:gruvbox_material_background = 'hard' let g:gruvbox_material_transparent_background = 1 let g:gruvbox_material_enable_bold = 1 let g:gruvbox_material_disable_italic_comment = 1 colorscheme gruvbox-material endif "------------------------------- " default if !exists('g:colors_name') colorscheme desert highlight Pmenu ctermfg=Black ctermbg=Gray guifg=Black guibg=Gray highlight PmenuSel ctermfg=Black ctermbg=Cyan guifg=Black guibg=Cyan highlight PmenuSbar ctermfg=White ctermbg=DarkGray guifg=White guibg=DarkGray highlight PmenuThumb ctermfg=DarkGray ctermbg=White guifg=DarkGray guibg=White endif " }}} "============================== " etc {{{ "============================== "------------------------------- " matchit.vim if !exists('g:loaded_matchit') && findfile('plugin/matchit.vim', &rtp) ==# '' runtime! macros/matchit.vim endif "------------------------------- " vim-plug if s:plug.is_installed('vim-plug') " command! PlugReload call map(keys(filter(copy(g:), "v:key =~ '^loaded_' && v:key !~ 'loaded_.*_provider$'")), {_, v -> execute("unlet g:" . v)}) | " \ source $MYVIMRC endif "------------------------------- " yankround if s:plug.is_installed('yankround.vim') nmap p (yankround-p) xmap p (yankround-p) nmap P (yankround-P) nmap gp (yankround-gp) xmap gp (yankround-gp) nmap gP (yankround-gP) nmap (yankround-prev) nmap (yankround-next) let g:yankround_max_history = 100 let g:yankround_dir = '~/.cache/yankround' nnoremap g :CtrlPYankRound "nnoremap (ctrlp) :CtrlP "nmap yankround#is_active() ? "\(yankround-prev)" : "(ctrlp)" endif "------------------------------- " cscope if has('cscope') set nocst set csto=0 set csre set nocsverb " add any database in current directory if filereadable('cscope.out') cs add cscope.out " else add database pointed to by environment elseif $CSCOPE_DB !=? '' cs add $CSCOPE_DB endif set csverb " To open quickfix annoying " set cscopequickfix=s-,c-,d-,i-,t-,e- nnoremap nmap c nmap s :cs find s =expand("") nmap g :cs find g =expand("") nmap c :cs find c =expand("") nmap t :cs find t =expand("") nmap e :cs find e =expand("") nmap f :cs find f =expand("") nmap i :cs find i ^=expand("")$ nmap d :cs find d =expand("") endif "------------------------------- " vim-quickhl if s:plug.is_installed('vim-quickhl') nmap m (quickhl-manual-this-whole-word) xmap m (quickhl-manual-this-whole-word) nmap M (quickhl-manual-reset) xmap M (quickhl-manual-reset) nnoremap :nohlsearch=has('diff')?'diffupdate':'':QuickhlManualReset if ! vimrc#is_supported_truecolor() let g:quickhl_manual_colors = [ \ 'cterm=bold ctermfg=16 ctermbg=214 gui=bold guifg=#000000 guibg=#ffa724', \ 'cterm=bold ctermfg=16 ctermbg=154 gui=bold guifg=#000000 guibg=#aeee00', \ 'cterm=bold ctermfg=16 ctermbg=121 gui=bold guifg=#000000 guibg=#8cffba', \ 'cterm=bold ctermfg=16 ctermbg=137 gui=bold guifg=#000000 guibg=#b88853', \ 'cterm=bold ctermfg=7 ctermbg=21 gui=bold guifg=#ffffff guibg=#d4a00d', \ 'cterm=bold ctermfg=16 ctermbg=211 gui=bold guifg=#000000 guibg=#ff9eb8', \ 'cterm=bold ctermfg=7 ctermbg=22 gui=bold guifg=#ffffff guibg=#06287e', \ 'cterm=bold ctermfg=16 ctermbg=56 gui=bold guifg=#000000 guibg=#a0b0c0', \ 'cterm=bold ctermfg=16 ctermbg=153 gui=bold guifg=#ffffff guibg=#0a7383' \ ] endif "nmap J (quickhl-cword-toggle) "nmap ] (quickhl-tag-toggle) "map H (operator-quickhl-manual-this-motion) endif "------------------------------- " vim-expand-region if s:plug.is_installed('vim-expand-region') vmap v (expand_region_expand) vmap (expand_region_shrink) endif "------------------------------- " vim-easy-align if s:plug.is_installed('vim-easy-align') " Start interactive EasyAlign in visual mode (e.g. vip) xmap a (EasyAlign) " Start interactive EasyAlign for a motion/text object (e.g. gaip) nmap a (EasyAlign) endif "------------------------------- " nerdcommenter if s:plug.is_installed('nerdcommenter') let g:NERDSpaceDelims = 1 "let g:NERDCompactSexyComs = 1 let g:NERDDefaultAlign = 'left' "let g:NERDAltDelims_java = 1 "let g:NERDCustomDelimiters = { " \ 'c': { 'left': '/**','right': '*/' }, " \ 'cpp': { 'left': '/**','right': '*/' } } let g:NERDCommentEmptyLines = 1 let g:NERDTrimTrailingWhitespace = 1 nmap c vmap c endif "------------------------------- " caw.vim if s:plug.is_installed('caw.vim') map (caw:hatpos:toggle) map gcc (caw:hatpos:toggle) " vmap (caw:wrap:toggle) endif "------------------------------- " vim-easymotion if s:plug.is_installed('vim-easymotion') nnoremap nmap S " Disable default mappings " If you are true vimmer, you should explicitly map keys by yourself. " Do not rely on default bidings. let g:EasyMotion_do_mapping = 0 " Or map prefix key at least(Default: ) " map (easymotion-prefix) " Jump to anywhere you want by just `4` or `3` key strokes without thinking! " `s{char}{char}{target}` nmap j (easymotion-s2) xmap j (easymotion-s2) " nmap ss (easymotion-s2) " xmap ss (easymotion-s2) omap z (easymotion-s2) " Of course, you can map to any key you want such as `` " map (easymotion-s2) " Turn on case sensitive feature "let g:EasyMotion_smartcase = 1 " `JK` Motions: Extend line motions " use relativenumber "map j (easymotion-j) "map k (easymotion-k) " keep cursor column with `JK` motions let g:EasyMotion_startofline = 0 let g:EasyMotion_keys='hjklasdfgyuiopqwertnmzxcvbHJKLASDFGYUIOPQWERTNMZXCVB' " Show target key with upper case to improve readability "let g:EasyMotion_use_upper = 1 " Jump to first match with enter & space let g:EasyMotion_enter_jump_first = 1 let g:EasyMotion_space_jump_first = 1 " Extend search motions with vital-over command line interface " Incremental highlight of all the matches " Now, you don't need to repetitively press `n` or `N` with EasyMotion feature " `` & `` to scroll up/down a page with next match " :h easymotion-command-line nmap / (easymotion-sn) xmap / (easymotion-sn) omap / (easymotion-tn) " 1 ストローク選択を優先する let g:EasyMotion_grouping=1 " カラー設定変更 " hi EasyMotionTarget ctermbg=NONE ctermfg=red guifg=#E4E500 " hi EasyMotionShade ctermbg=NONE ctermfg=blue guifg=#444444 hi link EasyMotionTarget ErrorMsg hi link EasyMotionShade LineNr " f{char} to move to {char} "map f (easymotion-bd-f) "nmap f (easymotion-overwin-f) " s{char}{char} to move to {char}{char} "nmap s (easymotion-overwin-f2) " Move to line map k (easymotion-bd-jk) nmap k (easymotion-overwin-line) " Move to word map S (easymotion-bd-w) nmap S (easymotion-overwin-w) map w (easymotion-bd-w) nmap w (easymotion-overwin-w) " etc map . (easymotion-repeat) endif "------------------------------- " vim-signature if s:plug.is_installed('vim-signature') let g:SignatureMap = { \ 'Leader' : 'm', \ 'PlaceNextMark' : 'm,', \ 'ToggleMarkAtLine' : 'm.', \ 'PurgeMarksAtLine' : 'm-', \ 'DeleteMark' : 'dm', \ 'PurgeMarks' : 'm', \ 'PurgeMarkers' : 'm', \ 'GotoNextLineAlpha' : '', \ 'GotoPrevLineAlpha' : '', \ 'GotoNextSpotAlpha' : '`]', \ 'GotoPrevSpotAlpha' : '`[', \ 'GotoNextLineByPos' : "]'", \ 'GotoPrevLineByPos' : "['", \ 'GotoNextSpotByPos' : ']`', \ 'GotoPrevSpotByPos' : '[`', \ 'GotoNextMarker' : ']-', \ 'GotoPrevMarker' : '[-', \ 'GotoNextMarkerAny' : ']=', \ 'GotoPrevMarkerAny' : '[=', \ 'ListBufferMarks' : 'm/', \ 'ListBufferMarkers' : 'm?' \ } endif "------------------------------- " vim-gitgutter if s:plug.is_installed('vim-gitgutter') let g:gitgutter_sign_added = '+' let g:gitgutter_sign_modified = '~' let g:gitgutter_sign_removed = '-' let g:gitgutter_realtime = 500 let g:gitgutter_eager = 500 let g:gitgutter_diff_args = '-w' endif "------------------------------- " vim-trailing-whitespace if s:plug.is_installed('vim-trailing-whitespace') let g:extra_whitespace_ignored_filetypes = \ ['unite', 'markdown', 'vimfiler', 'qf', \ 'tagbar', 'nerdtree', 'vimshell', 'minimap'] augroup vimrc_trailing_whiteSpace autocmd! autocmd BufWritePre * :FixWhitespace augroup END endif "------------------------------- " incsearch.vim if s:plug.is_installed('incsearch.vim') map / (incsearch-forward) map ? (incsearch-backward) map g/ (incsearch-stay) augroup vimrc_incsearch autocmd! autocmd VimEnter * call s:incsearch_keymap() augroup END function! s:incsearch_keymap() abort "IncSearchNoreMap (incsearch-next) "IncSearchNoreMap (incsearch-prev) "IncSearchNoreMap (incsearch-scroll-f) "IncSearchNoreMap (incsearch-scroll-b) IncSearchNoreMap (buffer-complete) IncSearchNoreMap (buffer-complete-prev) endfunction endif "------------------------------- " incsearch-fuzzy.vim if s:plug.is_installed('incsearch-fuzzy.vim') map z/ (incsearch-fuzzy-/) map z? (incsearch-fuzzy-?) map zg/ (incsearch-fuzzy-stay) endif "------------------------------- " vim-rooter if s:plug.is_installed('vim-rooter') " Change only current window's directory let g:rooter_cd_cmd='lcd' " To stop vim-rooter changing directory automatically let g:rooter_manual_only = 1 " files/directories for the root directory let g:rooter_patterns = ['tags', '.git', '.git/', '_darcs/', '.hg/', '.bzr/', 'Makefile', 'GNUMakefile', 'GNUmakefile', '.svn/'] " Automatically change the directory "autocmd! BufEnter *.c,*.cc,*.cxx,*.cpp,*.h,*.hh,*.java,*.py,*.sh,*.rb,*.html,*.css,*.js :Rooter endif "------------------------------- " vim-choosewin if s:plug.is_installed('vim-choosewin') nmap - (choosewin) " オーバーレイ機能を有効にしたい場合 let g:choosewin_overlay_enable = 1 " オーバーレイ・フォントをマルチバイト文字を含むバッファでも綺麗に表示する。 let g:choosewin_overlay_clear_multibyte = 1 endif "------------------------------- " vim-localvimrc if s:plug.is_installed('vim-localvimrc') let g:localvimrc_persistent=1 let g:localvimrc_sandbox=0 endif "------------------------------- " vim-altr if s:plug.is_installed('vim-altr') map (altr-forward) map (altr-back) map g (altr-forward) map g (altr-back) " map (altr-back) endif "------------------------------- " vim-asterisk if s:plug.is_installed('vim-asterisk') if s:plug.is_installed('vim-anzu') map g* (asterisk-z*)(anzu-update-search-status-with-echo) map g# (asterisk-z#)(anzu-update-search-status-with-echo) map * (asterisk-gz*)(anzu-update-search-status-with-echo) else map g* (asterisk-z*) map g# (asterisk-z#) map * (asterisk-gz*) endif " map # (asterisk-gz#)(anzu-update-search-status-with-echo) let g:asterisk#keeppos = 1 endif "------------------------------- " autopreview if s:plug.is_installed('autopreview') let g:AutoPreview_enabled =0 set updatetime=100 set previewheight =8 nnoremap t :AutoPreviewToggle endif "------------------------------- " numbers if s:plug.is_installed('numbers.vim') let g:enable_numbers = 0 endif "------------------------------- " indentLine if s:plug.is_installed('indentLine') let g:indentLine_enabled = 0 endif "------------------------------- " CmdlineComplete if s:plug.is_installed('CmdlineComplete') cmap CmdlineCompleteBackward cmap CmdlineCompleteForward endif "------------------------------- " vim-milfeulle if s:plug.is_installed('vim-milfeulle') nmap (milfeulle-prev) nmap (milfeulle-next) nmap (milfeulle-prev) nmap (milfeulle-next) nmap [j (milfeulle-prev) nmap ]j (milfeulle-next) let g:milfeulle_default_kind = 'buffer' let g:milfeulle_default_jumper_name = 'win_tab_bufnr_pos' endif "------------------------------- " vim-ipmotion if s:plug.is_installed('vim-ipmotion') let g:ip_boundary = '"\?\s*$\n"\?\s*$' endif "------------------------------- " vim-brightest if s:plug.is_installed('vim-brightest') let g:brightest_enable = 0 let g:brightest#highlight = { \ 'group' : 'BrightestUnderline' \} endif "------------------------------- " vim-hopping if s:plug.is_installed('vim-hopping') " Example key mapping nmap / (hopping-start) " Keymapping let g:hopping#keymapping = { \ "\" : '(hopping-next)', \ "\" : '(hopping-prev)', \ "\" : '(scroll-u)', \ "\" : '(scroll-d)', \} endif "------------------------------- " splitjoin.vim if s:plug.is_installed('splitjoin.vim') nmap J :SplitjoinJoin nmap S :SplitjoinSplit endif "------------------------------- " vim-jplus if s:plug.is_installed('vim-jplus') " J の挙動を jplus.vim で行う nmap gJ (jplus) vmap gJ (jplus) " getchar() を使用して挿入文字を入力します " nmap J (jplus-getchar) " vmap J (jplus-getchar) " input() を使用したい場合はこちらを使用して下さい nmap J (jplus-input) vmap J (jplus-input) " (jplus-getchar) 時に左右に空白文字を入れたい場合 " %d は入力した結合文字に置き換えられる let g:jplus#config = { \ '_' : { \ 'delimiter_format' : '%d' \ } \} endif "------------------------------- " vim-trip if s:plug.is_installed('vim-trip') nmap + (trip-increment) nmap - (trip-decrement) endif "------------------------------- " vim-togglelist if s:plug.is_installed('vim-togglelist') nmap