Skip to content

Instantly share code, notes, and snippets.

@fabiocerqueira
Created September 16, 2012 21:23
Show Gist options
  • Save fabiocerqueira/3734452 to your computer and use it in GitHub Desktop.
Save fabiocerqueira/3734452 to your computer and use it in GitHub Desktop.
.vimrc
syntax on
set title
set ruler
set nu
set mouse=a
set nowrap
set showmatch
set showmode
set showcmd
set nobackup
set encoding=utf-8
set fileencoding=utf-8
set autochdir
set cursorline
set confirm
set hlsearch
set smartcase
autocmd BufEnter * highlight BadWhitespace ctermbg=red guibg=red
autocmd BufEnter * match BadWhitespace /^\t\+/
autocmd BufEnter * match BadWhitespace /\s\+$/
set tabstop=4
set shiftwidth=4
set softtabstop=4
set tabpagemax=20
set showtabline=4
set autoindent
set expandtab
set smartindent
set smarttab
set wildmenu
set wildmode=list:longest
set guioptions-=T
function TrimWhiteSpace()
%s/\s*$//
''
:endfunction
map <Leader>o :call TrimWhiteSpace()<CR>
"'Ctrl+t' abre uma nova aba
nmap <C-t> :tabnew<CR>
noremap <C-l> :tabn<CR>
inoremap <C-l> <esc>:tabn<CR><Insert>
noremap <C-h> :tabprev<CR>
inoremap <C-h> <ESC>tabprev<CR><Insert>
"'Ctrl+e' fecha a aba corrente
nmap <C-e> :tabclose<CR>
map <F5> :!python %<CR>
map <C-J> <C-W>w
map <C-K> <C-W>W
" Comment/Uncomment for different languages
au FileType haskell,vhdl,ada let comment = '-- '
au FileType sh,make,python let comment = '# '
au FileType c,cpp,java,javascript let comment = '// '
au FileType tex let comment = '% '
au FileType vim let comment = '" '
" Comment Blocks
" ,c -> comment selected
" ,u -> uncomment selected
noremap <silent> ,c :s,^,<C-R>=comment<CR>,<CR>:noh<CR>
noremap <silent> ,u :s,^\V<C-R>=comment<CR>,,e<CR>:noh<CR>
autocmd BufNewFile,BufRead Makefile,makefile set ts=4 sw=4 noet
autocmd FileType c set ts=4 sw=4 noet
au BufNewFile,BufRead *.go set filetype=go
au BufNewFile,BufRead *.fcgi,*.wsgi set filetype=python
set lcs=tab:▸\ ,trail:·,eol:¬,nbsp:_
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment