macOS
$ vim --version
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Jun 19 2019 19:08:44)
Included patches: 1-503, 505-680, 682-1283, 1365
Compiled by [email protected]
Normal version without GUI. Features included (+) or not (-):
+acl +file_in_path -mouse_sgr +tag_old_static
-arabic +find_in_path -mouse_sysmouse -tag_any_white
+autocmd +float -mouse_urxvt -tcl
-balloon_eval +folding +mouse_xterm -termguicolors
-browse -footer +multi_byte -terminal
+builtin_terms +fork() +multi_lang +terminfo
+byte_offset -gettext -mzscheme +termresponse
+channel -hangul_input +netbeans_intg +textobjects
+cindent +iconv +num64 +timers
-clientserver +insert_expand +packages +title
-clipboard +job +path_extra -toolbar
+cmdline_compl +jumplist -perl +user_commands
+cmdline_hist -keymap +persistent_undo +vertsplit
+cmdline_info +lambda +postscript +virtualedit
+comments -langmap +printer +visual
-conceal +libcall -profile +visualextra
+cryptv +linebreak +python/dyn +viminfo
+cscope +lispindent -python3 +vreplace
+cursorbind +listcmds +quickfix +wildignore
+cursorshape +localmap +reltime +wildmenu
+dialog_con -lua -rightleft +windows
+diff +menu +ruby/dyn +writebackup
+digraphs +mksession +scrollbind -X11
-dnd +modify_fname +signs -xfontset
-ebcdic +mouse +smartindent -xim
-emacs_tags -mouseshape +startuptime -xpm
+eval -mouse_dec +statusline -xsmp
+ex_extra -mouse_gpm -sun_workshop -xterm_clipboard
+extra_search -mouse_jsbterm +syntax -xterm_save
-farsi -mouse_netterm +tag_binary
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
defaults file: "$VIMRUNTIME/defaults.vim"
fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DMACOS_X_UNIX -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc -L/usr/local/lib -o vim -lm -lncurses -liconv -framework Cocoa
" Configuration file for vim
set modelines=0 " CVE-2007-2438
" Normally we use vim-extensions. If you want true vi-compatibility
" remove change the following statements
set nocompatible " Use Vim defaults instead of 100% vi compatibility
set backspace=2 " more powerful backspacing
" Don't write backup file if vim is being called by "crontab -e"
au BufWrite /private/tmp/crontab.* set nowritebackup nobackup
" Don't write backup file if vim is being called by "chpass"
au BufWrite /private/etc/pw.* set nowritebackup nobackup
" Basic settings
" タイトルをバッファ名に変更しない
set notitle
set shortmess+=I
" Too fast connect to the tarminal
set ttyfast
" Use 256 colors at the tarminal
set t_Co=256
if has ("viminfo")
" フォールド設定(未使用)
" set foldmethod=indent
set foldmethod=manual
" set foldopen=all
" set foldclose=all
endif
" 複数ファイルの編集を可能にする
set hidden
" 内容が変更されたら自動的に再読み込み
set autoread
" Swapを作るまでの時間ms
set updatetime=0
" Unicodeで行末が変になる問題を解決
set ambiwidth=double
" カーソルを常に画面の中央に。
set scrolloff=1000
" C-vの矩形選択で行末より後ろもカーソルを置ける
set virtualedit=block
" コマンド、検索パターンを50まで保存
set history=100
" ------ SEARCH -------
" インクリメンタルサーチを有効に
set incsearch
" 大文字小文字を区別しない
set ignorecase
" 大文字で検索されたら対象を大文字限定にする
set smartcase
" 行末まで検索したら行頭に戻る
set wrapscan
" ----- Format -----
" 自動インデントを有効に
set smartindent
set autoindent
" フォーマット揃えをコメント以外有効にする
set formatoptions-=c
" 括弧の対応をハイライト
set showmatch
" ターミナルの上から貼り付けを許可
" set paste
set shiftwidth=4
set softtabstop=4
set expandtab
set autoindent
set smartindent
augroup fileTypeIndent
autocmd!
autocmd BufNewFile,BufRead *.py setlocal tabstop=4 softtabstop=4 shiftwidth=4
autocmd BufNewFile,BufRead *.html setlocal tabstop=4 softtabstop=4 shiftwidth=4
autocmd BufNewFile,BufRead *.rb setlocal tabstop=2 softtabstop=2 shiftwidth=2
autocmd BufNewFile,BufRead *.erb setlocal tabstop=2 softtabstop=2 shiftwidth=2
augroup END
" ----- Look&Feel -----
" TAB可視化
set list
set listchars=tab:>_,trail:-,eol:$
" extends:>>,precedes:<<,nb:%,
" 検索結果をハイライト
set hlsearch
" ルーラー、番号
set ruler
set number
" コマンドラインの高さ
set cmdheight=2
" カーソルラインを表示する
"set cursorline
" ウインドウタイトルを設定する
set title
"自動文字数カウント
augroup WordCount
autocmd!
autocmd BufWinEnter,InsertLeave,CursorHold * call WordCount('char')
augroup END
let s:WordCountStr = ''
let s:WordCountDict = {'word': 2, 'char': 3, 'byte': 4}
function! WordCount(...)
if a:0 == 0
return s:WordCountStr
endif
let cidx = 3
silent! let cidx = s:WordCountDict[a:1]
let s:WordCountStr = ''
let s:saved_status = v:statusmsg
exec "silent normal! g\<c-g>"
if v:statusmsg !~ '^--'
let str = ''
silent! let str = split(v:statusmsg, ';')[cidx]
let cur = str2nr(matchstr(str, '\d\+'))
let end = str2nr(matchstr(str, '\d\+\s*$'))
if a:1 == 'char'
" ここで(改行コード数*改行コードサイズ)を'g<C-g>'の文字数から引く
let cr = &ff == 'dos' ? 2 : 1
let cur -= cr * (line('.') - 1)
let end -= cr * line('$')
endif
let s:WordCountStr = printf('%d/%d', cur, end)
endif
let v:statusmsg = s:saved_status
return s:WordCountStr
endfunction
" ステータスラインにコマンドを表示
set showcmd
" ステータスラインを常に表示
set laststatus=2
" ファイルナンバー表示
set statusline=[%n]
" ホスト名表示
set statusline+=%{matchstr(hostname(),'__w__+')}@
" ファイル名表示
set statusline+=%<%F
" 変更チェックの表示
set statusline+=%m
" 読み込み専用かどうか表示
set statusline+=%r
" ヘルプページなら[HELP]と表示
set statusline+=%h
" プレビューウィンドウなら[Preview]と表示
set statusline+=%w
" ファイルフォーマット表示
set statusline+=[%{&fileformat}]
" 文字コード表示
set statusline+=[%{has('multi_byte')&&\&fileencoding!=''?&fileencoding:&encoding}]
" ファイルタイプ表示
set statusline+=%y
" ここからツールバー右側
set statusline+=%=
" skk.vimの状態
set statusline+=%{exists('*SkkGetModeStr')?SkkGetModeStr():''}
" 文字バイト数/カラム番号
set statusline+=[%{col('.')-1}=ASCII=%B,HEX=%c
" 現在文字列/全体列表示
set statusline+=[C=%c/%{col('$')-1}]
" 現在文字行/全体文字行
set statusline+=[L=%l/%L]
" 現在のファイルの文字数をカウント
set statusline+=[WC=%{exists('*WordCount')?WordCount():[]}]
" 現在行が全体行の何%目か表示
set statusline+=[%p%%]
"-------エンコード------
"エンコード設定
if has('unix')
set fileformat=unix
set fileformats=unix,dos,mac
set fileencoding=utf-8
set fileencodings=utf-8,iso-2022-jp,cp932,euc-jp
set termencoding=
elseif has('win32')
set fileformat=dos
set fileformats=dos,unix,mac
set fileencoding=utf-8
set fileencodings=iso-2022-jp,utf-8,euc-jp,cp932
set termencoding=
endif
"ファイルタイプに応じて挙動,色を変える
syntax on
filetype plugin on
filetype indent on
" ----- key setting -----
" nmap <UP> k
" nmap <DOWN> j
" vmap <UP> k
" vmap <DOWN> j
" ほかのvimにviminfoを送る
" http://nanasi.jp/articles/howto/editing/rviminfo.html
nmap ,vw :vw<CR>
nmap ,vr :vr<CR>
" 保存
" map jj :w<CR>
" ESC
inoremap jj <ESC>
" 括弧を補完
inoremap ( ()<left>
inoremap [ []<left>
inoremap { {}<left>
inoremap < <><left>
" 挿入モードでのカーソル移動
inoremap <C-j> <Down>
inoremap <C-k> <UP>
inoremap <C-h> <Left>
inoremap <C-l> <Right>
" シングルコーテーション補完
" inoremap ' ''<left>
" yanktmpの設定
" vim to vim でコピペ出きるようになる。
" map <silent> sy :call YanktmpYank()<CR>
" map <silent> sp :call YanktmpPaste_p()<CR>
" map <silent> sP :call YanktmpPaste_P()<CR>
" if has("win32")
" let g:yanktmp_file = TEMP. '/vimyanktmp'
" end
" netrw 用
"let g: netrw_liststyle = 3
"let g: netrw_browse_split = 4
"let g: netrw_altv = 1
" Plugin management
" Dein Vim
" if &compatible
" set nocompatible " Be iMproved
" endif
"
" " Required:
" set runtimepath+=~/.cache/dein/repos/github.com/Shougo/dein.vim
"
" " Required:
" if dein#load_state('~/.cache/dein')
" call dein#begin('~/.cache/dein')
"
" " Let dein manage dein
" " Required:
" call dein#add('~/.cache/dein/repos/github.com/Shougo/dein.vim')
"
" " Add or remove your plugins here like this:
" " call dein#add('Shougo/neosnippet.vim')
" " call dein#add('Shougo/neosnippet-snippets')
" call dein#add('editorconfig/editorconfig-vim')
" call dein#add('Shougo/vimproc.vim', {'build' : 'make'})
"
"
" " Required:
" call dein#end()
" call dein#save_state()
" endif
"
" " Required:
" filetype plugin indent on
" syntax enable
" If you want to install not installed plugins on startup.
"if dein#check_install()
" call dein#install()
"end