kristijanhusak / vim-dadbod-ui

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

How to use the statusline feature? #143

Closed mweisshaupt1988 closed 2 years ago

mweisshaupt1988 commented 2 years ago

Hello, I'm trying to get the statusline feature to work but I might be missing something.

Consider this configuration snippet for lualine an example:

lualine_x = {{ vim.fn["db_ui#statusline"]({ show = {'db_name', 'table'}, separator = ' > ', prefix = '' }), }},

Also calling the function manually with or without parameters from the command line does not seem to produce any results. I'm using Neovim 8 and the latest version of dadbod and dadbod-ui. The databases are all postgres.

Can you point me to an example configuration where this function is used or verify if it still works? Thank you.

kristijanhusak commented 2 years ago

I'm not sure how to use it for lualine, but you can see how I define it for my custom statusline : https://github.com/kristijanhusak/neovim-config/blob/master/nvim/lua/partials/statusline.lua#L226-L253. Basically once you add it to a statusline, it should know to print something into statusline for buffers created by vim-dadbod-ui.

mweisshaupt1988 commented 2 years ago

I finally had some time to revisit this question.

Thanks for the example. For lualine I got it to work like this:

lualine_x = { function() return vim.fn["db_ui#statusline"]({ show = {'db_name', 'schema', 'table'}, separator = ' > ', prefix = ' ' }) end },