Skip to content

Instantly share code, notes, and snippets.

@scheakur
Created September 20, 2011 16:01
Show Gist options
  • Save scheakur/1229505 to your computer and use it in GitHub Desktop.
Save scheakur/1229505 to your computer and use it in GitHub Desktop.
A config sample for quickrun.vim to run SQL.
" If needed
" let g:quickrun_config = {}
let g:quickrun_config['sql'] = {
¥ 'command': 'sqlplus',
¥ 'cmdopt': '-S',
¥ 'args': '%{g:get_oracle_connection("quickrun")}',
¥ 'tempfile': '%{tempname()}.sql',
¥ 'exec': '%c %o %a \@%s'
¥}
function! g:get_oracle_connection(mode)
let l:user_pass = s:get_option('oracle_user_pass', 'system/oracle')
let l:sid = s:get_option('oracle_sid', 'localhost/xe')
let l:sep = (a:mode == 'quickrun') ? '\\\@' : '@'
let l:conn = l:user_pass . l:sep . l:sid
return l:conn
endfunction
function! s:get_option(option_name, ...)
if exists('b:' . a:option_name)
return eval('b:' . a:option_name)
endif
if exists('g:' . a:option_name)
return eval('g:' . a:option_name)
endif
if a:0 > 0
" default value
return a:1
endif
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment