/
vimrc
164 lines (130 loc) · 3.27 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
set nocompatible
filetype off
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
Bundle 'gmarik/vundle'
if filereadable(expand("~/.vim/vimrc.bundles"))
source ~/.vim/vimrc.bundles
endif
filetype plugin indent on
set backup
set backupdir=$HOME/.vimruntime/backups
set directory=$HOME/.vimruntime/tmp
"set background=dark
set background=light
set backspace=indent,eol,start
syntax on
"set autochdir
set ttyfast
set lazyredraw
set clipboard=unnamed
set mouse=n
set novisualbell
set history=1000
set undolevels=1000
set modeline
set modelines=5
set hidden " allow to switch buffers without saving
" basic ui
set shortmess=asI
set report=0
set showcmd
set showmode
set wildignore=*.o,*.so,*.pico,*.obj,*.bak,*.exe,*.pyc,*.jpg,*.gif,*.png,*.beam,tags,*.class,*.hi,*.chi,*.dyn_o,*.dyn_hi,*.dylib
set wildmenu
set wildmode=list:full
set cursorline
set ruler
set hlsearch
nmap \q :nohlsearch<CR>
" matching parenthesis
set showmatch
set matchtime=5
" movement
set iskeyword+=_,$,@,%,#
set nostartofline
set scrolloff=5
set sidescrolloff=18
set wrap
set linebreak
" editing
"set keymap=russian-jcukenwin " ^6 to change
set keymap=ukrainian-jcuken " ^6 to change
set iminsert=0 " latin by default
set imsearch=0
" completion
set complete+=. " current buffer
set complete+=k " dictionary
set complete+=b " other bufs
set complete+=t " tags
set completeopt+=menuone " always show the completion menu
set completeopt+=preview " sometimes annoying window on the top
set completeopt+=longest " do not select the first variant by default
" autoclose preview after menu hides
"autocmd CursorMovedI * if pumvisible() == 0|pclose|endif
autocmd InsertLeave * if pumvisible() == 0|pclose|endif
nnoremap ;s :%s/\<<C-r><C-w>\>/
" mappings
nmap :W :w
nmap :Q :q
nmap :WQ :wq
nmap :Wq :wq
nmap <Leader>ZZ :qa<CR>
nmap <Leader>ll :set list<CR>
nmap <Leader>l; :set nolist<CR>
nmap <Leader><space> :nohl<CR>
" close window
nmap <C-c> :close<CR>
" close buffer
nmap <Leader>c :bd<CR>
"map <Leader>tl :TlistToggle<CR>
nmap <Leader>tl :TagbarToggle<CR>
map <F12> :NERDTreeToggle<CR>
" window movement
map <C-h> <C-w>h
map <C-j> <C-w>j
map <C-k> <C-w>k
map <C-l> <C-w>l
" window movement + size adjustment
map <C-H> <C-W>h<C-W>_
map <C-J> <C-W>j<C-W>_
map <C-K> <C-W>k<C-W>_
map <C-L> <C-W>l<C-W>_
" wrapped lines movement by row
nnoremap j gj
nnoremap k gk
" buffer movement
nnoremap ;[ :bp<CR>
nnoremap ;] :bn<CR>
" yank till \n
nnoremap Y y$
" visual shift (do not leave visual mode)
vnoremap < <gv
vnoremap > >gv
" paste
inoremap <silent> <C-u> <ESC>u:set paste<CR>.:set nopaste<CR>gi
set pastetoggle=<Leader>p
map <C-\> :tjump<CR>
map <M-Left> :pop<CR>
map <M-Right> <C-\>
command! Spaces :%s/\s*$//g
command! Untab4 :%s/\t/ /g
command! Untab8 :%s/\t/ /g
command! Unspace4 :%s/ /\t/g
command! Unspace8 :%s/ /\t/g
vmap ;' <Plug>PComment
command! Gentags :!exctags -R --c-kinds=+p --fields=+iaS --extra=+q .
" commandline mode
"cnoremap <C-A> <Home>
"cnoremap <C-F> <Right>
"cnoremap <C-B> <Left>
"cnoremap <Esc>b <S-Left>
"cnoremap <Esc>f <S-Right>
set modeline
"for i in ["vimrc.ui", "vimrc.functions", "vimrc.plugins", "vimrc.filetypes", "vimrc.clang"]
" let fn = expand("~/.vim/" . i)
for fn in split(glob("~/.vim/vimrc.*"))
if match(fn, "bundles$") <= 0 && filereadable(fn)
exec ":source " . fn
endif
endfor