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
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
" @ Info about the file {{{
" File: $HOME/.vimrc 
" Comment: Also contains a section dedicated to the GUI verion of Vim
" Author: Fernando Luis Basso 
" Email: [email protected]
" Blog: http://jeditux.wordpress.com
" Last Modified: Monday, 18:07 - December 26 - 2011
" Powered By: GNU/Linux ;)
" Warning: Once you try vim (seriously), you'll never want to look back.
"                              ^v^                               
"      .-.________            /(_)\              _______ .-. 
" ----/ \_)_______) +-----GNU--^ ^--LINUX-----+ (_______(_/ \----
"    (    ()___)    |       Vi Improved       |    (___()    )
"         ()__)     |   Please Visit Us At:   |     (__()
" ----\___()_)      |www.jeditux.wordpress.com|      (_()___/----
"                   +-------------------------+                 
" NOTES
"    pt_BR 
"       Este é o meu $HOME/.vimrc pessoal. Pode utilizá-lo como
"       exemplo para as sas próprias configurações. Não utilize 
"       linhas que você não entende.
"    
"    en_US
"       This is my pernonal $HOME/.vimrc. You can use it as example
"       for your own settings. Do not use any lines you don't 
"       understand.
"
" This file was written/saved using utf-8 character set.
" }}}

" **** General Purpose Config **** {{{
" **** Basics **** {{{
syntax on
set nocompatible " No vi-compatible mode.
set history=99
set undolevels=49
" Character set of the text in the buffer, not the file itself:
set encoding=utf-8 
" Character set of the file and its contents:
set fileencoding=utf-8 "
"set runtimepath=~/.vim/doc/MySummaries,/$VIMRUNTIME
set runtimepath+=~/Summaries_In_Vim
set runtimepath+=~/Vocabulary_In_Vim
" Using UltiSnips caused snipMate to stop working.
"set runtimepath+=~/.vim/UltiSnips-1.5
"set modeline
"set modelines=4

""set tags+=~/.vim/doc/MySummaries/tags
" }}}

" **** General **** {{{

" **** colorscheme ****  {{{
" I try to use to 256 colors only,
" otherwise, CSApprox.vim is amzing!
"colorscheme desert
"colorscheme CSApprox_desert
colorscheme CSApprox_darkZ
if has("gui_running")
    colorscheme darkZ
    set nocursorline
endif
"colorscheme darkZ
" }}} colorscheme

filetype plugin indent on " Load filetype plguins/indent settings.

"set autochdir " Alwasy switch to the current file directory.
set backspace=indent,eol,start " Make backspace a little more flexible.
set backup " Backups are always a good idea.
set clipboard+=unnamed " Share windows clipboard.
set backupdir=~/.vim/backup " Where to save backup files.
set directory=~/.vim/tmp// " Directory to place .swp files. W1 
set fileformats=unix,dos,mac " Support all three, in this order.
set hidden " So that we can change buffers without saving first.
set iskeyword+=_,$,@,%,# " W2 _ $ @ % # do not delimit words anymore. 
set matchpairs+=(:),{:},[:]
set mouse-=a " The mouse is evil.
set noerrorbells " Don't disturb making noise.
set scrolloff=4
"set whichwrap=b,s,h,l,<,>,~,[,] " Everything wrap lines.
"             | | | | | | | | |
"             | | | | | | | | +--> "]" Insert and Replace.
"             | | | | | | | +--> "[" Insert and Replace.
"             | | | | | | +--> "~" Normal.
"             | | | | | +--> <Right> Normal and Visual.
"             | | | | +--> <Left> Normal and Visual.
"             | | | +--> "l" Normal and Visual (not recommended).
"             | | +--> "h" Normal and Visual (not recommended).
"             | +--> <Scpace> Normal and Visual.
"             +--> <BS> Normal and Visual.
"
" The time in milliseconds that is waited for a
" key code or mapped key sequence to complete.
set timeout timeoutlen=500 ttimeoutlen=100
"set timeout timeoutlen=3000 ttimeoutlen=100
" Works in GUI only.
" MatchParens are white
"highlight MatchParen ctermbg=white
"set incsearch " Highlight search as you type.
set nostartofline " Leave my cursor in same column it was.
set novisualbell " Don't blink.
set number " Show line nubmers.
set ruler " " Show what line and column the cursor is.
set showcmd " Show the command being typed.
"set showmatch " Show matching brackets.
let &guicursor = &guicursor . ",a:blinkon0"
" }}}

" **** Text Formating/Layout **** {{{
"set completeopt= " Don't use a pop up menu for completions.
set completeopt=menu,preview " Show pup-up menu, and sometimes also show
" some extra information.

set expandtab " No real tabs.
set softtabstop=4 " When hitting tab or backspace, how many spaces
" should a tab be.
set shiftwidth=4 " Auto-indent amount when using cindent, <<, >> or
" stuff like that.
set tabstop=8 " Real tabs should be 8, and they will show with :set list.
" help fo-table for the line bellow.
set formatoptions=rcqt  
set noignorecase " Case sensitive by default.
" The next option only makes sense with :set ignorecase.
"set smartcase " If I type any Uper Case letter, got case-sensitive.
set infercase " Case inferred by default.
set wrap " Do not wrap lines.
" }}}

" **** StatusLine **** {{{
" ==========
"set laststatus=2
"function MyDATE()
"    "return strftime('%A, %H:%M - %B %d - %Y')
"    return strftime('%T')
"endfunction
"func MyOct()
"    return printf("Oct=%03o",char2nr(matchstr(getline("."),'.',col(".")-1)))
"endfunc
":set statusline=%F\ Buffer=%n\ %{MyDATE()}\ %m\ %h\ %r\ %=Filetype=%y\ Dec=%b\ Hex=0x%B\ %{MyOct()}\ Line=%l\ Col=%c\ %P
":set statusline=%F\ Buf=%n\ ft=%y\ Dec=%b\ Hex=0x%B\ %{MyOct()}\ Line=%l\ Col=%c\ %P

" }}}}
"
" **** tabs (abas) **** {{{

" }}} tabs (abas) ends here.

" }}} tabs (abas) ends here.

" }}} General Purpose Config closing fold

" **** GUI **** {{{
"if has('gui_running')
"
"    " **** Make it non-GUI look and feel **** {{{
"    " No mouse in vim. Never. The mouse is evil.
"    set mouse-=a
"    " No menu bar
"    set guioptions-=m
"    "set guioptions-=M
"    " No toolbar
"    set guioptions-=T
"
"    " Desabilita todos os scrollbars. 
"    " Right-hand scrollbar
"    set guioptions-=r
"    " Right-hand scrollbar when thereis a vertially split window
"    set guioptions-=R
"    " Left-Hand scrollbar
"    set guioptions-=L
"    " Left-hand scrollbar when vertically split window
"    set guioptions-=l
"    " Bottom horizontal scrollbar
"    set guioptions-=b
"    " Habilitar o icone.
"    set guioptions=i
"    " }}} non-gui look and feel closing fold
"
"    " **** Gvim Position and size **** {{{
"    ":winpos 721 485 " This didn't work well. Never got gvim to the very bottom.
"    ":autocmd GUIEnter * winpos 719 487
"    " 'winpos' é distãncia do lado esquerdo e distãncia do topo.
"
"    " Posicionamento para o openbox com tint2, Inconsolada 12
"    "                           h   v                            
"    ":autocmd GUIEnter * winpos 288 10
"
"    " Posicionamento para o Gnome/Metacity:
"    :autocmd GUIEnter * winpos 8 3
"    :autocmd GUIEnter * set lines=27
"    :autocmd GUIEnter * set columns=101
"    " }}} gvim position and size closing fold.
"
"    " **** Fonts **** {{{
"    set guifont=Dejavu\ Sans\ Mono\ 11
"    "set guifont=monofur\ 12
"    "set guifont=Monaco\ 11
"    "set guifont=Consolas\ 11
"    "set guifont=Inconsolata\ 13
"    "colorscheme 
"    "set guifont=Courier\ 10\ Pitch\ 13
"    " }}}
"
"    " **** Other **** {{{
"    :autocmd GUIEnter * source ~/.vim/plugin/colorsel.vim
"    " For some reason, gnome is making all programs start 
"    " at / instead at in $HOME. Even nautilus starts in /.
"    :autocmd GUIEnter * :cd ~/
"
"    " Set insert mode cursor width:
"    set guicursor=i-ci:ver14-Cursor/lCursor
"    " }}} Close Other closing fold.
"endif
" }}} Close GUI fold.
 
" **** Folding **** {{{
set foldenable " Enables folding.
set foldmethod=manual " Set fold method to 'manual'.
set fdc=0 " Show where folds start and end, when they are opened.

:set foldtext=MyFoldText()
:function MyFoldText()
:  let line = getline(v:foldstart)
:  let sub = substitute(line, '/\*\|\*/\|{{{\d\=', '', 'g')
:  return v:folddashes . sub
:endfunction
" }}} }}} Because of the code above, I had to add closing brackets twice.

" **** Language Settings **** {{{

" **** PHP **** {{{
" Don't show variables in php.
"let tlist_php_settings = "'php;c:class;d:constant;f:function'
" SQL syntax highlighting in php query strings:
"let php_sql_query = 1 " W3 Also mess some html strings in php.
" }}}

" **** HTML **** {{{
" Enables html syntax highlighting inside strings:
"let php_htmlInStrings = 1 " NOT WORKING.
" }}}

" }}} Language SEttings closing fold.

" **** Python *** {{{
" For lines that end with \n\ or \ and continue on the next one.
"let g:pyindent_continue = '&sw - &sw'
let g:pyindent_continue = 0
autocmd Filetype python set completefunc=pythoncomplete#Complete
" }}}

" **** Plugin Settings **** {{{ 
" **** PathOgen **** {{{
call pathogen#infect()
"call pathogen#runtime_append_all_bundles()
" pathogen.vim ends here }}} 

" **** Vundle *** {{{
" filetype off
" set runtimepath+=~/.vim/bundle/vundle/
" call vundle#rc()
" 
" " Vundle manages vundle. (updates itself)
" Bundle 'gmarik/vundle'
" Bundle 'msanders/snipmate.vim.git'
" Bundle 'AndrewRadev/simple_bookmarks.vim'
" Bundle 'Townk/vim-autoclose'
" 
" filetype plugin indent on
" Vundle ends here. }}}

" **** MozRepl **** {{{
""autocmd BufWriteCmd *.html,*.css,*.gtpl :call Refresh_firefox()
""function! Refresh_firefox()
""    if &modified
""        write
""        silent !echo 'vimYo = content.window.pageYOffset;
""                    \ vimXo = content.window.pageXOffset;
""                    \ BrowserReload();
""                    \ content.window.scrollTo(vimXo,vimYo);
""                    \ repl.quit();'  |
""                    \ nc localhost 4242 2>&1 > /dev/null
""    endif
""endfunction
" }}}

" **** Project **** {{{
" Width of the left split containing the 'Project' buffer. 
let g:proj_window_width = 37
" With of project window when hitting <Space>.
let g:proj_window_increment = 70

"et g:proj_flags=L

" My nmap to open Project in ~/Projects/
nmap <F12> :Project ~/Projects_Vim/
" }}} Project

" **** TagList **** {{{
" Easily open and close taglist.
:nnoremap <Leader>t :TlistToggle<Return>
let Tlist_Compact_Format = 1 " Show small menu.
let Tlist_Enable_Fold_Column = 0 " Do show folding tree.
let Tlist_Sort_Type = 'name' " Order by name.
let Tlist_Use_Left_Window = 1 " Split to the left side of the screen.
let Tlist_WinWidth=35 " 35 Columns wide is enough for me.
" }}}

" **** CSApprox config for gnome-terminal {{{
"if (&term == 'xterm' || &term =~? '^screen') && hostname() == 'vaio'
"    set t_Co=256
"    let g:CSApprox_konsole = 1
"endif

"set t_Co=256 " Speciall for gnome-terminal.
"if &term != 'linux'
"    set t_Co=256
"endif }}}

" **** Load plugins **** {{{
let html_no_rendering = 1
"source ~/.vim/plugin/colorsel.vim
source $VIMRUNTIME/macros/matchit.vim
" }}}

" **** TxtFmt **** " {{{

" For txtfmt plugin, so there are no conflicts.
let g:maplocalleader = '_'
"let xtfmtConceal = 1 

" Allow txtfmt regions to be nested witing txt help files.
"augroup filetypedetect
"    au! BufRead,BufNewFile *.txt let b:txtfmtNested = 1
"    au  BufRead,BufNewFile *.txt setf help.txtfmt
"augroup END

" If you need to send the file as a simple text file (without txtfmt 
" tokens) use this:
nmap <LocalLeader>nt :%s/[\ue000-\ue019]//g


" Clear fb, fu
let g:txtfmtUsermap1 = 'inoremap <C-\>- <<i\:f->>'

let g:txtfmtUsermap2 = 'inoremap <C-\>c <<i\:cb,fb>>'
let g:txtfmtUsermap3 = 'inoremap <C-\>e <<i\:c-,f->>'
let g:txtfmtUsermap4 = 'inoremap <C-B> <<i\:fb>>'
let g:txtfmtUsermap5 = 'inoremap <C-\>_ <<i\:fb>>'
"let g:txtfmtUsermap6 = 'inoremap <C-\>- <<i\:f->>'
"let g:txtfmtUsermap7 = 'inoremap <C-\>_ <<i\:fu>>'
let g:txtfmtUsermap7 = 'inoremap <C-\>u <<i\:fu>>'
let g:txtfmtUsermap8 = 'inoremap <C-\>_ <<i\:fu>>'

" My own 256 colors colorscheme and txtfmt colors
" I made black into orange, since I most use dark backgrounds.
let g:txtfmtColor{1} = '^\\%(k\\|bla\\%[ck]\\)$,c:202,g:#cf8922' " orange
let g:txtfmtColor{2} = '^b\\%[lue]$,c:74,g:#1572ff' " blue
let g:txtfmtColor{3} = '^g\\%[reen]$,c:DarkGreen,g:#00FF00' " green
let g:txtfmtColor{4} = '^t\\%[urquoise]$,c:87,g:#00FFFF' " kind of blue
let g:txtfmtColor{5} = '^r\\%[ed]$,c:203,g:#ff506d' " red
let g:txtfmtColor{6} = '^v\\%[iolet]$,c:219,g:#FF00FF' " violet
let g:txtfmtColor{7} = '^y\\%[ellow]$,c:226,g:#FFFF00' " yellow
let g:txtfmtColor{8} = '^w\\%[hite]$,c:White,g:#FFFFFF' " white

" Activate and deactivate bg colors from 1 to 8.
let g:txtfmtBgcolormask = '10101000'

let g:txtfmtBgcolor{1} = '^\\%(k\\|bla\\%[ck]\\)$,c:240,g:#cf8922'
let g:txtfmtBgcolor{2} = '^b\\%[lue]$,c:57,g:#FFFF00'
let g:txtfmtBgcolor{3} = '^g\\%[een]$,c:238,g:#FFFF00'
let g:txtfmgBgcolor{4} = '^t\\%[een]$,c:238,g:#FFFF00'
let g:txtfmtBgcolor{5} = '^r\\%[ed]$,c:167,g:#FFFF00'

" }}}

" **** netrw **** " {{{
" Open :Explore
nnoremap <LocalLeader>e :37Vexplore 
"let g:netrw_alto = 1
" }}}

" **** Autoclose.vim **** {{{
" I can't find a way to make autoclose start toggled off.
"autocmd 'normal \a'
"autocmd BufRead,BufNewFile * execute 'normal \a'
" It seems this works. Editing the plugin itsel, and setting
" autoclose_on to 0.
if !exists('g:autoclose_on')
    let g:autoclose_on = 0
endif
" }}}

" **** ColorSel **** {{{
:inoremap <F8> <Esc>:ColorSel<Return>
:nnoremap <F8> :ColorSel<Return>

" }}}

" **** Mappings **** {{{

" **** Tabs *** {{{
:map <C-N> :tabnext<Return>
:map <C-P> :tabprevious<Return>
" Allows to easily open a file in the same dir of the
" file we are editing. No matter what dir we are.
noremap <expr> <Leader>e ":tabedit ".substitute(expand("%:h"), '.\zs$', '/', '')
" Maps <c-w>gf to create the filename under
" cursor if it doesn't exist yet:
nnoremap <c-w>gf :tabedit <cfile><CR>
" }}}

" **** Buffers ****" {{{
"      =======
" This is to make netrw and help buffers be always buflisted,
" because other wise :mkession does not save them.
autocmd Filetype help setlocal buflisted
"autocmd Filetype netrw setlocal buflisted
" Esta é pra fazer o Explore sempre ficar como 'buflisted'.
autocmd BufRead,BufWinEnter * setlocal buflisted

" Show buffers. Even the 'unlisted'
" ones, like help and :Explore buffers:
nnoremap <LocalLeader>b :buffers!<Return>
" }}}

" **** Sessions **** {{{
" @Sessions gave me problems the last time I tried using them...
" 'p' stands for 'project'
nnoremap <LocalLeader>p :source ~/.vim/Sessions/
nnoremap <LocalLeader>ç :mksession! ~/.vim/Sessions/
" }}}

" **** Movements **** {{{
" Go to the begining of a : command
cnoremap <C-a> <Home>
" Go to the end of a : comand
cnoremap <C-e> <End>
" Go one charactere to the left
cnoremap <C-b> <Left>
" Go one charactere to the right
cnoremap <C-f> <Right>
" }}}

" **** Other Mappings **** {{{
" 'ç' troca um espaço por um <Enter> perto da coluna 78:
"map ç 072lf i \\<Esc>r<Return>
map ç 072lf r<Return>
" Inoremap 
" Insert a nice formated data and time:
inoremap <F2> <C-r>=strftime('%A, %H:%M - %B %d - %Y')
" Clears the current search
nnoremap <silent> <C-l> :nohlsearch<CR><C-l>
" Change directory to the path of current file/buffer.
nnoremap cd :cd %:h<CR>:pwd<CR>

" *** Comment / Uncomment ***  {{{
" Works only for comments with /*<Space>...<Space>*/ 
let @c='^i/* A */'  " Commnts a line.
let @u='^d/\wf;f d$' " Uncomments a line.
" }}}
" }}}
"

" }}} close the 'Mappings' opening fold

" **** Setting filetypes **** {{{
" Setting file type for use of some fileytpe plugins:
"autocmd BufRead *.as set filetype=actionscript
"autocmd BufRead *.js set filetype=javascript
autocmd BufRead,BufNewFile *.txtfmt set filetype=txtfmt
"autocmd BufRead,BufNewFile *.txt set filetype=txtfmt
autocmd BufRead,BufNewFile *.hx set filetype=haxe
autocmd BufRead,BufNewFile *.mxml set filetype=mxml
autocmd BufRead,BufNewFile *.bash set filetype=bash
autocmd BufRead,BufNewFile *.php set filetype=php
autocmd BufRead,BufNewFile *.c set filetype=c
" }}}

" **** Macros **** {{{
" Make titles. */
let @t='YPP:s/[ a-zA-Z]/*/g2j:s/[ a-zA-Z]/*/g'
nnoremap <LocalLeader>mt YPP:s/[ a-zA-Z\.]/*/g2j:s/[\. a-zA-Z]/*/g
" }}}

" **** Functions **** {{{

" **** Restore cursor position **** {{{
autocmd BufReadPost *
            \ if line("'\"") > 1 && line("'\"") <= line("$") |
            \ execute "normal! g`\"" |
            \ endif
" }}}

" Open a vim Session: {{{
function! VS()
    try
        cd ~/.vim/vim_sessions/
    catch /^Vim\%((\a\+)\)\=:E344/
        echo "Caught an exception\nVIM EXCEPTION: ".v:exception
        return 1
    endtry
    let ans = input('Session name: ', '', 'file')
    execute ':source '.ans
endfunction 
" }}}

" }}} Functions close opening fold.

" Show highlighting groups for current word. {{{
nmap <F1> :call <SID>SynStack()<CR>
function! <SID>SynStack()
    if !exists("*synstack")
        return
    endif
    echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')
endfunction
" }}}

" MySummaries  {{{
" Mappings to reindex the tags on ~/Summaries_In_Vim/doc/:
map <Leader>hts :helptags ~/Summaries_In_Vim/doc/
map <Leader>smw :set modifiable writeany noreadonly
" }}}

" My Tips {{{

"autocmd GUIEnter * :tabedit ~/.vim/TIPS/tips.txt
"autocmd VimEnter * :tabedit ~/.vim/TIPS/tips.txt

" my tips ends here. }}} 

" **** Maps and abbreviations *** {{{
" Press space after 'scb'. Do not hit <Enter>
iabbrev scb [sourcecode language='bash'][/sourcecode]<Esc>F]a<CR><CR><UP><Space>

" *** Turn into wordpress bash examples post: {{{
function WP_bash() 
    :%substitute/<pre>/\[sourcecode language='bash'\]/
    :%substitute/<\/pre>/\[\/sourcecode]/
endfunction
""" }}}

" Maps and abbreviations ends here. }}}

" vim: set nowrap:
" vim:foldmethod=marker foldmarker={{{,}}}
" vim:set nomodifiable:
"