My home config
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.

.vimrc 6.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. " http://kastaneda.kiev.ua/desktop/dotrc/vim.html
  2. " общие настройки
  3. syntax on " включить подсветку синтаксиса
  4. set ts=4 " у меня табуляция (tabstop) 4 символа
  5. set tabstop=4
  6. set shiftwidth=4
  7. set textwidth=79
  8. set tw=79
  9. set colorcolumn=80,120,160
  10. "set expandtab
  11. set autoindent
  12. set copyindent
  13. "set background=dark " весьма важная штука! :)
  14. set lbr
  15. set showcmd
  16. set nocompatible " обойдёмся без стандартного vi
  17. set backspace=indent,eol,start
  18. color backbone
  19. set number
  20. nmap <F6> :set invlist<cr>
  21. " set breakindent " https://www.linux.org.ru/forum/general/10615635?lastmod=1403800233259
  22. " https://ru.wikibooks.org/wiki/Vim#%D0%A1%D0%BF%D0%BE%D1%81%D0%BE%D0%B1_2
  23. set langmap=ёйцукенгшщзхъфывапролджэячсмитьбю;`qwertyuiop[]asdfghjkl\\;'zxcvbnm\\,.,ЙЦУКЕHГШЩЗХЪФЫВАПРОЛДЖЭЯЧСМИТЬБЮ;QWERTYUIOP{}ASDFGHJKL:\\"ZXCVBNM<>
  24. " Setup for the GNU coding format standard
  25. function! GnuIndent()
  26. setlocal cinoptions=>4,n-2,{2,^-2,:2,=2,g0,h2,p5,t0,+2,(0,u0,w1,m1
  27. setlocal shiftwidth=2
  28. setlocal tabstop=4
  29. endfunction
  30. " Setup for the CPP coding format standard
  31. function! CppIndent()
  32. setlocal shiftwidth=4
  33. setlocal tabstop=4
  34. setlocal noexpandtab
  35. set textwidth=119
  36. set tw=119
  37. set colorcolumn=120,160
  38. endfunction
  39. " Setup for the Sh coding format standard
  40. function! ShIndent()
  41. setlocal shiftwidth=4
  42. setlocal tabstop=4
  43. setlocal noexpandtab
  44. endfunction
  45. " Setup for the Vala coding format standard
  46. function! ValaIndent()
  47. setlocal shiftwidth=4
  48. setlocal tabstop=4
  49. setlocal noexpandtab
  50. set textwidth=119
  51. set tw=119
  52. set colorcolumn=120,160
  53. endfunction
  54. au FileType c call GnuIndent()
  55. au FileType cpp call CppIndent()
  56. au FileType vala,vapi call ValaIndent()
  57. au FileType sh call ShIndent()
  58. " отключение бэкапов
  59. set nobackup
  60. " set backup
  61. " set backupdir=$HOME/.vim/backups
  62. " set directory=$HOME/.vim/temp
  63. " чтобы курсор не прыгал, а вёл себя так, как kwrite и т.п.
  64. nnoremap j gj
  65. nnoremap k gk
  66. vnoremap j gj
  67. vnoremap k gk
  68. nnoremap <Down> gj
  69. nnoremap <Up> gk
  70. vnoremap <Down> gj
  71. vnoremap <Up> gk
  72. inoremap <Down> <C-o>gj
  73. inoremap <Up> <C-o>gk
  74. " файлы автоматом делаются исполняемыми
  75. function ModeChange()
  76. if getline(1) =~ "^#!"
  77. if getline(1) =~ "/bin/"
  78. silent !chmod a+x <afile>
  79. endif
  80. endif
  81. endfunction
  82. au BufWritePost * call ModeChange()
  83. " интуитивные горячие клавиши =)
  84. imap <F11> <Esc>:set<Space>nu!<CR>a
  85. nmap <F11> :set<Space>nu!<CR>
  86. nmap <F2> :w<cr>
  87. vmap <F2> <esc>:w<cr>i
  88. imap <F2> <esc>:w<cr>i
  89. nmap <F10> :q!<cr>
  90. vmap <F10> <esc>:q!<cr>i
  91. imap <F10> <esc>:q!<cr>i
  92. " вкладки
  93. :set tabpagemax=99
  94. nmap <C-a> :tabnew<cr>
  95. imap <C-a> <ESC>:tabnew<cr>
  96. map <C-x>n :tabnext<cr>
  97. nmap <C-x>n :tabnext<cr>
  98. imap <C-x>n :tabnext<cr>
  99. map <C-x>p :tabprev<cr>
  100. nmap <C-x>p :tabprev<cr>
  101. imap <C-x>p :tabprev<cr>
  102. " кириллица
  103. set encoding=utf-8
  104. set termencoding=utf-8
  105. set fileencoding=utf-8
  106. set wildmenu
  107. set wcm=<Tab>
  108. menu Encoding.CP1251 :e ++enc=cp1251<CR>
  109. menu Encoding.CP866 :e ++enc=cp866<CR>
  110. menu Encoding.KOI8-U :e ++enc=koi8-u<CR>
  111. menu Encoding.UTF-8 :e ++enc=utf-8<CR>
  112. map <F8> :emenu Encoding.<TAB>
  113. set fileencodings=utf-8,cp1251,cp866,koi8-r
  114. " вкл/выкл автоперенос
  115. set pastetoggle=<F5>
  116. " set paste
  117. " nmap <F6> :set noautoindent<cr>
  118. " imap <F6> :set noautoindent<cr>
  119. " nmap <F5> :set autoindent<cr>
  120. " imap <F5> :set autoindent<cr>
  121. " inoremap <silent> <C-u> <ESC>u:set paste<CR>.:set nopaste<CR>gi " чтобы отступы не съезжали при вставке из буфера X Window
  122. " FONT SIZE SHORTCUTS
  123. set guifont=Liberation\ Mono\ 8
  124. let g:MyFontSize = 8
  125. function! ToggleMyFontSize()
  126. if ( g:MyFontSize == 10 )
  127. let g:MyFontSize = 8
  128. elseif ( g:MyFontSize == 8 )
  129. let g:MyFontSize = 9
  130. elseif ( g:MyFontSize == 9 )
  131. let g:MyFontSize = 10
  132. endif
  133. execute "set guifont=Liberation\\ Mono\\ ".g:MyFontSize
  134. endfunction
  135. nnoremap <silent> <F12> :call ToggleMyFontSize()<CR>
  136. " теги
  137. set tags+=./.ctags
  138. set tags+=~/.big/ctags
  139. cscope add ./.cscope
  140. cscope add ~/.big/cscope
  141. map <F4> [I:let nr = input("Which one: ")<Bar>exe "normal " . nr ."[\t"<CR>
  142. " Foldging
  143. set foldenable
  144. set foldmethod=syntax
  145. " VUNDLE "
  146. set nocompatible " be iMproved
  147. filetype off " required!
  148. set rtp+=~/.vim/bundle/vundle/
  149. call vundle#rc()
  150. " let Vundle manage Vundle
  151. " required!
  152. Bundle 'gmarik/vundle'
  153. " My Bundles here:
  154. "
  155. " original repos on github
  156. Bundle 'tpope/vim-fugitive'
  157. Bundle 'Lokaltog/vim-easymotion'
  158. "Bundle 'rstacruz/sparkup', {'rtp': 'vim/'}
  159. Bundle 'tpope/vim-rails.git'
  160. " vim-scripts repos
  161. Bundle 'L9'
  162. Bundle 'FuzzyFinder'
  163. Bundle 'vim-tags'
  164. " non github repos
  165. Bundle 'git://git.wincent.com/command-t.git'
  166. " ...
  167. Bundle 'majutsushi/tagbar'
  168. Bundle 'vim-startify'
  169. Bundle 'clang-complete'
  170. Bundle 'scrooloose/nerdcommenter'
  171. filetype plugin indent on " required!
  172. "
  173. " Brief help
  174. " :BundleList - list configured bundles
  175. " :BundleInstall(!) - install(update) bundles
  176. " :BundleSearch(!) foo - search(or refresh cache first) for foo
  177. " :BundleClean(!) - confirm(or auto-approve) removal of unused bundles
  178. "
  179. " see :h vundle for more details or wiki for FAQ
  180. " NOTE: comments after Bundle command are not allowed..
  181. " clang_complete
  182. " let g:clang_complete_copen = 1
  183. " let g:clang_user_options='|| exit 0'
  184. filetype plugin on
  185. let g:clang_library_path="/usr/lib/llvm"
  186. let g:clang_user_options='|| exit 0'
  187. let g:clang_complete_auto = 1
  188. let g:clang_complete_copen = 0
  189. " ------- Vala --------
  190. " Disable valadoc syntax highlight
  191. "let vala_ignore_valadoc = 1
  192. " Enable comment strings
  193. let vala_comment_strings = 1
  194. " Highlight space errors
  195. let vala_space_errors = 1
  196. " Disable trailing space errors
  197. "let vala_no_trail_space_error = 1
  198. " Disable space-tab-space errors
  199. let vala_no_tab_space_error = 1
  200. " Minimum lines used for comment syncing (default 50)
  201. "let vala_minlines = 120
  202. " ----- Vala taglist ------
  203. " Work-around Tag List for Vala
  204. let tlist_vala_settings='c#;d:macro;t:typedef;n:namespace;c:class;'.
  205. \ 'E:event;g:enum;s:struct;i:interface;'.
  206. \ 'p:properties;m:method'
  207. " ----- TagBar ------
  208. nmap <F9> :TagbarToggle<CR>
  209. let g:tagbar_ctags_bin = "anjuta-tags"
  210. " ----- NERDTree ------
  211. nmap <F12> :NERDTreeToggle<CR>
  212. " ------- VimDiff -------
  213. if &diff
  214. let mapleader = ","
  215. map dp1 :diffput LOCAL<CR>
  216. map dp2 :diffput BASE<CR>
  217. map dp3 :diffput REMOTE<CR>
  218. map do1 :diffget LOCAL<CR>
  219. map do2 :diffget BASE<CR>
  220. map do3 :diffget REMOTE<CR>
  221. endif