Skip to content

Instantly share code, notes, and snippets.

@rosivaldo
Created April 21, 2010 20:06
Show Gist options
  • Save rosivaldo/374325 to your computer and use it in GitHub Desktop.
Save rosivaldo/374325 to your computer and use it in GitHub Desktop.
another .vimrc example
set nocompatible
set loadplugins
set encoding=utf-8
set showmode
set ruler
set wildmenu
set nu
set showmatch
set mat=2
set backspace=start,indent,eol
set ignorecase
set shiftround
set formatoptions=qroct
" Navegacao em janelas
map <C-K> <C-W>k
map <C-J> <C-W>j
map <C-L> <C-W>l
map <C-H> <C-W>h
function MyTabWrapper()
let col = col('.')-1
if !col || getline('.')[col-1] !~ '\k'
return "\<tab>"
else
return "\<C-P>"
endif
endfunction
" Especifico para SQL
autocmd bufnewfile *.sql so ~/.vim/skeleton.sql
autocmd bufnewfile *.sql exe "g/\%filename\%/s//" .expand("%")
autocmd bufnewfile *.sql exe "g/\%data\%/s//" .strftime("%y-%m-%d")
autocmd Bufwritepre,filewritepre *.sql execute "normal ma"
autocmd Bufwritepre,filewritepre *.sql exe "g/$LastModified:/s/\$LastModified:.*/$LastModified: " .strftime("%c")
autocmd bufwritepost,filewritepost *.sql execute "normal `a"
autocmd BufNewFile *.sql 0put ='REM vim: set sw=2 sts=2 et tw=80 :' |
\ set sw=2 sts=2 et tw=80 |
\ norm G
autocmd FileType sql setlocal sw=2 sts=2 et tw=80 ai
" Especifico para PHP
let php_sql_query = 1 " highkight SQL nas strings
let php_htmlInStrings = 1 " highlight HTML nas strings
let php_noShortTags = 1 " desabilitar short tags
let php_folding = 0 " folding de funções e classes
" Dicionario do Rasmus:
" http://lerdorf.com/funclist.txt
set dictionary-=~/.vim/phpfunclist.txt dictionary+=~/.vim/phpfunclist.txt
" Use-o
set complete-=k complete+=k
source ~/.vim/php-doc.vim
map <C-o> :set paste<CR>:exe PhpDoc()<CR>:set nopaste<CR>
inoremap <C-P> <ESC>:call PhpDocSingle()<CR>i
nnoremap <C-P> :call PhpDocSingle()<CR>
vnoremap <C-P> :call PhpDocRange()<CR>
autocmd bufnewfile *.php so ~/.vim/skeleton.php
autocmd bufnewfile *.php exe "g/\%filename\%/s//" .expand("%")
autocmd bufnewfile *.php exe "g/\%data\%/s//" .strftime("%y-%m-%d")
autocmd Bufwritepre,filewritepre *.php execute "normal ma"
autocmd Bufwritepre,filewritepre *.php exe "g/$Date/s/\$Date.*/$Date " .strftime("%c")
autocmd bufwritepost,filewritepost *.php execute "normal `a"
autocmd FileType php setlocal ai
autocmd FileType php setlocal makeprg=php\ -l\ %
autocmd FileType php setlocal errorformat=%m\ in\ %f\ on\ line\ %l
inoremap <Tab> <C-R>=MyTabWrapper()<CR>
set statusline=
set statusline+=%f\ " file name
set statusline+=%h%1*%m%r%w%0* " flags
set statusline+=%{&encoding}, " encoding
set statusline+=%{&fileformat}] " file format
set statusline+=%= " right align
set statusline+=%-14.(%l,%c%V%)\ %<%P " offset
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment