/
vimrc
231 lines (166 loc) · 4.61 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
" No need to be compatible with old vi
set nocompatible
"
" PATHOGEN
"
" http://www.vim.org/scripts/script.php?script_id=2332
"
" {{{
filetype off
call pathogen#runtime_append_all_bundles()
call pathogen#helptags()
filetype plugin indent on
" }}}
" Fix russian keys input
set langmap=йq,цw,уe,кr,еt,нy,гu,шi,щo,зp,х[,ъ],фa,ыs,вd,аf,пg,рh,оj,лk,дl,ж\\;,э',яz,чx,сc,мv,иb,тn,ьm,б\\,,ю.,ё`,ЙQ,ЦW,УE,КR,ЕT,НY,ГU,ШI,ЩO,ЗP,Х{,Ъ},ФA,ЫS,ВD,АF,ПG,РH,ОJ,ЛK,ДL,Ж:,Э\\",ЯZ,ЧX,СC,МV,ИB,ТN,ЬM,Б<,Ю>,Ё~
" Set the <Leader> for combo commands
let mapleader = ","
"
" BUFFERS AND FILES
"
" {{{
" Save file content whenere we leave current buffer or close window
set autowriteall
" Use UTF-8 as the default buffer encoding
set encoding=utf-8
" File encogings list
set fileencodings=utf-8,windows-1251,iso-8859-15,koi8-r
" Mark abandoned buffers as hidden instead of unload them
set hidden
" Write swap file to disk after every 50 characters
set updatecount=50
" Jump to the last known position in a file just after opening it, if the '" mark is set
autocmd BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | execute "normal! g`\"" | endif
" }}}
"
" INTERFACE
"
" {{{
" I want to see where I am
set cursorline
" Use markers to specify folds
set foldmethod=marker
" Always show status line, even for one window
set laststatus=2
" Do not wrap long lines, because it is ugly
set nowrap
" Show line numbers
set number
" Show line, column number, and relative position within a file in the status line
set ruler
" Scroll when cursor gets within 3 characters of top/bottom edge
set scrolloff=3
" Show (partial) command in the last line of the screen
set showcmd
" When a bracket is inserted, briefly jump to a matching one
set showmatch
" At least let yourself know what mode you're in
set showmode
" Show buffer name in the window's title
set title
" Indicate a fast terminal connection
set ttyfast
" Show PEP8 line length border
autocmd FileType python setlocal colorcolumn=80
" Switch between windows faster
map <C-J> <C-W>j
map <C-K> <C-W>k
map <C-H> <C-W>h
map <C-L> <C-W>l
" }}}
"
" THEME AND HIGHLITING
"
" {{{
syntax enable
let python_highlight_all=1
set t_Co=256
set background=dark
colorscheme solarized
" }}}
"
" SEARCH AND REPLACE
"
" {{{
" All matches in a line are substituted instead of one
set gdefault
" Remember up to 100 'colon' commmands and search patterns
set history=100
" Highlight search results
set hlsearch
" Enable incremental search
set incsearch
" Case insensetive search
set ignorecase
" Case sensitive search if search string contains upper case characters
set smartcase
" Set the search scan to wrap lines
set wrapscan
" Turn off highlight search
nmap <Space> :set invhls<cr>:set hls?<cr>
" }}}
"
" COMMAND-LINE COMPLETION
"
" {{{
" Ignore certain types of files on completion
set wildignore+=*.o,*.obj,*.pyc,.git
" Use menu to show command-line completion (in 'full' case)
set wildmenu
" Set command-line completion mode:
" - on first <Tab>, when more than one match, list all matches and complete
" the longest common string
" - on second <Tab>, complete the next full match and show menu
set wildmode=list:longest,full
" }}}
"
" FORMATTING AND EDITING
"
" {{{
" Allow backspacing over everything
set backspace=indent,eol,start
" Use autoindention
set autoindent
" All tabs will be replaced by spaces
set expandtab
" Round indent to multiple of 'shiftwidth' for > and < commands
set shiftround
" Use 4 spaces for (auto)indent
set shiftwidth=2
" Use 4 spaces for inserting <Tab> or using <BS>
set softtabstop=2
" Use 4 spaces for <Tab> and :retab
set tabstop=2
" Visual shifting (does not exit Visual mode)
vnoremap < <gv
vnoremap > >gv
" }}}
"
" COMPLETION
"
" {{{
" Specify how keyword completion should work
set complete=.,w,b,t
" Default syntax completion
set omnifunc=syntaxcomplete#Complete
" Completion depends on filetype
autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags
autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
" }}}
"
" PLUGINS
"
" {{{
" Set the tags files to be the following and F4 to re-build tags file
set tags=./tags,tags
nmap <silent> <F4> :!ctags -f ./tags -R --totals=yes --tag-relative=yes --python-kinds=-iv<CR>
nnoremap <silent> <Leader>l :TlistOpen<CR>
" Nerd tree toggle
nmap <silent> <Leader>r :NERDTreeToggle<CR>
" Buffer Explorer
let g:bufExplorerShowRelativePath=1
let g:bufExplorerSortBy='name'
nmap <silent> <Leader>e :BufExplorer<CR>
" }}}