toggleterm.nvim icon indicating copy to clipboard operation
toggleterm.nvim copied to clipboard

[Feature]: toggle term without putting focus on it.

Open Looooopy opened this issue 2 years ago • 3 comments

My use case:

I have a command to toggle all TUI on and off but not the open text buffers. So say I have Nvim-tree and ToggleTerm I hide both and show both when I toggle.

But when I toggle the terminal interface on it automatically take over focus and put it self in insert mode in the terminal. That is ok if I start a terminal and know I need to do something in the terminal, but not in this use case I would rather stay on the last focused window and let the me decide what to do.

So is there a way of turn this off I have not found any solution but maybe I missed it?

Looooopy avatar Mar 06 '22 22:03 Looooopy

I would like to know if this is possible as well. @Looooopy did you ever find a solution?

ryanmsnyder avatar Oct 19 '23 03:10 ryanmsnyder

This currently doesn't exist. There is an option to do this using TermExec go_back=true currently this doesn't apply to opening a terminal as far as I can remember. I don't have any bandwidth to add new features like this so if someone will like to contribute it please go ahead. Otherwise please no plus ones on this issue

akinsho avatar Oct 19 '23 10:10 akinsho

@Looooopy, I created a Telescope extension for managing Toggleterm terminals called toggleterm-manager. I also wanted the ability to toggle terminals open/closed (and other actions such as creating/renaming/deleting terminal buffers) without always focusing the terminal but in my case, I didn't want to necessarily leave the Telescope window. I know that's not exactly what you were looking for but you may be able to find a solution in one of the functions I wrote here.

ryanmsnyder avatar Nov 22 '23 04:11 ryanmsnyder