Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(table helpers): allow removing default table helpers #294

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
10 changes: 10 additions & 0 deletions autoload/db_ui/table_helpers.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 10 additions & 0 deletions doc/dadbod-ui.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down