kristijanhusak / vim-dadbod-ui

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

UI Only works after connect with db with dadbod #190

Closed DeodatoBastos closed 1 year ago

DeodatoBastos commented 1 year ago

I have to connect with my db first with raw dadbod to can you the ui.

The following error appears:

error

When I try again, this happes:

error2

The database password is "my_password".

Configuration with lazy:

{
        "tpope/vim-dadbod",
        cmd = "DB",
        opt = true,
        requires = {
            "kristijanhusak/vim-dadbod-ui",
            "kristijanhusak/vim-dadbod-completion",
        },
    },
    {
        "kristijanhusak/vim-dadbod-ui",
        cmd = require("settings.dbui").cmd,
        init = function()
            require("settings.dbui").init()
        end,
        dependecies = require("settings.dbui").dependencies,
    },
    {
        "kristijanhusak/vim-dadbod-completion",
        opt = true,
    },

the dbui.lua file:

return {
    cmd = {
        "DBUI",
        "DBUIToggle",
        "DBUIAddConnection",
        "DBUIFindBuffer",
        "DBUIRenameBuffer",
        "DBUILastQueryInfo",
        "DBUIHideNotifications"
    },
    init = function()
        vim.g.db_ui_show_help = 0
        vim.g.db_ui_win_position = 'right'
        vim.g.db_ui_use_nerd_fonts = 1

        vim.g.db_ui_save_location = '~/.local/share/db_ui'
        -- vim.g.db_ui_tmp_query_location = '~/code/queries'

        vim.g.db_ui_hide_schemas = { 'pg_toast_temp.*' }
    end,
    dependencies = {
        {
            'tpope/vim-dadbod',
            lazy = true
        },
        {
            'kristijanhusak/vim-dadbod-completion',
            ft = { 'sql', 'mysql', 'plsql' },
            lazy = true
        },
    },
}
kristijanhusak commented 1 year ago

This is definitely due to lazy configuration. I'm not sure I understand what you posted. You have everything defined twice. You can check how I set it up https://github.com/kristijanhusak/neovim-config/blob/master/nvim/lua/partials/plugins/db.lua#L1

kristijanhusak commented 1 year ago

I added an example with lazy.nvim in the docs https://github.com/kristijanhusak/vim-dadbod-ui#installation. Let me know if it works out.

DeodatoBastos commented 1 year ago

That doesn't work for me.

I will try to explain better:

When I try to run :DBUIToggle for the first time without run :DB these errors appears:

dbui_error_first

When I try to run :DBUIToggle for the second time:

dbui_error_second

For the third(+) time:

dbui_error_third

The same happens when I use :DBUI, but the function is open instead of toggle. After use :DBUI or :DBUIToggle for the second time, I cannot use I it at all without restart Neovim.

If I run :DB after the first time or before :DBUI or :DBUIToggle everything works well.

kristijanhusak commented 1 year ago

This is a configuration issue. I checked your dotfiles. Try removing this section https://github.com/DeodatoBastos/nvim-setup/blob/main/lua/plugins.lua#L231-L239 and this section https://github.com/DeodatoBastos/nvim-setup/blob/main/lua/plugins.lua#L248-L251, do :Lazy sync and try again.

DeodatoBastos commented 1 year ago

That's works thanks!

I've already tried this, but isn't working. I see now that there was a typo in my settings.

Thank you for the help! Btw, incredible plugin!