ubuntu
$ vim --version
VIM - Vi IMproved 8.1 (2018 May 18, compiled Jul 21 2019 22:33:25)
適用済パッチ: 1-1700
Compiled by takashi@takashi-desktop
Huge 版 without GUI. 機能の一覧 有効(+)/無効(-)
+acl -farsi -mouse_sysmouse -tag_any_white
+arabic +file_in_path +mouse_urxvt -tcl
+autocmd +find_in_path +mouse_xterm +termguicolors
+autochdir +float +multi_byte +terminal
-autoservername +folding +multi_lang +terminfo
-balloon_eval -footer -mzscheme +termresponse
+balloon_eval_term +fork() +netbeans_intg +textobjects
-browse +gettext +num64 +textprop
++builtin_terms -hangul_input +packages +timers
+byte_offset +iconv +path_extra +title
+channel +insert_expand -perl -toolbar
+cindent +job +persistent_undo +user_commands
+clientserver +jumplist +postscript +vartabs
+clipboard +keymap +printer +vertsplit
+cmdline_compl +lambda +profile +virtualedit
+cmdline_hist +langmap +python/dyn +visual
+cmdline_info +libcall +python3/dyn +visualextra
+comments +linebreak +quickfix +viminfo
+conceal +lispindent +reltime +vreplace
+cryptv +listcmds +rightleft +wildignore
+cscope +localmap +ruby/dyn +wildmenu
+cursorbind +lua/dyn +scrollbind +windows
+cursorshape +menu +signs +writebackup
+dialog_con +mksession +smartindent +X11
+diff +modify_fname -sound +xfontset
+digraphs +mouse +spell -xim
-dnd -mouseshape +startuptime -xpm
-ebcdic +mouse_dec +statusline +xsmp_interact
+emacs_tags +mouse_gpm -sun_workshop +xterm_clipboard
+eval -mouse_jsbterm +syntax -xterm_save
+ex_extra +mouse_netterm +tag_binary
+extra_search +mouse_sgr -tag_old_static
システム vimrc: "$VIM/vimrc"
ユーザー vimrc: "$HOME/.vimrc"
第2ユーザー vimrc: "~/.vim/vimrc"
ユーザー exrc: "$HOME/.exrc"
デフォルトファイル: "$VIMRUNTIME/defaults.vim"
省略時の $VIM: "/usr/local/share/vim"
コンパイル: gcc -c -I. -Iproto -DHAVE_CONFIG_H -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
リンク: gcc -L. -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -fstack-protector -rdynamic -Wl,-export-dynamic -L/usr/local/lib -Wl,--as-needed -o vim -lSM -lICE -lXt -lX11 -lXdmcp -lSM -lICE -lm -ltinfo -lnsl -lacl -lattr -lgpm -ldl
" All system-wide defaults are set in $VIMRUNTIME/debian.vim (usually just
" /usr/share/vim/vimcurrent/debian.vim) and sourced by the call to :runtime
" you can find below. If you wish to change any of those settings, you should
" do it in this file (/etc/vim/vimrc), since debian.vim will be overwritten
" everytime an upgrade of the vim packages is performed. It is recommended to
" make changes after sourcing debian.vim since it alters the value of the
" 'compatible' option.
" This line should not be removed as it ensures that various options are
" properly set to work with the Vim-related packages available in Debian.
runtime! debian.vim
" Uncomment the next line to make Vim more Vi-compatible
" NOTE: debian.vim sets 'nocompatible'. Setting 'compatible' changes numerous
" options, so any other options should be set AFTER setting 'compatible'.
"set compatible
" Vim5 and later versions support syntax highlighting. Uncommenting the next
" line enables syntax highlighting by default.
if has("syntax")
syntax on
endif
" If using a dark background within the editing area and syntax highlighting
" turn on this option as well
"set background=dark
" Uncomment the following to have Vim jump to the last position when
" reopening a file
"if has("autocmd")
" au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
"endif
" Uncomment the following to have Vim load indentation rules and plugins
" according to the detected filetype.
"if has("autocmd")
" filetype plugin indent on
"endif
" The following are commented out as they cause vim to behave a lot
" differently from regular Vi. They are highly recommended though.
set showcmd " Show (partial) command in status line.
set showmatch " Show matching brackets.
set ignorecase " Do case insensitive matching
set smartcase " Do smart case matching
set incsearch " Incremental search
"set autowrite " Automatically save before commands like :next and :make
set hidden " Hide buffers when they are abandoned
set mouse=a " Enable mouse usage (all modes)
" Source a global configuration file if available
if filereadable("/etc/vim/vimrc.local")
source /etc/vim/vimrc.local
endif
"-----------------------
" ここから個人設定
" ----------------------
" 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
" clipboard 利用設定
set clipboard=unnamedplus,autoselect
" 内容が変更されたら自動的に再読み込み
set autoread
" C-vの矩形選択で行末より後ろもカーソルを置ける
set virtualedit=block
" コマンド、検索パターンを100まで保存
set history=100
" 行末まで検索したら行頭に戻る
set wrapscan
" 検索結果のハイライト
set hlsearch
" 常にステータス行を表示
set laststatus=2
" タイトルを表示
set title
" コマンドラインの高さ
set cmdheight=2
" 不可視文字の表示
set list
"set listchars=tab:>_,trail:-,eol:$,extends:>>,precedes:<<,nbsp:%
" 行番号表示
set number
" ルーラー表示
set ruler
" 括弧の補完
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>
" ESCのマップ変更
inoremap jj <ESC>
" tab関連
set tabstop=4
set autoindent
set smartindent
set expandtab
set shiftwidth=4
" .rhtmlと.rbと.ymlでタブ幅を変更
au bufNewFile,BufRead *.rhtml set tabstop=2 shiftwidth=2
au bufNewFile,BufRead *.rb set tabstop=2 shiftwidth=2
au bufNewFile,BufRead *.yaml set tabstop=2 shiftwidth=2
au bufNewFile,BufRead *.yml set tabstop=2 shiftwidth=2
au bufNewFile,BufRead *.html set tabstop=4 shiftwidth=4
" ファイル指定で開かれた場合はNERDTreeを起動しない
" if !argc()
" autocmd vimenter * NERDTree|normal gg3j
" endif
"
" " NeoBundleの設定
" set nocompatible " be iMproved
" filetype off
"
" if has('vim_starting')
" set runtimepath+=~/.vim/bundle/neobundle.vim
" call neobundle#rc(expand('~/.vim/bundle/'))
" endif
"
" let g:neobundle_default_git_protocol = 'https'
" " originalrepos on github
" " 使いたいプラグインのリポジトリを羅列
" NeoBundle 'Shougo/neobundle.vim'
" " NeoBundle 'Shougo/vimproc'
" NeoBundle 'Shougo/vimproc', {
" \ 'build' : {
" \ 'mac' : 'make -f make_mac.mak',
" \ 'unix' : 'make -f make_unix.mak',
" \ },
" \ }
" NeoBundle 'VimClojure'
" NeoBundle 'Shougo/vimshell'
" NeoBundle 'Shougo/unite.vim'
" NeoBundle 'Shougo/neocomplcache'
" "NeoBundle 'Shougo/neocomplcache-snippets-complete' "neosnipetへ
" NeoBundle 'Shougo/neosnippet'
" NeoBundle 'jpalardy/vim-slime'
" NeoBundle 'scrooloose/syntastic'
" "NeoBundle 'mattn/zencoding-vim'
" "NeoBundle 'https://bitbucket.org/kovisoft/slimv'
" NeoBundle 'vim-ruby/vim-ruby' "ruby用
" NeoBundle 'tpope/vim-surround' "surround用
" NeoBundle 'tpope/vim-rails' "rails.vim
" NeoBundle 'synboo/project.vim' "project.vim
" NeoBundle 'vim-scripts/matchit.zip' "対応する括弧
" NeoBundle 'vim-scripts/snippetsEmu' "すにペッと
" NeoBundle 'Shougo/vimfiler' "filer
" NeoBundle 'Shougo/neocomplcache-rsense' "omni補完
" NeoBundle 'vim-scripts/yanktmp.vim' "ヤンクデータ受け渡し
" NeoBundle 'vim-scripts/dbext.vim' "SQL文を叩いて結果を見れる
" NeoBundle 'vim-scripts/The-NERD-tree'
" NeoBundle 'tpope/vim-endwise'
" NeoBundle 'Shougo/unite.vim'
" NeoBundle 'vim-scripts/TwitVim' "twitter client
" NeoBundle 'itchyny/calendar.vim'
" NeoBundle 'mattn/emmet-vim' " zencodingの後継$
filetype plugin indent on " required!
filetype indent on
syntax on
" 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
" neocomplcacheを有効化
let g:neocomplcache_enable_at_startup = 1
" twitvim configuration
let twitvim_enable_ruby = 1
let g:user_emmet_settings = {
\ 'lang' : 'ja',
\ 'indentation' : ' ',
\}
"自動文字数カウント
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