.vimrc 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. set nocompatible
  2. set viminfo="NONE"
  3. "
  4. "
  5. " PLUGINS
  6. "
  7. "
  8. let mapleader = '|'
  9. let g:C_MapLeader = '|'
  10. "set tags+=~/.vim/tags/...
  11. set completeopt=menu
  12. let OmniCpp_DisplayMode = 1 "always show all members (private, public, protected)
  13. autocmd FileType python set omnifunc=pythoncomplete#Complete
  14. autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
  15. autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
  16. autocmd FileType css set omnifunc=csscomplete#CompleteCSS
  17. autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags
  18. autocmd FileType php set omnifunc=phpcomplete#CompletePHP
  19. autocmd FileType c set omnifunc=ccomplete#Complete
  20. filetype plugin indent on
  21. " DOXYGEN
  22. au BufNewFile,BufRead *.doxygen setfiletype doxygen
  23. let g:DoxygenToolkit_briefTag_pre="@brief "
  24. let g:DoxygenToolkit_paramTag_pre="@param[] "
  25. " let g:DoxygenToolkit_interCommentTag=" "
  26. " let g:DoxygenToolkit_interCommentBlock=""
  27. " let g:DoxygenToolkit_cinoptions = ""
  28. " C-support.vim
  29. " g:C_AuthorName, g:C_AuthorRef, let g:C_Email, g:C_Company in personal
  30. syn region cBlock start="{" end="}" transparent fold
  31. "set foldmethod=syntax
  32. " avoid autocompletion lags on large files
  33. set foldmethod=manual
  34. " initially all folds open:
  35. set foldlevel=999
  36. "
  37. "
  38. " PREFERENCES
  39. "
  40. "
  41. set title
  42. " set list listchars=tab:~~
  43. set complete+=k " scan the files given with the 'dictionary' option
  44. set shortmess=a "avoid the Hit ENTER to continue prompt
  45. set history=10
  46. set backspace=indent,eol,start "allow backspacing over everything in insert mode
  47. set nomodeline
  48. set display+=lastline
  49. set nobackup "do not keep a backup file, use versions instead
  50. set history=10 "keep 50 lines of command line history
  51. set ruler "show the cursor position all the time
  52. set viminfo=
  53. set nowrap
  54. set ignorecase
  55. set smartcase
  56. set noswapfile
  57. " , -- б does not work, backslash does not help
  58. set langmap=йцукенгшщзхъфывапролджэячсмитьюЙЦУКЕНГШЩЗХЪФЫВАПРОЛДЖЭЯЧСМИТЬБЮ;qwertyuiop[]asdfghjkl\;'zxcvbnm.QWERTYUIOP{}ASDFGHJKL\:\"ZXCVBNM<>
  59. set autoindent
  60. set noerrorbells
  61. set visualbell
  62. set nojoinspaces
  63. set fo=tcroqj
  64. " HIGHLIGHTING
  65. syntax on
  66. "syntax enable
  67. set hlsearch
  68. let g:load_doxygen_syntax=1
  69. set background=dark
  70. highlight cComment ctermfg=darkgreen guifg=darkgreen
  71. " TABULATION
  72. set tabstop=4
  73. set shiftwidth=4
  74. set expandtab
  75. " STATUS
  76. set statusline=%F%m%r%=\ %l\ %c\ fmt=%-4{&fileformat}\ file=%-6{&fileencoding}\ 0x%-2B\ %P
  77. set laststatus=2
  78. "
  79. "
  80. " KEYS
  81. "
  82. "
  83. " Don't use Ex mode, use Q for formatting
  84. map Q gw
  85. map <C-A> :set fo^=a<CR>
  86. map <Up> gk
  87. map <Down> gj
  88. map <C-N> :noh<CR>
  89. set pastetoggle=<M-1>
  90. map <S-Up> <Nop>
  91. map <S-Down> <Nop>
  92. imap <S-Up> <Up>
  93. imap <S-Down> <Down>
  94. " wordwise yank from line above
  95. " http://vim.wikia.com/wiki/Wordwise_Ctrl-Y_in_insert_mode
  96. inoremap <silent> <C-Y> <C-C>:let @z = @"<CR>mz
  97. \:exec 'normal!' (col('.')==1 && col('$')==1 ? 'k' : 'kl')<CR>
  98. \:exec (col('.')==col('$')-1 ? 'let @" = @_' : 'normal! yw')<CR>
  99. \`zp:let @" = @z<CR>a
  100. " ENCODINGS
  101. set fileencodings=utf-8,koi8-r,cp1251,ibm866
  102. " set termencoding=koi8-r
  103. set termencoding=utf-8
  104. map <S-F5> :set encoding=koi8-r<CR>
  105. map <S-F6> :set encoding=8bit-cp1251<CR>
  106. map <S-F7> :set encoding=8bit-cp866<CR>
  107. map <S-F8> :set encoding=utf8<CR>
  108. map <F5> :e ++enc=koi8-r<CR>
  109. map <F6> :e ++enc=cp1251<CR>
  110. map <F7> :e ++enc=ibm866<CR>
  111. map <F8> :e ++enc=utf-8<CR>
  112. map <C-F5> :set fileformat=unix<CR>
  113. map <C-F6> :set fileformat=dos<CR>
  114. map <C-F7> :set fileformat=mac<CR>
  115. " TOOLS
  116. map <F1> :wa<CR>:make<CR>
  117. map <F2> :cope<CR>
  118. map <F3> :cn<CR>
  119. map <F4> :cp<CR>
  120. " EXIT
  121. map <F9> :q!<CR>
  122. map <F10> :qa<CR>
  123. " map <F11> :%s/\s\+$//e<CR>:norm!``<CR>:noh<CR>:wa!<CR>:q!<CR>
  124. " map <F12> :%s/\s\+$//e<CR>:norm!``<CR>:noh<CR>:wa!<CR>
  125. map <F11> :norm!mw<CR>:%s/\s\+$//e<CR>:norm!`w<CR>:delmarks w<CR>:noh<CR>:wa!<CR>:q!<CR>
  126. map <F12> :norm!mw<CR>:%s/\s\+$//e<CR>:norm!`w<CR>:delmarks w<CR>:noh<CR>:wa!<CR>
  127. " NAVIGATION
  128. map <S-F11> :foldclose<CR>
  129. map <S-F12> :foldopen<CR>
  130. nnoremap <S-Tab> :bn!<CR>
  131. " map control-backspace to delete the previous word
  132. map <C-BS> <Esc>vBc
  133. " now _F will display which function you are currently in.
  134. map _F ma[[k"xyy`a:echo @x<CR>
  135. "
  136. "
  137. " OTHER
  138. "
  139. "
  140. " see .vim/after/syntax/tex.vim
  141. "
  142. "
  143. " COMMENTED
  144. "
  145. "
  146. "set softtabstop=2
  147. "map <C-F11> :set autoindent<CR>
  148. "map <C-F12> :set noautoindent<CR>
  149. " This is an alternative that also works in block mode, but the deleted
  150. " text is lost and it only works for putting the current register.
  151. "vnoremap p "_dp
  152. " taglist.vim : toggle the taglist window
  153. " noremap <silent> <S-F10> <Esc><Esc>:Tlist<CR>
  154. " inoremap <silent> <S-F10> <Esc><Esc>:Tlist<CR>