Skip to content

Commit

Permalink
resolve #33
Browse files Browse the repository at this point in the history
  • Loading branch information
cosminadrianpopescu committed Apr 3, 2018
1 parent 8622616 commit acc41ef
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
11 changes: 11 additions & 0 deletions autoload/sw/sqlwindow.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions plugin/sw.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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('<cword>')))
command! -nargs=0 SWSqlInsertMatch call sw#sqlwindow#match()
command! -bang -nargs=0 SWSqlWipeoutResultsSets call sw#sqlwindow#wipeout_resultsets(<bang>0)
command! -bang -nargs=? -complete=file SWInclude call sw#sqlwindow#include(<bang>0, <f-args>)

command! -nargs=+ -complete=customlist,sw#autocomplete_profile SWServerStart call sw#server#run(<f-args>)
command! -nargs=1 SWServerStop call sw#server#stop(<f-args>)
Expand Down

3 comments on commit acc41ef

@borisbrodski
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, would you please also extend the documentation? Thank you!

@cosminadrianpopescu
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, did another commit. Basically, you do SWInclude to include the current file. You can also do SWInclude <file> to include a given file. Another thing is that you can use !. Doing SWInclude! will use the alternate delimiter

@borisbrodski
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. I already love the “!“ :)

Please sign in to comment.