kristijanhusak / vim-dadbod-ui

Simple UI for https://github.com/tpope/vim-dadbod
MIT License
1.48k stars 86 forks source link

[Feature Request] Allow for context.vim in dbout buffer to keep headers visible #187

Open SebastianBehrens opened 1 year ago

SebastianBehrens commented 1 year ago

Would it not be nice to have the column headers visible even when scrolling through a table?

Context.vim is such a plugin for base vim. With the following config for that plugin one can keep the headers if one yanks the context of the dbout buffer to a modifiable buffer.

let g:context_extend_regex = '^\s*\([]{})]\|end\|else\|\(case\|default\|done\|elif\|fi\)\>\)\|^-\+'
let g:context_join_regex = '^\W*$\|^[^-]\+'
let g:context_skip_regex = '^\([<=>]\{7\}\|\s*\($\|\h\+\S\s*:\|#\|//\|/\*\|\*\($\|\s\|/\)\)\)\|^-\+'

What do you think?

kristijanhusak commented 1 year ago

I'm not familiar with that plugin. Do you know it could be introduced here? I see a lot of global variables in there, but I don't see a way to define it for specific filetypes.

Maybe we could just add some wiki how to use it instead of implementing it.

SebastianBehrens commented 11 months ago

Yes, using instead of implementing would make sense.

One issue though, the .dbout buffer with the results seems to be configured such that the plugin cannot modify it.

The regex above extends the plugin for results from MSSQL.

kristijanhusak commented 11 months ago

Why would it need to modify the buffer? Isn't it supposed to create floating window(s) above the actual buffer?

SebastianBehrens commented 11 months ago

I guess it is. What I wanted to say is that context.vim does not work on the .dbout buffer. But, admittedly, I don't know exactly why.

SebastianBehrens commented 11 months ago

To frame the problem differently and maybe without context.vim: It would be nice to see the header line of the output when inspecting output that is taller than the buffer height.