Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: expose terminal management for plugin integrations #122

Closed
1 task done
GeorgesAlkhouri opened this issue Nov 20, 2024 · 1 comment · Fixed by #120
Closed
1 task done

feature: expose terminal management for plugin integrations #122

GeorgesAlkhouri opened this issue Nov 20, 2024 · 1 comment · Fixed by #120
Labels
enhancement New feature or request

Comments

@GeorgesAlkhouri
Copy link

Did you check the docs?

  • I have read all the snacks.nvim docs

Is your feature request related to a problem? Please describe.

Hi!
I'm creating my first Neovim plugin (nvim-aider) for Aider integration. Currently, I need to reimplement terminal management logic that already exists in snacks.nvim. Access to the internal terminals table and terminal ID generation would allow better integration and reduce code duplication.

Describe the solution you'd like

Expose two internal components from snacks.terminal:

The terminals table storing active terminal instances
The terminal ID generation logic (either as a function or by exposing the implementation)

This would enable plugins to:

Track existing terminals without reimplementation
Generate consistent terminal IDs
Better integrate with snacks.nvim terminal management

Describe alternatives you've considered

I'm currently reimplementing this functionality in nvim-aider as shown in the terminal.lua module. Having access to snacks' internal terminal management would make the integration more robust and maintainable. Also many thanks for the creating of snacks.

Additional context

No response

@GeorgesAlkhouri GeorgesAlkhouri added the enhancement New feature or request label Nov 20, 2024
@folke folke closed this as completed in 7f63d4f Nov 20, 2024
@folke
Copy link
Owner

folke commented Nov 20, 2024

See the updated docs.

--- Get or create a terminal window.
--- The terminal id is based on the `cmd`, `cwd`, `env` and `vim.v.count1` options.
--- `opts.create` defaults to `true`.
---@param cmd? string | string[]
---@param opts? snacks.terminal.Opts| {create?: boolean}
---@return snacks.win? terminal, boolean? created
function M.get(cmd, opts)

GeorgesAlkhouri added a commit to GeorgesAlkhouri/nvim-aider that referenced this issue Nov 21, 2024
Removed redundant terminal ID generation and caching logic. Simplified
the `toggle` and `send` functions by directly using `snacks.terminal`
methods. This change reduces complexity and improves maintainability.

Closes folke/snacks.nvim#122. Thanks to @folke
for closing it.
folke pushed a commit that referenced this issue Nov 22, 2024
🤖 I have created a release *beep* *boop*
---


## [2.5.0](v2.4.0...v2.5.0)
(2024-11-22)


### Features

* **dashboard:** added Snacks.dashboard.update(). Closes
[#121](#121)
([c770ebe](c770ebe))
* **debug:** profile title
([0177079](0177079))
* **notifier:** show indicator when notif has more lines. Closes
[#112](#112)
([cf72c06](cf72c06))
* **terminal:** added Snacks.terminal.get(). Closes
[#122](#122)
([7f63d4f](7f63d4f))
* **util:** get hl color
([b0da066](b0da066))
* **util:** set_hl managed
([9642695](9642695))


### Bug Fixes

* **dashboard:** `vim.pesc` for auto keys. Fixes
[#134](#134)
([aebffe5](aebffe5))
* **dashboard:** align should always set width even if no alignment is
needed. Fixes [#137](#137)
([54d521c](54d521c))
* **dashboard:** better git check for advanced example. See
[#126](#126)
([b4a293a](b4a293a))
* **dashboard:** open fullscreen on relaunch
([853240b](853240b))
* **dashboard:** randomseed needs argument on stable
([c359164](c359164))
* **debug:** include `main` in caller
([33d31af](33d31af))
* **git:** get_root should work for non file buffers
([723d8ea](723d8ea))
* **notifier:** hide existing nofif if higher prio notif arrives and no
free space for lower notif
([7a061de](7a061de))
* **quickfile:** don't load when bigfile detected. Fixes
[#116](#116)
([978424c](978424c))
* **sessions:** change persisted.nvim load session command
([#118](#118))
([26bec4b](26bec4b))
* **terminal:** hide on `q` instead of close
([30a0721](30a0721))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants