pictcode / .vimrc @ master
履歴 | 表示 | アノテート | ダウンロード (10.547 KB)
| 1 | 00f32066 | hasse | "---------------------------------------------------- |
|---|---|---|---|
| 2 | " 文字コード |
||
| 3 | "---------------------------------------------------- |
||
| 4 | " 文字コードの自動認識 |
||
| 5 | if &encoding !=# 'utf-8' |
||
| 6 | set encoding=japan |
||
| 7 | set fileencoding=japan |
||
| 8 | endif |
||
| 9 | if has('iconv')
|
||
| 10 | let s:enc_euc = 'euc-jp' |
||
| 11 | let s:enc_jis = 'iso-2022-jp' |
||
| 12 | " iconvがeucJP-msに対応しているかをチェック |
||
| 13 | if iconv("\x87\x64\x87\x6a", 'cp932', 'eucjp-ms') ==# "\xad\xc5\xad\xcb"
|
||
| 14 | let s:enc_euc = 'eucjp-ms' |
||
| 15 | let s:enc_jis = 'iso-2022-jp-3' |
||
| 16 | " iconvがJISX0213に対応しているかをチェック |
||
| 17 | elseif iconv("\x87\x64\x87\x6a", 'cp932', 'euc-jisx0213') ==# "\xad\xc5\xad\xcb"
|
||
| 18 | let s:enc_euc = 'euc-jisx0213' |
||
| 19 | let s:enc_jis = 'iso-2022-jp-3' |
||
| 20 | endif |
||
| 21 | " fileencodingsを構築 |
||
| 22 | if &encoding ==# 'utf-8' |
||
| 23 | let s:fileencodings_default = &fileencodings |
||
| 24 | let &fileencodings = s:enc_jis .','. s:enc_euc .',cp932' |
||
| 25 | let &fileencodings = &fileencodings .','. s:fileencodings_default |
||
| 26 | unlet s:fileencodings_default |
||
| 27 | else |
||
| 28 | let &fileencodings = &fileencodings .','. s:enc_jis |
||
| 29 | set fileencodings+=utf-8,ucs-2le,ucs-2 |
||
| 30 | if &encoding =~# '^\(euc-jp\|euc-jisx0213\|eucjp-ms\)$' |
||
| 31 | set fileencodings+=cp932 |
||
| 32 | set fileencodings-=euc-jp |
||
| 33 | set fileencodings-=euc-jisx0213 |
||
| 34 | set fileencodings-=eucjp-ms |
||
| 35 | let &encoding = s:enc_euc |
||
| 36 | let &fileencoding = s:enc_euc |
||
| 37 | else |
||
| 38 | let &fileencodings = &fileencodings .','. s:enc_euc |
||
| 39 | endif |
||
| 40 | endif |
||
| 41 | " 定数を処分 |
||
| 42 | unlet s:enc_euc |
||
| 43 | unlet s:enc_jis |
||
| 44 | endif |
||
| 45 | " 日本語を含まない場合は fileencoding に encoding を使うようにする |
||
| 46 | if has('autocmd')
|
||
| 47 | function! AU_ReCheck_FENC() |
||
| 48 | if &fileencoding =~# 'iso-2022-jp' && search("[^\x01-\x7e]", 'n') == 0
|
||
| 49 | let &fileencoding=&encoding |
||
| 50 | endif |
||
| 51 | endfunction |
||
| 52 | autocmd BufReadPost * call AU_ReCheck_FENC() |
||
| 53 | endif |
||
| 54 | " 改行コードの自動認識 |
||
| 55 | set fileformats=unix,dos,mac |
||
| 56 | " □とか○の文字があってもカーソル位置がずれないようにする |
||
| 57 | if exists('&ambiwidth')
|
||
| 58 | set ambiwidth=double |
||
| 59 | endif |
||
| 60 | "---------------------------------------------------- |
||
| 61 | " 基本的な設定 |
||
| 62 | "---------------------------------------------------- |
||
| 63 | " viとの互換性をとらない(vimの独自拡張機能を使う為) |
||
| 64 | set nocompatible |
||
| 65 | " 改行コードの自動認識 |
||
| 66 | set fileformats=unix,dos,mac |
||
| 67 | " ビープ音を鳴らさない |
||
| 68 | set vb t_vb= |
||
| 69 | " バックスペースキーで削除できるものを指定 |
||
| 70 | " indent : 行頭の空白 |
||
| 71 | " eol : 改行 |
||
| 72 | " start : 挿入モード開始位置より手前の文字 |
||
| 73 | set backspace=indent,eol,start |
||
| 74 | |||
| 75 | "---------------------------------------------------- |
||
| 76 | " バックアップ関係 |
||
| 77 | "---------------------------------------------------- |
||
| 78 | " バックアップをとらない |
||
| 79 | set nobackup |
||
| 80 | " ファイルの上書きの前にバックアップを作る |
||
| 81 | " (ただし、backup がオンでない限り、バックアップは上書きに成功した後削除される) |
||
| 82 | set writebackup |
||
| 83 | " バックアップをとる場合 |
||
| 84 | "set backup |
||
| 85 | " バックアップファイルを作るディレクトリ |
||
| 86 | "set backupdir=~/backup |
||
| 87 | " スワップファイルを作るディレクトリ |
||
| 88 | "set directory=~/swap |
||
| 89 | |||
| 90 | "---------------------------------------------------- |
||
| 91 | " 検索関係 |
||
| 92 | "---------------------------------------------------- |
||
| 93 | " コマンド、検索パターンを100個まで履歴に残す |
||
| 94 | set history=100 |
||
| 95 | " 検索の時に大文字小文字を区別しない |
||
| 96 | set ignorecase |
||
| 97 | " 検索の時に大文字が含まれている場合は区別して検索する |
||
| 98 | set smartcase |
||
| 99 | " 最後まで検索したら先頭に戻る |
||
| 100 | set wrapscan |
||
| 101 | " インクリメンタルサーチを使わない |
||
| 102 | set noincsearch |
||
| 103 | |||
| 104 | "---------------------------------------------------- |
||
| 105 | " 表示関係 |
||
| 106 | "---------------------------------------------------- |
||
| 107 | " タイトルをウインドウ枠に表示する |
||
| 108 | " set title |
||
| 109 | " 行番号を表示しない |
||
| 110 | set number |
||
| 111 | " ルーラーを表示 |
||
| 112 | set ruler |
||
| 113 | " タブ文字を CTRL-I で表示し、行末に $ で表示する |
||
| 114 | "set list |
||
| 115 | " 入力中のコマンドをステータスに表示する |
||
| 116 | set showcmd |
||
| 117 | " ステータスラインを常に表示 |
||
| 118 | set laststatus=2 |
||
| 119 | " 括弧入力時の対応する括弧を表示 |
||
| 120 | set showmatch |
||
| 121 | " 対応する括弧の表示時間を2にする |
||
| 122 | " set matchtime=2 |
||
| 123 | " シンタックスハイライトを有効にする |
||
| 124 | syntax on |
||
| 125 | " 検索結果文字列のハイライトを有効にする |
||
| 126 | set hlsearch |
||
| 127 | " コメント文の色を変更 |
||
| 128 | highlight Comment ctermfg=DarkCyan |
||
| 129 | " コマンドライン補完を拡張モードにする |
||
| 130 | set wildmenu |
||
| 131 | |||
| 132 | " 入力されているテキストの最大幅 |
||
| 133 | " (行がそれより長くなると、この幅を超えないように空白の後で改行される)を無効にする |
||
| 134 | set textwidth=0 |
||
| 135 | " ウィンドウの幅より長い行は折り返して、次の行に続けて表示する |
||
| 136 | set wrap |
||
| 137 | |||
| 138 | " 全角スペースの表示 |
||
| 139 | highlight ZenkakuSpace cterm=underline ctermfg=lightblue guibg=darkgray |
||
| 140 | match ZenkakuSpace / / |
||
| 141 | |||
| 142 | " ステータスラインに表示する情報の指定 |
||
| 143 | set statusline=%{(&fenc!=''?&fenc:&enc).'\|'.&ff.'\|'}%m%r%=<%l/%L:%p%%>
|
||
| 144 | "set statusline=%n\:%y%F\ \|%{(&fenc!=''?&fenc:&enc).'\|'.&ff.'\|'}%m%r%=<%l/%L:%p%%>
|
||
| 145 | " ステータスラインの色 |
||
| 146 | "highlight StatusLine term=NONE cterm=NONE ctermfg=black ctermbg=white |
||
| 147 | |||
| 148 | "---------------------------------------------------- |
||
| 149 | " インデント |
||
| 150 | "---------------------------------------------------- |
||
| 151 | " オートインデントを無効にする |
||
| 152 | "set noautoindent |
||
| 153 | " タブが対応する空白の数 |
||
| 154 | set tabstop=4 |
||
| 155 | " タブやバックスペースの使用等の編集操作をするときに、タブが対応する空白の数 |
||
| 156 | set softtabstop=4 |
||
| 157 | " インデントの各段階に使われる空白の数 |
||
| 158 | set shiftwidth=4 |
||
| 159 | " タブを挿入するとき、代わりに空白を使わない |
||
| 160 | set noexpandtab |
||
| 161 | |||
| 162 | "---------------------------------------------------- |
||
| 163 | " オートコマンド |
||
| 164 | "---------------------------------------------------- |
||
| 165 | if has("autocmd")
|
||
| 166 | " ファイルタイプ別インデント、プラグインを有効にする |
||
| 167 | filetype plugin indent on |
||
| 168 | " カーソル位置を記憶する |
||
| 169 | autocmd BufReadPost * |
||
| 170 | \ if line("'\"") > 0 && line("'\"") <= line("$") |
|
||
| 171 | \ exe "normal g`\"" | |
||
| 172 | \ endif |
||
| 173 | endif |
||
| 174 | |||
| 175 | "---------------------------------------------------- |
||
| 176 | " その他 |
||
| 177 | "---------------------------------------------------- |
||
| 178 | " バッファを切替えてもundoの効力を失わない |
||
| 179 | set hidden |
||
| 180 | " 起動時のメッセージを表示しない |
||
| 181 | set shortmess+=I |
||
| 182 | " 横線の表示 |
||
| 183 | set cursorline |
||
| 184 | " 縦線の表示 |
||
| 185 | "set cursorcolumn |
||
| 186 | " netrwは常にtree view |
||
| 187 | let g:netrw_liststyle = 3 |
||
| 188 | " " CVSと.で始まるファイルは表示しない |
||
| 189 | let g:netrw_list_hide = 'CVS,\(^\|\s\s\)\zs\.\S\+' |
||
| 190 | " " 'v'でファイルを開くときは右側に開く。(デフォルトが左側なので入れ替え) |
||
| 191 | let g:netrw_altv = 1 |
||
| 192 | " " 'o'でファイルを開くときは下側に開く。(デフォルトが上側なので入れ替え) |
||
| 193 | let g:netrw_alto = 1 |
||
| 194 | if has('vim_starting')
|
||
| 195 | set nocompatible " Be iMproved |
||
| 196 | set runtimepath+=~/.vim/bundle/neobundle.vim/ |
||
| 197 | endif |
||
| 198 | |||
| 199 | |||
| 200 | " ---------------------------------------------------------------------------------------- |
||
| 201 | " neobundle |
||
| 202 | " ---------------------------------------------------------------------------------------- |
||
| 203 | |||
| 204 | " Note: Skip initialization for vim-tiny or vim-small. |
||
| 205 | if 0 | endif |
||
| 206 | |||
| 207 | filetype off |
||
| 208 | |||
| 209 | if has('vim_starting')
|
||
| 210 | if &compatible |
||
| 211 | set nocompatible " Be iMproved |
||
| 212 | endif |
||
| 213 | |||
| 214 | set runtimepath+=~/.vim/bundle/neobundle.vim |
||
| 215 | endif |
||
| 216 | |||
| 217 | call neobundle#begin(expand('~/.vim/bundle/'))
|
||
| 218 | |||
| 219 | " originalrepos on github |
||
| 220 | NeoBundle 'Shougo/neobundle.vim' |
||
| 221 | NeoBundle 'Shougo/vimproc', {
|
||
| 222 | \ 'build' : {
|
||
| 223 | \ 'windows' : 'make -f make_mingw32.mak', |
||
| 224 | \ 'cygwin' : 'make -f make_cygwin.mak', |
||
| 225 | \ 'mac' : 'make -f make_mac.mak', |
||
| 226 | \ 'unix' : 'make -f make_unix.mak', |
||
| 227 | \ }, |
||
| 228 | \ } |
||
| 229 | NeoBundle 'VimClojure' |
||
| 230 | NeoBundle 'Shougo/vimshell' |
||
| 231 | NeoBundle 'Shougo/unite.vim' |
||
| 232 | NeoBundle 'Shougo/neosnippet' |
||
| 233 | NeoBundle 'jpalardy/vim-slime' |
||
| 234 | NeoBundle 'scrooloose/syntastic' |
||
| 235 | NeoBundle 'Shougo/vimfiler.vim' |
||
| 236 | NeoBundle 'itchyny/lightline.vim' |
||
| 237 | NeoBundle 't9md/vim-textmanip' |
||
| 238 | NeoBundle 'ujihisa/unite-colorscheme' |
||
| 239 | NeoBundle 'tomasr/molokai' |
||
| 240 | ""NeoBundle 'https://bitbucket.org/kovisoft/slimv' |
||
| 241 | |||
| 242 | NeoBundle 'scrooloose/nerdtree' |
||
| 243 | NeoBundle 'kien/ctrlp.vim' |
||
| 244 | |||
| 245 | NeoBundle "tyru/caw.vim.git" |
||
| 246 | nmap <Leader>c <Plug>(caw:i:toggle) |
||
| 247 | vmap <Leader>c <Plug>(caw:i:toggle) |
||
| 248 | |||
| 249 | |||
| 250 | "" neocomplcache |
||
| 251 | NeoBundle 'Shougo/neocomplcache' |
||
| 252 | " Disable AutoComplPop. |
||
| 253 | let g:acp_enableAtStartup = 0 |
||
| 254 | " " Use neocomplcache. |
||
| 255 | let g:neocomplcache_enable_at_startup = 1 |
||
| 256 | " " Use smartcase. |
||
| 257 | let g:neocomplcache_enable_smart_case = 1 |
||
| 258 | " " Set minimum syntax keyword length. |
||
| 259 | let g:neocomplcache_min_syntax_length = 3 |
||
| 260 | let g:neocomplcache_lock_buffer_name_pattern = '\*ku\*' |
||
| 261 | " |
||
| 262 | " " Define dictionary. |
||
| 263 | let g:neocomplcache_dictionary_filetype_lists = {
|
||
| 264 | \ 'default' : '' |
||
| 265 | \ } |
||
| 266 | " |
||
| 267 | " Plugin key-mappings. |
||
| 268 | inoremap <expr><C-g> neocomplcache#undo_completion() |
||
| 269 | inoremap <expr><C-l> neocomplcache#complete_common_string() |
||
| 270 | |||
| 271 | " Recommended key-mappings. |
||
| 272 | " <CR>: close popup and save indent. |
||
| 273 | inoremap <silent> <CR> <C-r>=<SID>my_cr_function()<CR> |
||
| 274 | function! s:my_cr_function() |
||
| 275 | return neocomplcache#smart_close_popup() . "\<CR>" |
||
| 276 | endfunction |
||
| 277 | " <TAB>: completion. |
||
| 278 | inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>" |
||
| 279 | " <C-h>, <BS>: close popup and delete backword char. |
||
| 280 | inoremap <expr><C-h> neocomplcache#smart_close_popup()."\<C-h>" |
||
| 281 | inoremap <expr><BS> neocomplcache#smart_close_popup()."\<C-h>" |
||
| 282 | inoremap <expr><C-y> neocomplcache#close_popup() |
||
| 283 | inoremap <expr><C-e> neocomplcache#cancel_popup() |
||
| 284 | |||
| 285 | NeoBundle 'tpope/vim-fugitive' |
||
| 286 | NeoBundle 'Shougo/unite-outline' |
||
| 287 | nnoremap <silent> <Leader>o :<C-u>Unite -vertical -no-quit outline<CR> |
||
| 288 | call neobundle#end() |
||
| 289 | |||
| 290 | " Required |
||
| 291 | filetype plugin indent on |
||
| 292 | |||
| 293 | " If there are uninstalled bundles found on startup, |
||
| 294 | " " this will conveniently prompt you to install them. |
||
| 295 | NeoBundleCheck |
||
| 296 | |||
| 297 | "" unite.vim {{{
|
||
| 298 | " The prefix key. |
||
| 299 | nnoremap [unite] <Nop> |
||
| 300 | nmap <Leader>f [unite] |
||
| 301 | |||
| 302 | " unite.vim keymap |
||
| 303 | " https://github.com/alwei/dotfiles/blob/3760650625663f3b08f24bc75762ec843ca7e112/.vimrc |
||
| 304 | nnoremap [unite]u :<C-u>Unite -no-split<Space> |
||
| 305 | nnoremap <silent> [unite]f :<C-u>Unite<Space>buffer<CR> |
||
| 306 | nnoremap <silent> [unite]b :<C-u>Unite<Space>bookmark<CR> |
||
| 307 | nnoremap <silent> [unite]m :<C-u>Unite<Space>file_mru<CR> |
||
| 308 | nnoremap <silent> [unite]r :<C-u>UniteWithBufferDir file<CR> |
||
| 309 | nnoremap <silent> ,vr :UniteResume<CR> |
||
| 310 | |||
| 311 | " vinarise |
||
| 312 | let g:vinarise_enable_auto_detect = 1 |
||
| 313 | |||
| 314 | let g:unite_winwidth = 40 |
||
| 315 | " unite-build map |
||
| 316 | nnoremap <silent> ,vb :Unite build<CR> |
||
| 317 | nnoremap <silent> ,vcb :Unite build:!<CR> |
||
| 318 | nnoremap <silent> ,vch :UniteBuildClearHighlight<CR> |
||
| 319 | nnoremap <silent> ,uo :Unite -vertical -no-quit outline<CR> |
||
| 320 | nnoremap <silent> ,uf :UniteWithBufferDir file<CR> |
||
| 321 | "" }}} |
||
| 322 |