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.
 
 
 
 
 
 

139 line
4.7 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 compatible "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 softtabstop=4
  48. set shiftwidth=4 "width of indent
  49. set expandtab "タブをスペースに展開する
  50. set autoindent "オートインデント
  51. set smartindent
  52. let g:netrw_liststyle = 1
  53. let g:netrw_list_hide = '\(^\|\s\s\)\zs\.\S\+'
  54. "gvimrc分けるのめんどい
  55. if has('gui_running')
  56. "ツールバー、スクロールバー消す
  57. set guioptions-=T
  58. set guioptions-=r
  59. set lines=45
  60. set columns=110
  61. set guifont=DejaVu\ Sans\ Mono\ 9
  62. endif
  63. if has('win32')
  64. "Windows 用の設定
  65. endif
  66. """""""""""""""""""""""""""""""""""""""
  67. "マップ
  68. "imap <c-j> <esc> でC-Jをescにできる。?
  69. "nmap
  70. "vmap
  71. "map でそれぞれのモードでマップを指定
  72. "キーマッピングには大きく分けて map と noremap の 2 つの種類があります。
  73. "* map はキーシーケンスを展開したあと、さらに別のマップを適用しようとします。
  74. "* noremap は一度だけ展開します。
  75. "→マップを再帰的に展開するときはmap、決め打ちはnoremap(キーの入れ替えなど)
  76. "割と保存
  77. inoremap <ESC> <ESC>:<C-u>w<CR>
  78. inoremap <C-c> <ESC>:<C-u>w<CR>
  79. noremap <C-c> <ESC>:<C-u>w<CR>
  80. "方向キーでバッファ操作
  81. "nnoremap <LEFT> <C-c>:bp!<CR>
  82. "nnoremap <RIGHT> <C-c>:bn!<CR>
  83. "nnoremap <UP> <C-c>:ls!<CR>
  84. "nnoremap <DOWN> <C-c>:bd
  85. "nnoremap <C-m>cd <C-c>:cd%:h<CR>
  86. nnoremap <C-o> <C-c>:Explore<CR>
  87. "http://d.hatena.ne.jp/yuroyoro/20101104/1288879591
  88. "見た目で行移動
  89. nnoremap j gj
  90. nnoremap k gk
  91. " highlight current line
  92. " set cursorline
  93. " カレントウィンドウにのみ罫線を引く
  94. augroup cch
  95. autocmd! cch
  96. autocmd WinLeave * set nocursorline
  97. autocmd WinEnter,BufRead * set cursorline
  98. augroup END
  99. hi clear CursorLine
  100. highlight CursorLine term=underline cterm=underline gui=underline
  101. "入力モード時、ステータスラインのカラーを変更
  102. augroup InsertHook
  103. autocmd!
  104. autocmd InsertEnter * highlight StatusLine guifg=#ccdc90 guibg=#2E4340
  105. autocmd InsertLeave * highlight StatusLine guifg=#2E4340 guibg=#ccdc90
  106. augroup END
  107. " save window position and size
  108. if has('gui_running')
  109. let g:save_window_file = expand('~/.vimwinpos')
  110. augroup SaveWindow
  111. autocmd!
  112. autocmd VimLeavePre * call s:save_window()
  113. function! s:save_window()
  114. let options = [
  115. \ 'set columns=' . &columns,
  116. \ 'set lines=' . &lines,
  117. \ 'winpos ' . getwinposx() . ' ' . getwinposy(),
  118. \ ]
  119. call writefile(options, g:save_window_file)
  120. endfunction
  121. augroup END
  122. if filereadable(g:save_window_file)
  123. execute 'source' g:save_window_file
  124. endif
  125. endif