私の.vimrc
先週くらいからVimに移行しているが、なんだかんだでセッティングが固まってきたので現在の.vimrcのセッティングを書き出しておく。テーマの設定なんかは.gvimrcのほうでやっています。
" -------------------------------------------- " .vimrc " Last Change: 2020-04-13 13:15:35. " -------------------------------------------- " -------------------------------------------- " Setting for NeoBundle " -------------------------------------------- " NeoBundle がインストールされているなら LoadBundles() を呼び出す " そうでないなら WithoutBundles() を呼び出す function! s:InitNeoBundle() if isdirectory(expand("~/.vim/bundle/neobundle.vim/")) filetype plugin indent off if has('vim_starting') set runtimepath+=~/.vim/bundle/neobundle.vim/ endif call neobundle#begin(expand('~/.vim/bundle/')) NeoBundleFetch 'Shougo/neobundle.vim' NeoBundle 'Shougo/neobundle.vim' NeoBundle 'tpope/vim-surround' NeoBundle 'thinca/vim-quickrun' NeoBundle 'mattn/sonictemplate-vim' NeoBundle 'Shougo/neomru.vim' NeoBundle 'Shougo/unite.vim' NeoBundle 'Shougo/neocomplcache' NeoBundle 'fuenor/JpFormat.vim' NeoBundle 'itchyny/lightline.vim' NeoBundle 'w0ng/vim-hybrid' " お気に入りのスキーマ NeoBundle 'chriskempson/vim-tomorrow-theme' " 今は使ってないスキーマ NeoBundle 'tpope/vim-fugitive' " Gitラッパー NeoBundle 'basyura/TweetVim.git' " Twitter Client NeoBundle 'yomi322/unite-tweetvim.git' NeoBundle 'tyru/open-browser.vim' NeoBundle 'basyura/twibill.vim' NeoBundle 'basyura/bitly.vim' NeoBundle 'kana/vim-textobj-user' " textobj Base NeoBundle 'kana/vim-textobj-entire' " Buffer (ae,ie) NeoBundle 'kana/vim-textobj-line' " Line (al,il) NeoBundle 'kana/vim-textobj-function' " Function (af,if) NeoBundle 'kana/vim-textobj-syntax' " Syntax (ay,iy) NeoBundle 'kana/vim-textobj-jabraces' " 「」とか【】とか (ajb,ijb) NeoBundle 'kana/vim-textobj-fold' " fold (az,iz) NeoBundle 'kana/vim-textobj-indent' " indent (ai,ii) NeoBundle 'kana/vim-textobj-datetime' " datetime (ada,ida) NeoBundle 'kana/vim-textobj-underscore' " underscore (a_,i_) NeoBundle 'thinca/vim-textobj-comment' " comment (ac,ic) NeoBundle 'saihoooooooo/vim-textobj-space' " space (aS,iS) call neobundle#end() endif filetype indent plugin on syntax on endfunction call s:InitNeoBundle() " -------------------------------------------- " Bacis Setting for Vim " -------------------------------------------- " backup set backup set backupdir=$HOME/.vim-backup let &directory = &backupdir autocmd BufWritePre,FileWritePre,FileAppendPre * call UpdateBackupFile() function! UpdateBackupFile() let basedir = "$HOME/.vim-backup" let dir=strftime(basedir."/%Y/%m/%d", localtime()) if !isdirectory(dir) let retval = system("mkdir -p ".dir) " 以下のユーザー名とグループは環境に合わせて設定 " id -p で自分のユーザー名とグループ名は調べられる let retval = system("chown yostos:staff ".dir) endif exe "set backupdir=".dir let time = strftime("%H_%M_%S", localtime()) exe "set backupext=".time endfunction set directory=$HOME/.vim-backup "スワップ用のディレクトリを指定 " --------------- " 基本的な設定 " --------------- " Common Option set nocompatible "vi互換でなくVimデフォルト設定にする filetype off "一旦ファイルタイプをオフに syntax on "シンタックスハイライト set iminsert=0 set imsearch=0 set listchars=tab:»-,trail:-,extends:»,precedes:«,nbsp:%,eol:↲ if has('kaoriya') highlight CursorIM guibg=Purple guifg=NONE inoremap :set iminsert=0 set iminsert=0 imsearch=2 endif set noimdisable set list "不可視文字を表示 "set ruler "右下に行・列番号を表示 "set shortmess+=I "set visualbell "set scrolloff=2 "スクロールするとき下が見えるように "set wildmode=list:longest "set autoread "set showmode "set noinsertmode "set cmdheight=1 "set showcmd "set title " Tab set tabstop=4 "タブは4スペース set shiftwidth=4 "自動インデントのスペース指定 set smarttab "新しい行を作った時高度なインデントを行う set expandtab "タブのかわりに空白を使う set softtabstop=4 set autoindent "新しい行のインデントを現在行と同じにする " Edit set smartindent set showmatch "閉じカッコが入力時対応するカッコを強調 set backspace=indent,eol,start "バックスペースで各種消せるよう " Search set ignorecase "検索時大文字小文字を区別しない set smartcase "大文字を含めた検索はその通りに検索する set incsearch "インクリメンタルサーチを行う set hlsearch "検索結果をハイライト表示 set wrapscan "循環検索オン set infercase "補完の際大文字小文字を区別しない nnoremap :noh " Other set wildmenu "ナビゲーションバーを有効に set tw=0 "自動改行オフ set whichwrap=b,s,h,l,<,>,[,] "カーソル行を行頭、行末で止まらないように set cursorline "カーソル行をハイライト set clipboard=unnamed "クリップボードをWindowsと連携する set hidden "変更中のでも保存せずで他のファイルを表示 set number "行番号を表示する set switchbuf=useopen "新しく開く代りイに既に開いているバッファを set vb t_vb= "ビープ音を消す set novisualbell set nostartofline "移動コマンドを使った時行頭に移動しない set matchpairs& matchpairs+=<:> "<>を対応括弧ペアに set matchtime=3 "対応括弧表示を3秒に set wrap "ウィンドウより長い行は折り畳む set textwidth=0 "テキストの最大幅を無効に set shiftround "インデントをshiftwidthの倍数に set history=10000 "コマンド、検索の履歴を1万個まで set mouse=a "マウスモード有効 inoremap jj "入力モード中に素早くjjと入力した時はESC " 検索後にジャンプした際に検索単語を画面中央に持ってくる nnoremap n nzz nnoremap N Nzz nnoremap * *zz nnoremap # #zz nnoremap g* g*zz nnoremap g# g#zz " set statusline=%F%m%r%h%w\ [FORMAT=%{&ff}]\ [TYPE=%Y]\ [ASCII=\%03.3b]\ [HEX=\%02.2B]\ [POS=%04l,%04v][%p%%]\ [LEN=%L] " grep検索を設定する set grepformat=%f:%l::%m,%f:%l%m,%f\ \ %l%m,%f set grepprg=grep\ -hn " -------------------------------------------- " Setting for Autodate.vim " -------------------------------------------- let autodate_format="%d %3m %Y, %T" " -------------------------------------------- " 拡張子の設定 " -------------------------------------------- " md as markdown, instead of modula2 au BufRead,BufNewFile *.md set filetype=markdown:w " -------------------------------------------- " lightline.vim " -------------------------------------------- let g:lightline = { \ 'colorscheme' : 'wombat', \ } set laststatus=2 "ステータスラインの設定 " -------------------------------------------- " QFixHowm " -------------------------------------------- set runtimepath+=~/.vim/qfixapp let QFix_CopenCmd = 'botright' let QFix_PreviewOpenCmd = 'rightbelow' let QFixHowm_Key = 'g' let howm_dir='~/Documents/howm' let howm_filename = '%Y/%m/%Y-%m-%d-%H%M%S.txt' let QFixHowm_DiaryFile = 'diary/%Y/%m/%Y-%m-%d.txt' let howm_fileencoding = 'utf-8' let howm_fileformat = 'unix' " キーコードやマッピングされたキー列が完了するのを待つ時間(ミリ秒) set timeout timeoutlen=3000 ttimeoutlen=100 " QuickFixウィンドウでもプレビューや絞り込みを有効 " let QFixWin_EnableMode=1 " QuickHowm/QuickGrepの結果表示にロケーションリストを使用する/しない let QFix_UseLocationList=1 let QFixHowm_SaveTime = 1 "保存時にタイムスタンプを更新 "MarkdownをHowmファイルとして利用する let QFixHowm_FileType='markdown' let QFixHowm_Title='#' let QFixHowm_HolidayFile='~/Documents/howm/Sche-Hd-0000-00-00-000000.txt' let QFixHowm_ST= -9 au FileType markdown setlocal textwidth=0 "テキストを折り返さないための設定 let QFixHowm_UserSwActionLock = ['[ ]',' [:org]','[:tririga]'] "カテゴリタグ " -------------------------------------------- " Setting for QuickRun " -------------------------------------------- filetype plugin indent on " required! filetype indent on let g:quickrun_config = {} let g:quickrun_config.markdown= { \ 'outputter' : 'null', \ 'command' : 'open', \ 'cmdopt' : '-a', \ 'args' : '/Applications/Marked\ 2.app', \ 'exec' : '%c %o %a %s', \ } cmap qr QuickRun " -------------------------------------------- " Setting for Unite " -------------------------------------------- " let g:unit_enable_start_insert=0 "ESCキー2回で終了する au FileType unite nnoremap :q au FileType unite nnoremap :q nnoremap ,uy :Unite history/yank nnoremap ,ub :Unite buffer nnoremap ,uf :UniteWithBufferDir -buffer-name=files file nnoremap ,ur :Unite -buffer-name=register register nnoremap ,um :Unite file_mru buffer " -------------------------------------------- " Setting for JpFormat " -------------------------------------------- let JpFormatCursorMovedI=0 " 自動整形を行うかどうか " 0: 挿入モードを抜ける際まとめて整形 " 1: 一文字入力するたびに整形 " au BufRead *.txt silent call JpSetAutoFormat() " set formatoptions+=mM " 日本語の行の連結時には空白を入力しない。 " 現在行を整形 nnoremap gl :JpFormat vnoremap gl :JpFormat " 現在行が整形対象外でも強制的に整形 nnoremap gL :JpFormat! vnoremap gL :JpFormat! " 自動整形のON/OFF切替 " 30gC の様にカウント指定すると、現バッファのみ折り返し文字数を指定された " カウントに変更します。 nnoremap gC :JpFormatToggle " カーソル位置の分割行をまとめてヤンク nnoremap gY :JpYank vnoremap gY :JpYank " カーソル位置の分割行をまとめて連結 nnoremap gJ :JpJoin vnoremap gJ :JpJoin " -------------------------------------------- " Setting for Align " -------------------------------------------- let g:Align_xstrlen=3 " -------------------------------------------- " Setting for TweetVim " -------------------------------------------- nnoremap t:Unite tweetvim nnoremap ss :TweetVimSay nnoremap re :TweetVimMentions "スクリーン名のキャッシュを利用して、neocomplcacheで補完する if !exist('g:neocomplcache_dictionary_filetype_lists') let g:neocomplcache_dictionary_filetype_lists={} endif let neco_dic = g:neocomplcache_dictionary_filetype_lists let neco_dic.tweetvim_say = $HOME . '/.tweetvim/screen_name' " -------------------------------------------- " Setting for AutoComplcache " -------------------------------------------- " Disable AutoComplPop. let g:acp_enableAtStartup = 0 " Use neocomplcache. let g:neocomplcache_enable_at_startup = 1 " Use smartcase. let g:neocomplcache_enable_smart_case = 1 " Set minimum syntax keyword length. let g:neocomplcache_min_syntax_length = 3 let g:neocomplcache_lock_buffer_name_pattern = '\*ku\*' " Define dictionary. let g:neocomplcache_dictionary_filetype_lists = { \ 'default' : '' \ } " Plugin key-mappings. inoremap neocomplcache#undo_completion() inoremap neocomplcache#complete_common_string() " Recommended key-mappings. " : close popup and save indent. inoremap =my_cr_function() function! s:my_cr_function() return neocomplcache#smart_close_popup() . "\" endfunction " : completion. inoremap pumvisible() ? "\" : "\" " , : close popup and delete backword char. inoremap neocomplcache#smart_close_popup()."\" inoremap neocomplcache#smart_close_popup()."\" inoremap neocomplcache#close_popup() inoremap neocomplcache#cancel_popup() " ------------------------------------------------------------------------- " End of .vimrc " -------------------------------------------------------------------------