You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

vimrc 4.7 KiB

12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. " 外部ファイル読み込み
  2. " if filereadable(expand('~/filepath'))
  3. " source ~/filepath
  4. " endif
  5. if !isdirectory(expand('~/.vim'))
  6. call mkdir(expand('~/.vim'))
  7. endif
  8. """""""""""""""""""""""""""""""""""
  9. set compatible " vi compatible
  10. " バックアップファイルを作るディレクトリ
  11. if !isdirectory(expand('~/.vim/backup'))
  12. call mkdir(expand('~/.vim/backup'))
  13. endif
  14. set backup " バックアップ
  15. set backupdir=$HOME/.vim/backup
  16. set swapfile " スワップファイル用のディレクトリ
  17. set directory=$HOME/.vim/backup
  18. set viminfo+=n~/.vim/viminfo " viminfo
  19. set list " タブ文字、行末など不可視文字を表示する
  20. set listchars=tab:>-,extends:<,trail:-,eol:$ " listで表示される文字のフォーマットを指定する
  21. set showmatch " 閉じ括弧が入力されたとき、対応する括弧を表示する
  22. set ignorecase
  23. set smartcase " 検索時に大文字を含んでいたら大/小を区別
  24. set whichwrap=b,s,h,l,<,>,[,] " カーソルを行頭、行末で止まらないようにする
  25. set showmode " モード表示
  26. set notitle " do not display editting file on titlebar
  27. set incsearch
  28. set wrapscan " 折り返し検索
  29. set showmatch " 括弧を閉じた時、対になる括弧を一瞬ハイライトする
  30. set wildmode=longest,list,full
  31. set ruler " 行番号、カーソル位置を表示
  32. set nonumber " do not show line number at left side
  33. set laststatus=2 " ステータスラインを常に表示
  34. set showcmd
  35. set scrolloff=2 " 常に前後2行を表示
  36. syntax enable " シンタックス
  37. set hidden " 編集中でも他ファイルへ移動可
  38. set backspace=indent,eol,start " バックスペースでなんでも消せるように
  39. " set autochdir " 自動的にカレントディレクトリを現在のファイルのディレクトリにする macだと出来ないってゆわれた
  40. set encoding=utf-8 " 言語設定
  41. set fileencodings=utf-8,shift-jis,euc-jp,latin1
  42. set mouse=h " マウス使わない
  43. set clipboard+=unnamed " クリップボードをWindowsと連携
  44. set visualbell " ビープしない
  45. set browsedir=buffer " バッファで開いているファイルのディレクトリ
  46. set tabstop=4 " タブの画面上での幅
  47. set softtabstop=4
  48. set shiftwidth=4 " width of indent
  49. set expandtab " タブをスペースに展開する
  50. set autoindent " オートインデント
  51. set smartindent
  52. filetype plugin indent on
  53. let g:netrw_liststyle = 1
  54. let g:netrw_list_hide = '\(^\|\s\s\)\zs\.\S\+'
  55. " gvimrc分けるのめんどい
  56. if has('gui_running')
  57. " ツールバー、スクロールバー消す
  58. set guioptions-=T
  59. set guioptions-=r
  60. set lines=45
  61. set columns=110
  62. set guifont=DejaVu\ Sans\ Mono\ 9
  63. endif
  64. if has('win32')
  65. " Windows 用の設定
  66. endif
  67. """""""""""""""""""""""""""""""""""""""
  68. " マップ
  69. " imap <c-j> <esc> でC-Jをescにできる。?
  70. " nmap
  71. " vmap
  72. " map でそれぞれのモードでマップを指定
  73. " キーマッピングには大きく分けて map と noremap の 2 つの種類があります。
  74. " * map はキーシーケンスを展開したあと、さらに別のマップを適用しようとします。
  75. " * noremap は一度だけ展開します。
  76. " →マップを再帰的に展開するときはmap、決め打ちはnoremap(キーの入れ替えなど)
  77. " 割と保存
  78. inoremap <ESC> <ESC>:<C-u>w<CR>
  79. inoremap <C-c> <ESC>:<C-u>w<CR>
  80. noremap <C-c> <ESC>:<C-u>w<CR>
  81. " 方向キーでバッファ操作
  82. " nnoremap <LEFT> <C-c>:bp!<CR>
  83. " nnoremap <RIGHT> <C-c>:bn!<CR>
  84. " nnoremap <UP> <C-c>:ls!<CR>
  85. " nnoremap <DOWN> <C-c>:bd
  86. " nnoremap <C-m>cd <C-c>:cd%:h<CR>
  87. nnoremap <C-o> <C-c>:Explore<CR>
  88. " http://d.hatena.ne.jp/yuroyoro/20101104/1288879591
  89. " 見た目で行移動
  90. nnoremap j gj
  91. nnoremap k gk
  92. " highlight current line
  93. " set cursorline
  94. " カレントウィンドウにのみ罫線を引く
  95. augroup cch
  96. autocmd! cch
  97. autocmd WinLeave * set nocursorline
  98. autocmd WinEnter,BufRead * set cursorline
  99. augroup END
  100. hi clear CursorLine
  101. highlight CursorLine term=underline cterm=underline gui=underline
  102. " 入力モード時、ステータスラインのカラーを変更
  103. augroup InsertHook
  104. autocmd!
  105. autocmd InsertEnter * highlight StatusLine guifg=#ccdc90 guibg=#2E4340
  106. autocmd InsertLeave * highlight StatusLine guifg=#2E4340 guibg=#ccdc90
  107. augroup END
  108. " save window position and size
  109. if has('gui_running')
  110. let g:save_window_file = expand('~/.vimwinpos')
  111. augroup SaveWindow
  112. autocmd!
  113. autocmd VimLeavePre * call s:save_window()
  114. function! s:save_window()
  115. let options = [
  116. \ 'set columns=' . &columns,
  117. \ 'set lines=' . &lines,
  118. \ 'winpos ' . getwinposx() . ' ' . getwinposy(),
  119. \ ]
  120. call writefile(options, g:save_window_file)
  121. endfunction
  122. augroup END
  123. if filereadable(g:save_window_file)
  124. execute 'source' g:save_window_file
  125. endif
  126. endif