diff --git a/README.md b/README.md index 9e58cac..af84959 100644 --- a/README.md +++ b/README.md @@ -189,6 +189,15 @@ let g:db_ui_table_helpers = { \ } ``` +Overriding a helper with an empty string will remove it. +```vimL +let g:db_ui_table_helpers = { +\ 'postgresql': { +\ 'List': '' +\ } +\ } +``` + ### Auto execute query If this is set to `1`, opening any of the table helpers will also automatically execute the query. diff --git a/autoload/db_ui/table_helpers.vim b/autoload/db_ui/table_helpers.vim index 14c3c18..225257a 100644 --- a/autoload/db_ui/table_helpers.vim +++ b/autoload/db_ui/table_helpers.vim @@ -215,5 +215,15 @@ function! db_ui#table_helpers#get(scheme) abort let result = extend(result, get(g:db_ui_table_helpers, s:scheme_map[a:scheme], {})) endif + for [key, value] in items(result) + if value == '' + call remove(result, key) + endif + endfor + + if empty(result) + let result['List'] = '' + endif + return result endfunction diff --git a/doc/dadbod-ui.txt b/doc/dadbod-ui.txt index e7c3608..d234de9 100644 --- a/doc/dadbod-ui.txt +++ b/doc/dadbod-ui.txt @@ -476,6 +476,16 @@ defaults by passing in the matching helper name. To override `List`, do this: \ } \ } +Overriding a default helper with an empty string will remove it: + +> + let g:db_ui_table_helpers = { + \ 'postgresql': { + \ 'List': '' + \ } + \ } + + Note that `{last_query}` will be empty if no queries were ran before opening that helper. Also, in the `EXPLAIN` example above, running the explain helper and then running it again for another table will print double `EXPLAIN ANALYZE`