I am trying to create a function that will open a single interactive command (called doc) in a terminal. I have it basically working with this function:
function()
vim.cmd.te()
local keys = vim.api.nvim_replace_termcodes("idoc<cr>", true, false, true)
vim.api.nvim_feedkeys(keys, "t", false)
end
The problem is that it takes a while to open, because of my .zshrc. And, after I quit the command, there is still a terminal running. This would be fixed if I could pass the flags --no-rcs and --onecmd to Zsh when I first ran :terminal. Is there a way to do this? And if not, is there some other way to fix the problems?
How about jobwait? The returned value of termopen is same as jobstart, which represents a job ID. We can use the jobwait function to wait for a job exits with the job ID. See :help jobstart() and :jobwait() for details.