diff --git a/autoload/sw/sqlwindow.vim b/autoload/sw/sqlwindow.vim index 0dd0faec9bf77c234d4bbae105b4a2a197c3ef01..6f186a906a86ea8c569e2d82b8ad143860bad482 100644 --- a/autoload/sw/sqlwindow.vim +++ b/autoload/sw/sqlwindow.vim @@ -1532,3 +1532,14 @@ function! sw#sqlwindow#filter_with_sql(where_part) call sw#sqlwindow#refresh_resultset() endfunction + +function! s:include(file, delimiter) + let sql = 'wbinclude -delimiter="' . a:delimiter . '" -file="' . a:file . '"' . ';' + call sw#sqlwindow#execute_sql(sql) +endfunction + +function! sw#sqlwindow#include(alt_delimiter, ...) + let delimiter = s:get_delimiter(a:alt_delimiter) + let file = a:0 ? a:1 : sw#bufname('%') + call s:include(file, delimiter) +endfunction diff --git a/plugin/sw.vim b/plugin/sw.vim index 159cf0379a487f1456e015a29dbf4ebd70979103..38367c18c22a9e4cfbcf724e586c0206a9c6beaf 100644 --- a/plugin/sw.vim +++ b/plugin/sw.vim @@ -248,6 +248,7 @@ command! -bang -nargs=+ -complete=customlist,sw#sqlwindow#complete_insert SWSqlG command! -nargs=0 SWSqlGetMacroSql call sw#to_clipboard(sw#sqlwindow#get_macro_sql(expand(''))) command! -nargs=0 SWSqlInsertMatch call sw#sqlwindow#match() command! -bang -nargs=0 SWSqlWipeoutResultsSets call sw#sqlwindow#wipeout_resultsets(0) +command! -bang -nargs=? -complete=file SWInclude call sw#sqlwindow#include(0, ) command! -nargs=+ -complete=customlist,sw#autocomplete_profile SWServerStart call sw#server#run() command! -nargs=1 SWServerStop call sw#server#stop()