A continuation of #397 where the idea is taken a bit further, and a complete terminal view is being toggled instead of just the last toggled terminal. When working with the terminals you often want to save your complete view that you've been working on, instead of just closing terminals one by one, and opening them up (again) one by one. There's already a utility mapping that let's you open and close all of your terminals, but this doesn't take into consideration what was previously opened. Therefore to make smart_toggle even smarter we could save the current terminal view, and then open it up the next time it is triggered.
In order to achieve this functionality we could keep a list of terminals that were closed, and use it to go over the list to open them on next smart toggle.
* feat(toggleterm): add a simple winbar to show terminal data
* refactor(ui): use win set value
* refactor(ui): improve winbar styling and toggleability
* chore(lsp): update emmy annotations
* fix(toggleterm): toggle terminals on click
* chore(lsp): more Emmy lua fixes
* ci(test): target nvim nightly
* fix(ui): allow opening the first terminal if no id
* docs(README): add mention of winbar and config
* chore(ci): auto generate docs
* fix(toggleterm): revert unnecessary ID changes
Co-authored-by: akinsho <akinsho@users.noreply.github.com>
* style(toggleterm): format with stylua
* fix(terminal): correctly annotate lazy requires
* feat(terminals): save the current terminals mode into state
* test: add failing state tests
* refactor(config): add option to control persisting mode
so users can turn it off or on
* docs(README): add persist mode
* chore(ci): auto generate docs
* refactor(terminal): simplify matching for modes
Only "nt" and "t" are actually relevant not all the variants of all the
other different modes
* test: add but skip failing test case
seems to be broken due to delays starting a shell
Co-authored-by: akinsho <akinsho@users.noreply.github.com>
Simplified next_id() by removing the 'ids' table and calling
get_all() instead. The previous implementation did not always
produce unique IDs.
Remodelled the next_id test case by creating actuall terminals.
Before this patch, if you created 3 terminals with ID 1, 2, 3
and then closed the first terminal with id 1 using "exit",
the next_id was calculated to 2, resulting in a duplicate ID.
* If a user specifies highlights, these should actually be applied consistently
* If they specify shading terminal, this overrides any normal highlights and applies the shaded colours
* if the colorscheme changes, pick up on it and re-apply highlights
Add a separate config option to allow mapping terminal mode separately from insert mode. This means insert mode can be disabled whilst still allowing open mappings to work whilst input in a terminal