On 2022-06-06, Manas wrote:
> Hi folks, I am writing a vim plugin and I want it to load in only one
> tab. Other tabs should be oblivious to the plugin. Is there a way to
> achieve that? Also, is it possible to load it in only one pane?
Vim doesn't load plugins into tabs, windows or buffers, it simply
loads plugins. Plugins can determine the tab, window or buffer that
is current when they are loaded, however, and can use that
information to control their behavior.
Vim uses the term "window" rather than "pane".
Vim has mechanisms that make it easy to limit the scope of a command
to a buffer, but not to a window or a tab page. For the most part,
a tab page is simply a set of windows.
See
:help windows-intro
:help tab-page-intro
The behavior of a command can be changed according to the current
window or tab page by testing the current window or tab page or by
using a window-local or tab-local variable. The gettabinfo()
returns a list of all the windows in the current tab, which could be
useful.
See
:help t:var
:help gettabvar()
:help gettabinfo()
You can probably achieve the behavior you want, just not the way you
thought you could.
If you need more information, it would help to know what you are
trying to achieve and what things you want to happen or not happen
in particular tabs or windows.
Regards,
Gary