2015-12-08 2 views
1

В DBExt, вы можете изменить свое соединение сПереключение следующего соединения/предыдущая в DBExt

DBSetOption profile=<profile name> 

Но есть способ переключения между соединениями, как следующий или предыдущий? Или мне нужно сделать функцию vimscript, чтобы справиться с этим?

ответ

1

решаемые с 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