akinsho / akinsho/toggleterm.nvim

[Feature idea]: Context-based toggling

Open
#289 6 comments 4 reactions 0 assignees View on GitHub
Dominant language
Lua
Stars
5.6k
Forks
206
PR merge metrics
No merged PRs in 30d

Description

Hi there! I've been using this plugin for quite a while (it finally got me off of tmux!), and wanted to ask for your opinion on this idea for a new configuration option + set of external utility functions. Currently, when using `:ToggleTerm` without a count, it defaults to "smart-toggling", which has the effect of opening the first unhidden terminal if none are open, and closing open terminals one by one otherwise. However, being a frequent user of `:tcd [directory]`, I would find it more useful for terminals to be opened on a per-tab basis, rather than per-session, and there are probably `:lcd [directory]` users out there who would like to have this effect per-window.

~~So, I'm proposing that we add a new config option `toggle_strategy` that can be set to `"first"`, `"by_tab"`, or `"by_window"` that lets the user select their preference. And we could expose the utility functions that work under the hood to find the correct terminal to toggle (based on context) so it is easy for the user to define additional commands if they want to toggle sometimes by tab, sometimes by window, sometimes globally, etc.~~ Edit: change of plans, see #290.

Of course, this is possible already with some amount of configuration work by the user, but I think explicitly supporting this could make things much easier on their end. And we can take the opportunity to generalize/unify some of the logic in the current implementation.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.