-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
229 lines (176 loc) · 5.29 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
" vimrc file
"
" Maintainer: Sergei Stolyarov <[email protected]>
" Last change: Tue, 04 Mar 2009 11:52:56 +0600
" This configuration file is intended for using for UNIX console VIm version,
" windows is not supported by design.
" Use Vim settings, rather then Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible
set linebreak
set nolist " list disables linebreak
set formatoptions+=l
set textwidth=0
set wrapmargin=0
" allow backspacing over everything in insert mode
set backspace=indent,eol,start
" keep 300 lines of command line history
set history=300
" always show cursor position
set ruler
" always display incomplete commands
set showcmd
" perform incremental search
set incsearch
" turn on syntax highlighting
syntax on
" turn on highlighting of all matches
set hlsearch
" turn on autoindent
set autoindent
" set some useful shortcuts
" disable F1 as 'help' shortcut
imap <F1> <C-o>:echo<CR>
nmap <F1> :echo<CR>
" use F2 to save files
imap <F2> <C-o>:w<CR>
nmap <F2> :w<CR>
" use F4 for turning off search results highlighting
imap <F4> <C-o>:noh<CR>
nmap <F4> :noh<CR>
" use F7 to toggle paste mode
set pastetoggle=<F7>
"nmap <F7> <nop>
" use F10 to toggle line numbers
imap <F10> <C-o>:set number!<CR>
nmap <F10> :set number!<CR>
" use F8 to run make
imap <F8> <C-o>:make!<CR>
nmap <F8> :make!<CR>
" add encodings menu
set wildmenu
set wcm=<Tab>
menu Encoding.windows-1251 :e ++enc=cp1251 ++ff=dos<CR>
menu Encoding.koi8-r :e ++enc=koi8-r ++ff=unix<CR>
map <F9> :emenu Encoding.<TAB>
menu Indentation.tabs :set noexpandtab<CR>
menu Indentation.spaces :set expandtab<CR>
map <F5> :emenu Indentation.<TAB>
" always show status line
set laststatus=2
" status line formatting options
set statusline=%<%f\ %h%m%r%=%-14.(%l,%c%V%)\ %P
" turn on 'visualbell'
set visualbell
" enable mouse support
"set mouse=vnc
set mouse=a
set timeoutlen=10
" ignore case in search patterns
set noignorecase
" tabulation and indenting options
set tabstop=4 " tabstop value
set shiftwidth=4 " Number of spaces to use for each step of (auto)indent
"set expandtab " use spaces instead of tab, use <C-v><Tab> to insert a tabulation symbol
set smarttab " smart Backspace behaviour
" don't display VIm greating message
set shm+=I
" turn off brackets matching vimscript (for VIm > 7)
let loaded_matchparen = 0
" set bash-like file names completion
set wildmode=longest,list
" Automatically save before commands like :next and :make
set autowrite
" vim tip #38 Cursor one line at a time when :set wrap
nnoremap j gj
nnoremap k gk
vnoremap j gj
vnoremap k gk
nnoremap <Down> gj
nnoremap <Up> gk
vnoremap <Down> gj
vnoremap <Up> gk
inoremap <expr> <Down> pumvisible() ? "\<Down>" : "\<C-o>gj"
inoremap <expr> <Up> pumvisible() ? "\<Up>" : "\<C-o>gk"
nmap <T-F5> :q<cr>
" do not copy text deleted by <Del> into default register
nnoremap <Del> "_x
vnoremap <Del> "_d
nnoremap dd "_dd
set langmap=ёйцукенгшщзхъфывапролджэячсмитьбюЁЙЦУКЕНГШЩЗХЪФЫВАПРОЛДЖЭЯЧСМИТЬБЮ;`qwertyuiop[]asdfghjkl\\;'zxcvbnm\\,.~QWERTYUIOP{}ASDFGHJKL:\\"ZXCVBNM<>
" make CTRL-W to delete word correctly
inoremap <C-w> <C-\><C-o>dB
" make CTRL-BS to delete word like C-W
inoremap <C-BS> <C-\><C-o>db
" some options that depends on 'autocmd' feature
if has("autocmd")
" Restore cursor to file position in previous editing session
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
" set 'textwidth' to 78 characters for all text files
"autocmd FileType text setlocal textwidth=100
" for 'php' files do not use 'expandtab' and 'smarttab' options
autocmd FileType php set noexpandtab
"autocmd FileType php set nosmarttab
autocmd FileType make setlocal noexpandtab
endif " if has("autocmd")
" load indentation rules and plugins
" according to the detected filetype.
if has("autocmd")
"filetype plugin indent on
autocmd FileType php setlocal comments-=:// comments+=f://
autocmd FileType cpp setlocal comments-=:// comments+=f://
autocmd FileType ruby setlocal comments-=:# comments+=f:#
endif
set noswapfile
filetype plugin on
au FileType php set omnifunc=phpcomplete#CompletePHP
nmap Ж :
" yank
nmap Н Y
nmap з p
nmap ф a
nmap щ o
nmap г u
nmap З P
"noremap y "5y
"noremap Y "5Y
"noremap p "5p
"noremap P "5P
"vnoremap y "5y
"vnoremap Y "5Y
"vnoremap p "5p
"vnoremap P "5P
"These are to cancel the default behavior of d, D, c, C
" to put the text they delete in the default register.
" Note that this means e.g. "ad won't copy the text into
" register a anymore. You have to explicitly yank it.
nnoremap в "_d
vnoremap в "_d
nnoremap d "_d
vnoremap d "_d
nnoremap D "_D
vnoremap D "_D
nnoremap c "_c
vnoremap c "_c
nnoremap C "_C
vnoremap C "_C
" disable folding
set nofoldenable
" hack for gnu screen
if match($TERM, "screen")!=-1
set term=xterm
set lines-=1
endif
" set Visual selection colors
hi Visual ctermbg=74 ctermfg=7
" fix mouse behaviour on wide terminals
if has("mouse_sgr")
set ttymouse=sgr
else
set ttymouse=xterm2
end
" disable gitcommit autowrap
au FileType gitcommit setlocal tw=0
" install pathogen:
" mkdir -p ~/.vim/autoload ~/.vim/bundle && wget -O ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim
execute pathogen#infect()