Created
June 28, 2011 23:57
-
-
Save msonnabaum/1052542 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Janus undo-ing | |
" Switch buffers without saving. | |
set hidden | |
" Having this on breaks highlighting text with visual mode and then hitting d | |
" to delete or = to indent. | |
unlet macvim_hig_shift_movement | |
let g:syntastic_auto_jump=1 | |
let g:syntastic_quiet_warnings=0 | |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" Drupal | |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
augroup module | |
autocmd BufRead *.module set filetype=php | |
autocmd BufRead *.install set filetype=php | |
autocmd BufRead *.inc set filetype=php | |
autocmd BufRead *.profile set filetype=php | |
autocmd BufRead *.test set filetype=php | |
augroup END | |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" PHP | |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" SQL syntax highlighting inside Strings | |
let php_sql_query = 1 | |
" 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 | |
" Limit line lengths to 80 characters - seems to only work in comments. | |
autocmd FileType php setlocal textwidth=80 | |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" Me | |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" 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() | |
func RB2PHP() | |
%s/^\(\s\+\)def \(.*\)$/\1function \2 {/g | |
%s/^\(\s\+\)if \(.*\)$/\1if (\2) {/g | |
%s/^\(\s\+\)end$/\1}/g | |
set filetype=php | |
nohl | |
normal! gg=G | |
endfu | |
com -nargs=* RB2PHP call RB2PHP() | |
" Format json using the "json" command from npm | |
func FJSON() | |
%! json | |
set filetype=javascript | |
nohl | |
normal! gg=G | |
endfu | |
com -nargs=* FJSON call FJSON() | |
" run the current script | |
nnoremap <Leader>dr :! drush scr % <RETURN> | |
nnoremap ® :! ./% <RETURN> | |
nnoremap <Leader>dv :execute "!drush vget ".shellescape(expand("<cword>"), 1)<CR> | |
nnoremap <Leader>da :execute "!open http://api.drupal.org/".shellescape(expand("<cword>"), 1)<CR> | |
nnoremap <Leader>dda :execute "!open http://api.drush.ws/api/function/".shellescape(expand("<cword>"), 1)<CR> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment