Skip to content

Instantly share code, notes, and snippets.

@j0shua
Created April 8, 2011 13:29
Show Gist options
  • Save j0shua/909831 to your computer and use it in GitHub Desktop.
Save j0shua/909831 to your computer and use it in GitHub Desktop.
.vimrc
set expandtab
set ts=2
set sw=2
"set foldmethod marker
set hlsearch
hi Comment ctermfg=lightgray
ab klog Kohana::log('debug',
" Set indentation
set autoindent
set smartindent
filetype plugin on
source ~/.vim/plugin/matchit.vim
"to make sure the file is saved as unix for correct line-breaks instead of ^M
set fileformat=unix
" drupal highlighting
if has("autocmd")
" Drupal *.module and *.install files.
augroup module
autocmd BufRead,BufNewFile *.module set filetype=php
autocmd BufRead,BufNewFile *.install set filetype=php
autocmd BufRead,BufNewFile *.inc set filetype=php
autocmd BufRead,BufNewFile *.test set filetype=php
augroup END
endif
"highlight DiffAdd cterm=none ctermfg=bg ctermbg=Green gui=none guifg=bg guibg=Green
"highlight DiffDelete cterm=none ctermfg=bg ctermbg=Red gui=none guifg=bg guibg=Red
"highlight DiffChange cterm=none ctermfg=bg ctermbg=Yellow gui=none guifg=bg guibg=Yellow
"highlight DiffText cterm=none ctermfg=bg ctermbg=Magenta gui=none guifg=bg guibg=Magenta
" Remove all trailing whitespace in a file and return the cursor to its
" original position
function! RemoveTrailingWhitespace()
if &ft =~? 'diff\|mail\|make'
return
endif
let l:searchreg = getreg('/')
let l:searchregtype = getregtype('/')
let l:curcol = col(".")
let l:curline = line(".")
" use silent! so we suppress the 'pattern not found' message
silent! %s/\s\+$//
call cursor(l:curline, l:curcol)
call setreg('/', l:searchreg, l:searchregtype)
endfunction
" Custom autocommands ----------------------------------------------------{{1
"autocmd BufWritePre * call RemoveTrailingWhitespace()
" quits when there is no buffer even if nerdtree is open
" //todo find this online and reconfigure it
" function! NERDTreeQuit()
" set comment color to something bright so it is easier to see than the blue default color
"change the highlight color for directories since blue is unreadable
hi Directory ctermfg=3
"add jquery highlighting
au BufRead,BufNewFile jquery.*.js set ft=javascript syntax=jquery
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment