From acc41ef44fa7028d608c6055b79696da1fc0b03e Mon Sep 17 00:00:00 2001 From: Cosmin Popescu Date: Tue, 3 Apr 2018 07:57:20 +0200 Subject: [PATCH] resolve #33 --- autoload/sw/sqlwindow.vim | 11 +++++++++++ plugin/sw.vim | 1 + 2 files changed, 12 insertions(+) diff --git a/autoload/sw/sqlwindow.vim b/autoload/sw/sqlwindow.vim index 0dd0fae..6f186a9 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 159cf03..38367c1 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() -- GitLab