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.
 
 
 
 
 
 

138 regels
4.1 KiB

  1. " "load external file
  2. " SETUP_LOAD: if filereadable(expand('DOTFILES_DIR/vimrc'))
  3. " SETUP_LOAD: source DOTFILES_DIR/vimrc
  4. " SETUP_LOAD: endif
  5. if !isdirectory(expand('~/.vim'))
  6. call mkdir(expand('~/.vim'))
  7. endif
  8. """""""""""""""""""""""""""""""""""
  9. set compatible " vi compatible
  10. " directory to put backup file
  11. if !isdirectory(expand('~/.vim/backup'))
  12. call mkdir(expand('~/.vim/backup'))
  13. endif
  14. set backup " enable backup
  15. set backupdir=$HOME/.vim/backup
  16. set swapfile " directory for swap file
  17. set directory=$HOME/.vim/backup
  18. set viminfo+=n~/.vim/viminfo " viminfo
  19. "set whichwrap=b,s,h,l,<,>,[,] " wrap when moving cursor
  20. set wildmode=longest,list,full
  21. set hidden " can switch to another buffer even when editting a file
  22. "set backspace=indent,eol,start " backspace can erase these things
  23. " automatically change current dir according to current file. cant use with mac
  24. "set autochdir
  25. set mouse=h " do not use mouse
  26. set clipboard+=unnamed " use x clipboard, seems not to work
  27. set browsedir=buffer " default dir for Explorer
  28. " encoding
  29. set encoding=utf-8
  30. set fileencodings=utf-8,shift-jis,euc-jp,latin1
  31. " display
  32. set showmode
  33. set title " display editting file on titlebar
  34. set list " display spcial letters such as newline or whitespace
  35. " set letters for displaying special letter
  36. set listchars=tab:>-,extends:<,trail:-,eol:$
  37. set ruler " display current line and column
  38. set nonumber " do not show line number at left side
  39. "set laststatus=2 " always show status line
  40. set scrolloff=2 " scroll offset
  41. set showcmd
  42. set visualbell " dont beep
  43. syntax enable " enable syntax highlight
  44. " searching
  45. "set incsearch
  46. set wrapscan " wrap search
  47. set showmatch " highlight matching paren
  48. set ignorecase
  49. set smartcase " case sensitive only when capital letter is used
  50. set incsearch
  51. " tab and indent
  52. set tabstop=4 " tab width for displaying
  53. set softtabstop=4
  54. set shiftwidth=4 " width of indent
  55. set expandtab " expand tab to space
  56. set autoindent
  57. set smartindent
  58. set cindent
  59. filetype plugin indent on
  60. let g:netrw_liststyle = 1
  61. let g:netrw_list_hide = '\(^\|\s\s\)\zs\.\S\+'
  62. " for gvim
  63. if has('gui_running')
  64. " hide toolbar and scroll bar
  65. set guioptions-=T
  66. set guioptions-=r
  67. set lines=45
  68. set columns=110
  69. set guifont=DejaVu\ Sans\ Mono\ 9
  70. endif
  71. if has('win32')
  72. " prefs for Windows
  73. endif
  74. """""""""""""""""""""""""""""""""""""""
  75. " マップ
  76. " imap <c-j> <esc> でC-Jをescにできる。?
  77. " nmap
  78. " vmap
  79. " map でそれぞれのモードでマップを指定
  80. " キーマッピングには大きく分けて map と noremap の 2 つの種類があります。
  81. " * map はキーシーケンスを展開したあと、さらに別のマップを適用しようとします。
  82. " * noremap は一度だけ展開します。
  83. " →マップを再帰的に展開するときはmap、決め打ちはnoremap(キーの入れ替えなど)
  84. " 割と保存
  85. inoremap <ESC> <ESC>:<C-u>w<CR>
  86. inoremap <C-c> <ESC>:<C-u>w<CR>
  87. noremap <C-c> <ESC>:<C-u>w<CR>
  88. " highlight current line
  89. " set cursorline
  90. " show cursor line only in current window
  91. " not work in term-mode of emacs
  92. " augroup cch
  93. " autocmd! cch
  94. " autocmd WinLeave * set nocursorline
  95. " autocmd WinEnter,BufRead * set cursorline
  96. " augroup END
  97. hi clear CursorLine
  98. highlight CursorLine term=underline cterm=underline gui=underline
  99. " change status line color when in insert mode
  100. augroup InsertHook
  101. autocmd!
  102. autocmd InsertEnter * highlight StatusLine guifg=#ccdc90 guibg=#2E4340
  103. autocmd InsertLeave * highlight StatusLine guifg=#2E4340 guibg=#ccdc90
  104. augroup END
  105. " save window position and size
  106. if has('gui_running')
  107. let g:save_window_file = expand('~/.vimwinpos')
  108. augroup SaveWindow
  109. autocmd!
  110. autocmd VimLeavePre * call s:save_window()
  111. function! s:save_window()
  112. let options = [
  113. \ 'set columns=' . &columns,
  114. \ 'set lines=' . &lines,
  115. \ 'winpos ' . getwinposx() . ' ' . getwinposy(),
  116. \ ]
  117. call writefile(options, g:save_window_file)
  118. endfunction
  119. augroup END
  120. if filereadable(g:save_window_file)
  121. execute 'source' g:save_window_file
  122. endif
  123. endif