diff --git a/README.md b/README.md index 5ca2f1301e3a86e82104041434b51d59f3398ef8..9cb4d5f14aca4be3aa78b1fd7ba6c5f9074c9cc9 100644 --- a/README.md +++ b/README.md @@ -1122,6 +1122,8 @@ and * `g:sw_log_to_file`: If true, then the logging of the communication between `VIM` and `SQL Workbench/J` will be done in a file; otherwise, the logging is done in memory +* `g:sw_sql_name_result_tab`: If enable, rename the result tab using @wbresult; + default value: 1 ## Database explorer settings diff --git a/autoload/sw/sqlwindow.vim b/autoload/sw/sqlwindow.vim index 9ebba2d36d66fb76d27378e070a8b39c36580cfd..614e79bee648ac05f69c0cd1c41568d89021e5e5 100644 --- a/autoload/sw/sqlwindow.vim +++ b/autoload/sw/sqlwindow.vim @@ -858,18 +858,22 @@ function! s:do_execute_sql(sql) endfunction function! sw#sqlwindow#execute_sql(sql) - let w:auto_added1 = "-- auto\n" - let w:auto_added2 = "-- end auto\n" - - if (!s:check_sql_buffer()) - return - endif let _sql = a:sql - let title = substitute(a:sql, '\v[\n\r]', ' ', 'g') - if strlen(title) > 255 - let title = title[:255] . '...' - endif + + if g:sw_sql_name_result_tab == 1 + + let w:auto_added1 = "-- auto\n" + let w:auto_added2 = "-- end auto\n" + + if (!s:check_sql_buffer()) + return + endif + let title = substitute(a:sql, '\v[\n\r]', ' ', 'g') + if strlen(title) > 255 + let title = title[:255] . '...' + endif let _sql = '-- @wbresult ' . title . "\n" . _sql + endif call s:do_execute_sql(_sql) endfunction diff --git a/doc/vim-sql-workbench.txt b/doc/vim-sql-workbench.txt index d7a1e87f0c8ce1c7e4d08c3c5ece98e8904cfdcb..9f2419f0f418c4e6731513d600134d3590490564 100644 --- a/doc/vim-sql-workbench.txt +++ b/doc/vim-sql-workbench.txt @@ -1170,6 +1170,8 @@ SQL BUFFER SETTINGS: *vim-sql-workbench-sql_buffer_settings * `g:sw_log_to_file`: If true, then the logging of the communication between `VIM` and will be done in a file; otherwise, the logging is done in memory +* `g:sw_sql_name_result_tab`: If enable, rename the result tab using @wbresult; + default value: 1 -------------------------------------------------------------------------------- DATABASE EXPLORER SETTINGS *vim-sql-workbench-database_explorer_settings* diff --git a/plugin/sw.vim b/plugin/sw.vim index 6b73c170f5e5e3a26075673277effe40c3ecf573..6aa28b01b761faeba2955ae2512fdfffd2f29418 100644 --- a/plugin/sw.vim +++ b/plugin/sw.vim @@ -145,6 +145,10 @@ if !exists('g:sw_command_timer') let g:sw_command_timer = 1 endif +if !exists('g:sw_sql_name_result_tab') + let g:sw_sql_name_result_tab = 1 +endif + "if !exists('g:sw_overwrite_current_command') " let g:sw_overwrite_current_command = 0 "endif