Closed luiz00martins closed 1 year ago
Great Idea! I'll add support for function in cmd
.
Thanks @numToStr. I'm still having some difficulties.
Do you know the reason why cmd = function() return 'cd "'..vim.fn.expand('%:p:h')..'" ; lazygit' end
isn't working?
What I mean by that is that the lazygit
command is not executed inside the cd'ed folder (you can confirm this by using cmd = function() return 'cd "'..vim.fn.expand('%:p:h')..'" ; bash' end
instead, in which bash will not start in the folder).
@luiz00martins Looks like you are running multiple commands. But :h termopen
(which uses jobstart
) only supports single command.
:cry:
I'm trying to run a terminal with
'cd "'..vim.fn.expand('%:h')..'" ; cd "$(git rev-parse --show-toplevel)" ; lazygit'
everytime the terminal is (re)opened. This is not currently possible, as thecmd
is only evaluated upon creation.It would be nice if the I could use a function instead of a string on
cmd
, which would be called on every startup of the terminal:Note: I'm posting this request because
terminal:run()
won't suffice, asrun
will re-run the command on every execution, while settingcmd
would only re-run the command when the terminal is closed and reopened.