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