Skip to content

Commit 5a83ee1

Browse files
Merge pull request #294 from Cih2001/master
feat(table helpers): allow removing default table helpers
2 parents e8b53c0 + feef0b2 commit 5a83ee1

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,15 @@ let g:db_ui_table_helpers = {
189189
\ }
190190
```
191191

192+
Overriding a helper with an empty string will remove it.
193+
```vimL
194+
let g:db_ui_table_helpers = {
195+
\ 'postgresql': {
196+
\ 'List': ''
197+
\ }
198+
\ }
199+
```
200+
192201
### Auto execute query
193202
If this is set to `1`, opening any of the table helpers will also automatically execute the query.
194203

autoload/db_ui/table_helpers.vim

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,5 +221,15 @@ function! db_ui#table_helpers#get(scheme) abort
221221
let result = extend(result, get(g:db_ui_table_helpers, s:scheme_map[a:scheme], {}))
222222
endif
223223

224+
for [key, value] in items(result)
225+
if value == ''
226+
call remove(result, key)
227+
endif
228+
endfor
229+
230+
if empty(result)
231+
let result['List'] = ''
232+
endif
233+
224234
return result
225235
endfunction

doc/dadbod-ui.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,16 @@ defaults by passing in the matching helper name. To override `List`, do this:
476476
\ }
477477
\ }
478478
479+
Overriding a default helper with an empty string will remove it:
480+
481+
>
482+
let g:db_ui_table_helpers = {
483+
\ 'postgresql': {
484+
\ 'List': ''
485+
\ }
486+
\ }
487+
488+
479489
Note that `{last_query}` will be empty if no queries were ran before opening
480490
that helper. Also, in the `EXPLAIN` example above, running the explain helper
481491
and then running it again for another table will print double `EXPLAIN ANALYZE`

0 commit comments

Comments
 (0)