Advertisement
Haron_Prime

.vimrc

Nov 1st, 2015
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VIM 11.94 KB | None | 0 0
  1. if v:progname =~? "evim"
  2.   finish
  3. endif
  4.  
  5. set backspace=indent,eol,start
  6.  
  7. if has("vms")
  8.   set nobackup      " do not keep a backup file, use versions instead
  9. else
  10.   set backup        " keep a backup file (restore to previous version)
  11.   set undofile      " keep an undo file (undo changes after closing)
  12. endif
  13.  
  14. set backupcopy=auto
  15. set swapfile
  16. set swapsync=fsync
  17. set undolevels=1000                                 " 50 undos - saved in undodir
  18. set udf
  19. set udir=$HOME/.vim/undofiles//
  20. set directory=$HOME/.vim/swp//
  21. set modeline
  22. "set statusline=%M%h%y\ %t\ %F\ %p%%\ %l/%L\ %=[%{&ff},%{&ft}]\ [a=\%03.3b]\ [h=\%02.2B]\ [%l,%v]
  23. set statusline=%{fugitive#statusline()}%f%m%r%h%w\ %y\ enc:%{&enc}\ ff:%{&ff}\ fenc:%{&fenc}%=(ch:%3b\ hex:%2B)\ col:%2c\ line:%2l/%L\ [%2p%%]
  24. set title titlelen=150 titlestring=%(\ %M%)%(\ (%{expand(\"%:p:h\")})%)%(\ %a%)\ -\ %{v:servername}
  25. set ttyfast                                         " we have a fast terminal
  26. set scrolljump=5                                    " when scrolling up down, show at least 5 lines
  27. set ttyscroll=999                                   " make vim redraw screen instead of scrolling when there are more than 3 lines to be scrolled
  28. set updatecount=250                                 " switch every 250 chars, save swap
  29. set wrap
  30. set linebreak
  31. set list                                            " list disables linebreak
  32. set textwidth=0
  33. set wrapmargin=0
  34. set whichwrap+=b,s,<,>,h,l,[,]                      " backspaces and cursor keys wrap to
  35. set wildmenu
  36. set autoindent smartindent                          " auto/smart indent
  37. set autoread                                        " watch for file changes
  38. set cmdheight=1                                     " command line two lines high
  39. set complete=.,w,b,u,U,t,i,d                        " do lots of scanning on tab completion
  40. set cursorline                                      " show the cursor line
  41. set encoding=utf-8                                  " set charset translation encoding
  42. set termencoding=utf-8                              " set terminal encoding
  43. set fileencoding=utf-8                              " set save encoding
  44. set fileencodings=utf8,koi8r,cp1251,cp866,ucs-2le   " список предполагаемых кодировок, в порядке предпочтения
  45. set history=3000                                    " keep 3000 lines of command line history
  46. set keywordprg=TERM=mostlike\ man\ -s\ -Pless
  47. set laststatus=2
  48. set linebreak                                       " wrap at 'breakat' instead of last char
  49. set magic                                           " Enable the "magic"
  50. set maxmem=25123                                    " 24 MB -  max mem in Kbyte to use for one buffer.  Max is 2000000
  51. set noautowrite                                     " don't automagically write on :next
  52. set noexpandtab                                     " no expand tabs to spaces"
  53. set nohidden                                        " close the buffer when I close a tab (I use tabs more than buffers)
  54. "set noerrorbells visualbell t_vb= " Disable ALL bells
  55. set number                                          " line numbers
  56. "set pastetoggle=<F11>
  57. set scrolloff=3                                     " keep at least 3 lines above/below
  58. set shiftwidth=3                                    " shift width
  59. set showcmd                                         " Show us the command we're typing
  60. set showfulltag                                     " show full completion tags
  61. set showmode                                        " show the mode all the time
  62. set sidescroll=2                                    " if wrap is off, this is fasster for horizontal scrolling
  63. set sidescrolloff=2                                 "keep at least 5 lines left/right
  64. set noguipty
  65. set splitright
  66. set splitbelow
  67. set restorescreen=on                                " restore screen contents when vim exits -  disable withset t_ti= t_te=
  68. set winheight=25
  69. set equalalways                                     " all the windows are automatically sized same
  70. set eadirection=both                                " only equalalways for horizontally split windows
  71. set tabstop=4
  72. set softtabstop=4
  73. set shiftwidth=3
  74. set switchbuf=usetab
  75. set commentstring=#%s
  76. set tabpagemax=150
  77. set showtabline=1                                   " 2 always, 1 only if multiple tabs
  78. set smarttab                                        " tab and backspace are smart
  79. set foldmethod=syntax
  80. set foldenable
  81. set foldcolumn=1                                    " the blank left-most bar left of the numbered lines
  82. set sc                                              " override 'ignorecase' when pattern has upper case characters
  83. set smartcase                                       " Ignore case when searching lowercase
  84. set showmatch                                       " show matching bracket
  85. set diffopt=filler,iwhite                           " ignore all whitespace and sync"
  86. set stal=2
  87. set viewoptions=folds,localoptions,cursor
  88. set ruler                                           " show the cursor position all the time
  89. set showcmd                                         " display incomplete commands
  90. set incsearch                                       " do incremental searching
  91. set hlsearch
  92. set guiheadroom=0
  93.  
  94. set statusline+=%#warningmsg#
  95. set statusline+=%{SyntasticStatuslineFlag()}
  96. set statusline+=%*
  97.  
  98. let g:indentLine_color_term = 239
  99. let g:indentLine_enabled = 1
  100. " let g:indentLine_char = '│'
  101.  
  102. let g:syntastic_always_populate_loc_list = 3
  103. let g:syntastic_auto_loc_list = 1
  104. let g:syntastic_check_on_open = 1
  105. let g:syntastic_check_on_wq = 0
  106. " let g:syntastic_haskell_ghc_mod_exec = 'ghc-mod.sh'
  107.  
  108. " Don't use Ex mode, use Q for formatting
  109. map Q gq
  110.  
  111. " CTRL-U in insert mode deletes a lot.  Use CTRL-G u to first break undo,
  112. " so that you can undo CTRL-U after inserting a line break.
  113. inoremap <C-U> <C-G>u<C-U>
  114.  
  115. " In many terminal emulators the mouse works just fine, thus enable it.
  116. if has('mouse')
  117.   set mouse=a
  118. endif
  119.  
  120. " Switch syntax highlighting on, when the terminal has colors
  121. " Also switch on highlighting the last used search pattern.
  122. if &t_Co > 2 || has("gui_running")
  123.   syntax on
  124.   set hlsearch
  125. endif
  126.  
  127. " Only do this part when compiled with support for autocommands.
  128. if has("autocmd")
  129.  
  130.   " Enable file type detection.
  131.   " Use the default filetype settings, so that mail gets 'tw' set to 72,
  132.   " 'cindent' is on in C files, etc.
  133.   " Also load indent files, to automatically do language-dependent indenting.
  134.   filetype plugin indent on
  135.  
  136.   " Put these in an autocmd group, so that we can delete them easily.
  137.   augroup vimrcEx
  138.   au!
  139.  
  140.   " For all text files set 'textwidth' to 78 characters.
  141.   autocmd FileType text setlocal textwidth=78
  142.  
  143.   " When editing a file, always jump to the last known cursor position.
  144.   " Don't do it when the position is invalid or when inside an event handler
  145.   " (happens when dropping a file on gvim).
  146.   autocmd BufReadPost *
  147.     \ if line("'\"") >= 1 && line("'\"") <= line("$") |
  148.     \   exe "normal! g`\"" |
  149.     \ endif
  150.  
  151.   augroup END
  152.  
  153. else
  154.  
  155.   set autoindent        " always set autoindenting on
  156.  
  157. endif " has("autocmd")
  158.  
  159. " Convenient command to see the difference between the current buffer and the
  160. " file it was loaded from, thus the changes you made.
  161. " Only define it when not defined already.
  162. if !exists(":DiffOrig")
  163.   command DiffOrig vert new | set bt=nofile | r ++edit # | 0d_ | diffthis
  164.           \ | wincmd p | diffthis
  165. endif
  166.  
  167. if has('langmap') && exists('+langnoremap')
  168.   " Prevent that the langmap option applies to characters that result from a
  169.   " mapping.  If unset (default), this may break plugins (but it's backward
  170.   " compatible).
  171.   set langnoremap
  172. endif
  173.  
  174.  
  175. " настройки Vundle
  176. set rtp+=~/.vim/bundle/vundle/
  177.  
  178. call vundle#rc()
  179.  
  180. filetype plugin indent on
  181.  
  182. "репозитории на github
  183. "Bundle 'tpope/vim-fugitive'
  184. Bundle 'lokaltog/vim-easymotion'
  185. Bundle 'rstacruz/sparkup', {'rtp': 'vim/'}
  186.  
  187. "репозитории vim/scripts
  188. Bundle 'L9'
  189. Bundle 'FuzzyFinder'
  190. Bundle 'rails.vim'
  191. Bundle 'chilicuil/vim-sprunge'
  192.  
  193. "git репозитории (не на github)
  194. "Bundle 'git://git.wincent.com/command-t.git'
  195.  
  196. "плагины
  197. Plugin 'bling/vim-bufferline'
  198. Plugin 'MattesGroeger/vim-bookmarks'
  199. Plugin 'mattn/emmet-vim'
  200. Plugin 'aperezdc/vim-template'
  201. Plugin 'int3/vim-extradite'
  202. Plugin 'vim-scripts/fugitive.vim'
  203. Plugin 'vim-scripts/gitv'
  204. Plugin 'sjl/gundo.vim'
  205. Plugin 'vim-scripts/netrw.vim'
  206. Plugin 'vim-scripts/sudo.vim'
  207. Plugin 'scrooloose/nerdtree'
  208. Plugin 'Valloric/YouCompleteMe'
  209. Plugin 'tomtom/tcomment_vim'
  210. Plugin 'vim-scripts/toggle_words.vim'
  211. Plugin 'scrooloose/syntastic'
  212. Plugin 'terryma/vim-multiple-cursors'
  213. Plugin 'airblade/vim-gitgutter'
  214. Plugin 'Yggdroot/indentLine'
  215.  
  216. "My settings
  217.  
  218. filetype on
  219.  
  220. set guiheadroom=0
  221. set t_Co=256
  222. set showmatch
  223. set list lcs=tab:>-,space:.
  224. set showcmd
  225.  
  226. color evening
  227.  
  228. let Tlist_Compact_Format = 1
  229. let Tlist_GainFocus_On_ToggleOpen = 1
  230. let Tlist_Close_On_Select = 1
  231. nnoremap <C-l> :TlistToggle<CR>
  232.  
  233. "let g:extradite_width=40
  234.  
  235. let g:user_emmet_mode='a'
  236.  
  237. autocmd VimLeavePre * silent mksession $HOME/.vim/lastSession.vim
  238.  
  239. if has("autocmd")
  240.         au BufNewFile,BufRead * if getline(1) =~ '^#!.*iptables-restore' ||
  241.                 \ getline(1) =~ '^# Generated by iptables-save' ||
  242.                 \ getline(1) =~ '^# Firewall configuration written by' |
  243.                 \ set ft=iptables | endif
  244. endif
  245.  
  246. "let g:bookmark_sign = '♥'
  247. let g:bookmark_sign = 'β'
  248. let g:bookmark_auto_save = 1
  249. let g:bookmark_manage_per_buffer = 1
  250. let g:bookmark_auto_save_file = '/bookmarks'
  251.  
  252. let &keywordprg=':help'
  253.  
  254. " set list lcs=tab:\|\
  255. let g:gundo_width = 60
  256. let g:gundo_preview_height = 40
  257. let g:gundo_right = 1
  258.  
  259. set backup
  260.  
  261. " сохранять умные резервные копии ежедневно
  262. function! BackupDir()
  263.     " определим каталог для сохранения резервной копии
  264.     let l:backupdir=$HOME.'/.vim/backup/'.
  265.             \substitute(expand('%:p:h'), '^'.$HOME, '~', '')
  266.  
  267.     " если каталог не существует, создадим его рекурсивно
  268.     if !isdirectory(l:backupdir)
  269.         call mkdir(l:backupdir, 'p', 0700)
  270.     endif
  271.  
  272.     " переопределим каталог для резервных копий
  273.     let &backupdir=l:backupdir
  274.  
  275.     " переопределим расширение файла резервной копии
  276.     let &backupext=strftime('~%Y-%m-%d~')
  277. endfunction
  278.  
  279. " выполним перед записью буффера на диск
  280. autocmd! bufwritepre * call BackupDir()
  281.  
  282. "" Удалить пробелы в конце строк (frantsev)
  283. function! RemoveTrailingSpaces()
  284.    normal! mzHmy
  285.    execute '%s:\s\+$::ge'
  286.    normal! 'yzt`z
  287. endfunction
  288.  
  289. let g:ycm_filetype_specific_completion_to_disable = {
  290.      \ 'gitcommit': 1
  291.      \}
  292.  
  293.  
  294.  
  295. "My keybinding
  296.  
  297. "inoremap { {<CR>}<Esc>O
  298. nmap      <F2>         :qa<CR>
  299. nmap      <F3>         <Esc>:q<CR>
  300. imap      <F3>         <Esc>:wq<CR>
  301. imap      <F4>         <Esc>:w<CR>
  302. nmap      <F4>         :w<CR>
  303. map       <F5>         :NERDTreeToggle<CR>
  304. nnoremap  <F6>         :GundoToggle<CR>
  305. nmap      <F7>         :r! xclip -o<CR>
  306. imap      <F7>         <Esc>:r! xclip -o<CR><S-A>
  307. nmap      <F8>         <Esc>:browse tabnew<CR>
  308. imap      <F8>         <Esc>:browse tabnew<CR>
  309. nmap      <F9>         <Plug>(openbrowser-open)
  310. vmap      <F9>         <Plug>(openbrowser-open)
  311. nmap      <F10>        <Plug>(openbrowser-search)
  312. vmap      <F10>        <Plug>(openbrowser-search)
  313. nmap      <F11>        :source ~/.vim/lastSession.vim<CR>
  314. " imap      <Tab>        <C-N>
  315. map       <S-Insert>   <MiddleMouse>
  316. map!      <S-Insert>   <MiddleMouse>
  317. nnoremap  <space>      za
  318. map       <C-C>        gcc
  319. nmap      <S-T>        :ToggleWord<CR>
  320. nmap      <S-S>        :source $HOME/.vimrc<CR>
  321. nmap      yy           yy:silent .w !xclip&lt;<CR>
  322. vmap      y            y:silent '<,'> w !xclip&lt;<CR>
  323. map       <S-A>        :IndentLinesToggle<CR>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement