1

In DBExt, you can change your connection with

DBSetOption profile=<profile name>

But is there a way to switch between connections like next or previous? Or would I have to make a vimscript function to deal with that?

Olle Härstedt
  • 3,799
  • 1
  • 24
  • 57

1 Answers1

1

Solved with a Vimscript:

let g:dbext_default_profile_one = '...'
let g:dbext_default_profile_two = '...'
let g:dbext_default_profile = 'one'
let s:dbext_profiles = ['one', 'two']
let s:current_profile_number = 0 
function! Next_dbext_profile()
    " Reset current_profile_number if too high
    if s:current_profile_number >= len(s:dbext_profiles)
        let s:current_profile_number = 0 
    endif
    let l:exec_string = ':DBSetOption profile=' . s:dbext_profiles[s:current_profile_number]
    echo l:exec_string
    execute l:exec_string
    let s:current_profile_number = s:current_profile_number + 1 
endfunction
Olle Härstedt
  • 3,799
  • 1
  • 24
  • 57