Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/vim/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vim 切换到DBExt中的下一个/上一个连接_Vim_Dbext - Fatal编程技术网

Vim 切换到DBExt中的下一个/上一个连接

Vim 切换到DBExt中的下一个/上一个连接,vim,dbext,Vim,Dbext,在DBExt中,您可以更改与的连接 DBSetOption profile=<profile name> DBSetOption配置文件= 但是有没有一种方法可以在下一个或上一个连接之间切换?或者我需要制作一个vimscript函数来处理这个问题吗?用vimscript解决: let g:dbext_default_profile_one = '...' let g:dbext_default_profile_two = '...' let g:dbext_default_pro

在DBExt中,您可以更改与的连接

DBSetOption profile=<profile name>
DBSetOption配置文件=

但是有没有一种方法可以在下一个或上一个连接之间切换?或者我需要制作一个vimscript函数来处理这个问题吗?

用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