Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.
 
 
 
 
 
 

138 рядки
4.6 KiB

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