Skip to content

Instantly share code, notes, and snippets.

@msonnabaum
Created April 6, 2011 20:24
Show Gist options
  • Save msonnabaum/906445 to your computer and use it in GitHub Desktop.
Save msonnabaum/906445 to your computer and use it in GitHub Desktop.
" Janus undo-ing
" Having this on breaks highlighting text with visual mode and then hitting d
" to delete or = to indent.
unlet macvim_hig_shift_movement
" Nick wrote: Uncomment these lines to do syntax checking when you save
augroup Programming
" clear auto commands for this group
autocmd!
autocmd BufWritePost *.php !php -d display_errors=on -l <afile>
autocmd BufWritePost *.inc !php -d display_errors=on -l <afile>
autocmd BufWritePost *.module !php -d display_errors=on -l <afile>
autocmd BufWritePost *httpd*.conf !/etc/rc.d/init.d/httpd configtest
autocmd BufWritePost *.bash !bash -n <afile>
autocmd BufWritePost *.sh !bash -n <afile>
autocmd BufWritePost *.pl !perl -c <afile>
autocmd BufWritePost *.perl !perl -c <afile>
autocmd BufWritePost *.xml !xmllint --noout <afile>
autocmd BufWritePost *.xsl !xmllint --noout <afile>
"autocmd BufWritePost *.js !~/jslint/jsl -conf ~/jslint/jsl.default.conf -nologo -nosummary -process <afile>
autocmd BufWritePost *.js !jsl -conf ~/jslint/jsl.default.conf -nologo -nosummary -process <afile>
autocmd BufWritePost *.rb !ruby -c <afile>
autocmd BufWritePost *.pp !puppet --parseonly <afile>
augroup en
" SQL syntax highlighting inside Strings
let php_sql_query = 1
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" PHP
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" enable autocompletion for php functions
autocmd FileType php set omnifunc=phpcomplete#CompletePHP
let php_htmlInStrings = 1 " Enable HTML syntax highlighting inside strings:
let php_parent_error_close = 1 " For highlighting parent error ] or ):
let php_parent_error_open = 1 " For skipping a php end tag, if there exists an open ( or [ without a closing one:
let php_baselib = 1
let php_noShortTags = 1
" Include Drupal vim config
if filereadable(expand("~/.vimrc.drupal"))
source ~/.vimrc.drupal
endif
" Limit line lengths to 80 characters - seems to only work in comments.
autocmd FileType php setlocal textwidth=80
"cabbr cc !drush cc all
" Set :FSQL to format SQL
func FormatSQL()
%s/\(INNER\|OUTER\|LEFT\|RIGHT\|FROM\|WHERE\|ORDER\)\([a-z \,_\=\.\(\)0-9]\+\)/\r\1\2/g
%s/(SELECT/(\rSELECT/g
%s/) AS/\r) AS/g
set filetype=sql
nohl
normal! gg=G
endfu
com -nargs=* FSQL call FormatSQL()
func TrimSpaces() range
%s/\s\+$
nohl
endfu
com -nargs=* TRIM call TrimSpaces()
nnoremap ,v :execute "!drush vget ".shellescape(expand("<cword>"), 1)<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment