Civitasv / cmake-tools.nvim

CMake integration in Neovim
GNU General Public License v3.0
366 stars 59 forks source link

change terminal.lua to handle on_exit #219

Closed khris190 closed 5 months ago

khris190 commented 5 months ago

this one might require some changes so take Your time reviewing it because i might have broke some option that i didnt even know existed

Civitasv commented 5 months ago

From https://github.com/Civitasv/cmake-tools.nvim/issues/145#issuecomment-1713694078

The design purpose of our own terminal is to provide a unified location for executing commands, so we can persistent env vars, store all commands that have been executed, give full access to the user (users who do not use CMakePresets) to set/modify specific cmake flags, support stdin, etc. The core idea is: when there is a terminal, we don't make a new one.

I don't know how to implement on_exit for this unified terminal, so I introduced full_cmd variable.

khris190 commented 5 months ago

that makes sense, i could try to implement it with screen command but it wouldn't work on windows without cygwin

khris190 commented 5 months ago

or and i'm not proud of this idea but w/e We could just write a lockfile when the command is run and add to end of every command ; rm {lockfile} with a coroutine checking if that file exists to execute on_exit with defer_fn

khris190 commented 5 months ago

i know You probably thought of most of the options but it just doesn't let me sleep

Civitasv commented 5 months ago

or and i'm not proud of this idea but w/e We could just write a lockfile when the command is run and add to end of every command ; rm {lockfile} with a coroutine checking if that file exists to execute on_exit with defer_fn

This maybe feasible.

Civitasv commented 5 months ago

i know You probably thought of most of the options but it just doesn't let me sleep

Don'r rush, take your time.