Closed CRAG666 closed 3 years ago
Yes, that's expected behavior in FTerm
. That's because of this line https://github.com/numToStr/FTerm.nvim/blob/94e767f2f0fdd436c8aceadeae4d3e23166ee1f8/lua/FTerm/terminal.lua#L148
It closes the terminal buffer when the terminal itself exits.
Are there any plans to add this feature? I would love to be able to use a keymap to run a command and then bring up the terminal when it is done.
@bigjazzsound Is #27 what you want? If not, could you explain your requirement?
I guess @bigjazzsound's idea is that after an process is exited, the buffer does not automatically close before a key is pressed. This option gives the user the possibility to re-enter a hidden and terminated buffer to see output and exit code before allowing the buffer to die as well. Correct me if this interpretation is incorrect.
@numToStr, how about adding a setup parameter like close_on_kill = true
and adding a conditional guard around your TermClose
auto command to allow the users to choose to have it or not?
@jonathf Yeah, something like close_on_kill = true
is also on my mind but I didn't see much interest in this feature so I never implemented that.
I guess if you both @jonathf @bigjazzsound are interested in this then I'll implement that :)
I have implemented close_on_kill
as said. Please test it let me know if you have any suggestions :)
I tried this out and my terminal closes after the command completes.
local term = require "FTerm.terminal"
local tf = term:new():setup {
cmd = "terraform plan",
close_on_kill = false,
}
function _G.__tf()
tf:toggle()
end
When I run :lua __tf()
, the terminal pops up, but has no content except for the cursor, then closes after a few seconds.
I don't use terraform, but tried it out with just ls
and it worked just fine for me. I also tried with = true
, and as expected it dies instantly.
I am creating a code runner like the one in vscode, but when executing the terminal it is immediately sawed and does not show the output. Attached how I would like it to behave, it is the output in the default terminal of neovim.