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.
 
 
 
 
 
 

140 lines
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 wildmode=longest,list,full
  32. set ruler "行番号、カーソル位置を表示
  33. set nonumber " do not show line number at left side
  34. set laststatus=2 "ステータスラインを常に表示
  35. set showcmd
  36. set scrolloff=2 "常に前後2行を表示
  37. syntax enable "シンタックス
  38. set hidden "編集中でも他ファイルへ移動可
  39. set backspace=indent,eol,start "バックスペースでなんでも消せるように
  40. "set autochdir "自動的にカレントディレクトリを現在のファイルのディレクトリにする macだと出来ないってゆわれた
  41. set encoding=utf-8 "言語設定
  42. set fileencodings=utf-8,shift-jis,euc-jp,latin1
  43. set mouse=h "マウス使わない
  44. set clipboard+=unnamed "クリップボードをWindowsと連携
  45. set visualbell "ビープしない
  46. set browsedir=buffer "バッファで開いているファイルのディレクトリ
  47. set tabstop=4 "タブの画面上での幅
  48. set softtabstop=4
  49. set shiftwidth=4 "width of indent
  50. set expandtab "タブをスペースに展開する
  51. set autoindent "オートインデント
  52. set smartindent
  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