nvim-ide icon indicating copy to clipboard operation
nvim-ide copied to clipboard

option to configure which panel(s) are opened by default

Open mrjones2014 opened this issue 2 years ago • 9 comments

I'd like to open the right panel by default instead of the left, or have an option to not open either panel automatically when Neovim starts.

mrjones2014 avatar Nov 27 '22 17:11 mrjones2014

I would go a bit further: have the panels open depending on filetype (or provide an api to do that for example with ftplugin files)

sboesebeck avatar Nov 27 '22 17:11 sboesebeck

or provide an api to do that

There are commands to toggle them, so if we can just get an option to not open them by default, you could just toggle them open from an ftplugin

mrjones2014 avatar Nov 27 '22 17:11 mrjones2014

Yeah this is needed. Should be able to control what opens by default

ldelossa avatar Nov 27 '22 20:11 ldelossa

Can we also get an API to examine the current state of which sidebars are open and which components exist/are open in which sidebar?

You could do some neat stuff with that with filetype autocmds.

mrjones2014 avatar Nov 29 '22 14:11 mrjones2014

Can we also get an API to examine the current state of which sidebars are open and which components exist/are open in which sidebar?

You could do some neat stuff with that with filetype autocmds.

Yup, you can so this today by getting the current workspace from the workspace_registry, and then iterating on panels and checking ".is_open()". It would be trivial to wrap that into a library function.

ldelossa avatar Nov 29 '22 14:11 ldelossa

Awesome that sounds perfect. It would be neat to have a module for functions that are just useful for sort of interacting with the plugin from outside the plugin itself (e.g. the user interacting with the plugin from their own config)

mrjones2014 avatar Nov 29 '22 14:11 mrjones2014

Awesome that sounds perfect. It would be neat to have a module for functions that are just useful for sort of interacting with the plugin from outside the plugin itself (e.g. the user interacting with the plugin from their own config)

Having a bit of trouble visualizing that. Care to give an example?

ldelossa avatar Nov 29 '22 15:11 ldelossa

I guess the only examples I can think of are:

  • a function to get current state, would return a table like
{
  left = {
    open = true/false,
    -- component names as strings maybe?
    -- or a table with some info about each component maybe?
  },
  right = {
    open = true/false,
    -- same structure as `left`
  },
  center = {
    -- some info about center panel,
    -- whether its open and whats in it
  }
}

And functions for toggling sidebars and opening/closing components in a sidebar.

mrjones2014 avatar Nov 29 '22 16:11 mrjones2014

Looks useful!

ldelossa avatar Nov 29 '22 16:11 ldelossa