My favorites | Sign in
Project Logo
                
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
"-------------------------
" Pento VIM settings
"-------------------------

"-------------------------
" Common settings
"-------------------------
" Use Vim settings, rather then Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible

" New leader key
let mapleader = ","

" More suitable mapping
function SMap(key, action, ...)
let modes = " vi"
if (a:0 > 0)
let modes = a:{1}
endif
if (match(modes, '\Ii') != -1)
execute 'imap ' . a:key . ' <Esc>' . a:action
endif
if (match(modes, '\Nn') != -1)
execute 'nmap ' . a:key . ' <Esc>' . a:action
endif
if (match(modes, ' ') != -1)
execute 'map ' . a:key . ' <Esc>' . a:action
endif
if (match(modes, '\Vv') != -1)
execute 'vmap ' . a:key . ' <Esc>' . a:action
endif
endfunction

" Enable loading filetype and indentation plugins
filetype plugin on
filetype indent on

" Allow backspacing over everything in insert mode
set backspace=indent,eol,start

" Keep 50 lines of command line history
set history=50

" Show the cursor position all the time
set ruler

" Display incomplete commands
set showcmd

" Turn on number vertical line
set number

" I don't like backups
set nobackup

" Autoclose folds, when moving out of them
"set foldclose=all

" Open all folds
set foldenable
" I like {{{ }}} folds
"set foldmethod=marker
set foldmethod=indent

" Use incremental searching
set incsearch

" Do not highlight search results
set nohlsearch

" Jump 5 lines when running out of the screen
set scrolljump=7

" Indicate jump out of the screen when 10 lines before end of the screen
set scrolloff=7

" Write all tmp files to /tmp
set dir=/tmp

" Turn off any bells
set novisualbell
set t_vb=

" Enable mouse
set mouse=a
set mousemodel=popup

" Default encoding
set termencoding=utf-8
set fileencodings=utf-8,cp1251,cp866,koi8-r

" Do NOT unload buffer when switch to another one
" this allows to edit several files in the same time without having to save
" them each time you switch between them
set hidden

" Hide the mouse when typing text
set mousehide

" Turn on autoindent
set autoindent

" Auto indent after a {
set smartindent

" Switch on syntax highlighting if it wasn't on yet.
syntax on

" Expand tab to spaces ?
set expandtab

" Default tab size
set shiftwidth=4
set softtabstop=4
set tabstop=4

" Status line format
set statusline=%<%f%h%m%r\ %b\ %{&encoding}\ 0x\ \ %l,%c%V\ %P

" Fix <Enter> for comment
set fo+=cr

" Session options
set sessionoptions=curdir,buffers,tabpages
set foldcolumn=2

"-------------------------
" Useful functions
"-------------------------

function MoveTabLeft()
let current_tab = tabpagenr()
if current_tab > 1
let current_tab = current_tab - 2
execute 'tabmove' current_tab
endif
endfunction

function MoveTabRight()
let current_tab = tabpagenr()
execute 'tabmove' current_tab
endfunction


"-------------------------
" Bindings
"-------------------------

" Make <Backspace> act as <Delete> in Visual mode?
vmap <BS> x

" Wrap selected text to 80 symbols per line
vmap <C-b> <esc>:'<,'>!fold -w 120 -s<cr>

" CTRL-C and CTRL-Insert are Copy
vmap <C-C> "+yi
imap <C-V> <esc>"+gPi

" Make shift-insert work like in Xterm
imap <S-Insert> <MiddleMouse>

" Use CTRL-F for omni completion
imap <C-F> <C-X><C-O>

" Search & replace the word under the cursor
nmap ; :%s/\<<c-r>=expand("<cword>")<cr>\>/

" F2 to quick save
call SMap("<F2>", ":w<cr>")

" F4 - Project toogle
call SMap("<silent><F4>", "<Plug>ToggleProject")

" F5 - show buffers
call SMap("<F5>", ":ls<cr>:b")

" F6 - prev buffer
call SMap("<F6>", ":bp<cr>")

" F7 - newxt buffer
call SMap("<F7>", ":bn<cr>")

" F8 - Marks
call SMap("<F8>", ":MarksBrowser<cr>")

" F10 kill buffer
call SMap("<F10>", ":bd<cr>")

" F11 - Tlist
call SMap("<F11>", ":TlistToggle<cr>")

" F12 to quick explorer
call SMap("<F12>", ":Explore<cr>")

" < & > to indent blocks
vmap < <gv
vmap > >gv

" Switch off fucked 'Replace mode'
imap <Ins> <Esc>wq

" C-T - new tab
call SMap("<C-t>", ":tabnew<cr>")

" Open tag under cursor in new tab
map <C-W>] <C-W>]:tab split<CR>gT:q<CR>gt

map <F3> :vimgrep /fixme\\|todo/j *.[py,c,cc,pl]<CR>:cw<CR>

" Dublicate current line
imap <C-d> <esc>yypi

" Tab autocompletion
function InsertTabWrapper()
let col = col('.') - 1
if !col || getline('.')[col - 1] !~ '\k'
return "\<tab>"
else
return "\<c-p>"
endif
endfunction

imap <tab> <c-r>=InsertTabWrapper()<cr>

set complete=""
set complete+=.
set complete+=k
set complete+=b
set completeopt-=preview
set completeopt+=longest

map <Leader>tl :call MoveTabLeft()<CR>
map <Leader>tr :call MoveTabRight()<CR>

" Useful newline bindings for normal mode
map <S-Enter> O<Esc>
map <CR> o<Esc>
"-------------------------
" Colors
"-------------------------

colorscheme spec

"-------------------------
" Advanced Settings
"-------------------------

set mps-=[:]

" Encoding menu
set wildmenu
set wcm=<Tab>
menu Encoding.&koi8-r :e ++enc=koi8-r<CR>
menu Encoding.&windows-1251 :e ++enc=cp1251<CR>
menu Encoding.&cp866 :e ++enc=cp866<CR>
menu Encoding.&utf-8 :e ++enc=utf8 <CR>

" For 'view' mode
if &readonly == 1
set nonumber
set nofoldenable
set foldcolumn=10

nmap <F10> :qa<cr>
nmap <Space> <PageDown>
endif

highlight TooLongLine term=reverse ctermfg=Yellow ctermbg=Red
match TooLongLine /.\%>81v/

"-------------------------
" Plugins Settings
"-------------------------

let g:SessionMgr_AutoManage = 0
let g:SessionMgr_DefaultName = "mysession"

let g:Tlist_Show_One_File = 1
let g:Tlist_GainFocus_On_ToggleOpen = 1

let g:snippetsEmu_key = "<C-l>"

nmap <Leader>va <Plug>VCSAdd
nmap <Leader>vn <Plug>VCSAnnotate
nmap <Leader>vc <Plug>VCSCommit
nmap <Leader>vd <Plug>VCSDiff
nmap <Leader>vg <Plug>VCSGotoOriginal
nmap <Leader>vG <Plug>VCSGotoOriginal!
nmap <Leader>vl <Plug>VCSLog
nmap <Leader>vL <Plug>VCSLock
nmap <Leader>vr <Plug>VCSReview
nmap <Leader>vs <Plug>VCSStatus
nmap <Leader>vu <Plug>VCSUpdate
nmap <Leader>vU <Plug>VCSUnlock
nmap <Leader>vv <Plug>VCSVimDiff

let g:TranslateIt_Bin = "sdcv"
let g:proj_flags = "imstc"

let NERDShutUp=1

let html_use_css=1

"-------------------------
" Filetypes
"-------------------------
au BufRead,BufNewFile *.w3af set filetype=w3af
Show details Hide details

Change log

r5 by naplanetu on May 17, 2009   Diff
Useful newline bindings for normal mode
Go to: 
Project members, sign in to write a code review

Older revisions

r4 by naplanetu on Mar 03, 2009   Diff
Remove unnecessary code
r3 by naplanetu on Feb 22, 2009   Diff
Clean Up
r2 by naplanetu on Feb 22, 2009   Diff
First commit
All revisions of this file

File info

Size: 6327 bytes, 308 lines

File properties

svn:executable
*
Hosted by Google Code