TabbyML / vim-tabby

Apache License 2.0
38 stars 2 forks source link

Load tabby on demand #3

Closed renzhamin closed 7 months ago

renzhamin commented 7 months ago

How can I set it up so that the plugin is completely disabled by default and load it with some setup function (via keymap or autocommands) And a way to disable it would be nice as well. Or a toggle

wsxiaoys commented 7 months ago

Discussed in https://github.com/TabbyML/tabby/issues/624

renzhamin commented 7 months ago

Discussed in TabbyML/tabby#624

This seemed to be related to tabby server. What I'm saying is that, maybe the plugin could be packaged inside a setup_tabby function and only run the plugin code after it's called.

renzhamin commented 7 months ago

I figured out a way to load tabby on demand when using lazy.nvim.

    {
        "TabbyML/vim-tabby",
        lazy = true,
        keys = { { "<Leader>et" } },
        config = function()
            vim.g.tabby_trigger_mode = 'manual'
            vim.g.tabby_keybinding_accept = '<Tab>'
            vim.g.tabby_keybinding_trigger_or_dismiss = '<C-\\>'
            vim.call("tabby#OnVimEnter")
        end
    },

Hitting '\et' will enable the plugin. If you want to disable it, you can run :call tabby#OnVimLeave(). But I couldn't get it to restart after calling this.

wsxiaoys commented 7 months ago

Glad you've figured it out! Yes it's better achieved in vim / nvim package manager.