akinsho / akinsho/toggleterm.nvim
Spawn terminal job using a list (and other jobstart() opts)
- Lingua principale
- Lua
- Stelle
- 5.6k
- Fork
- 206
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
Would it be possible to use a list as terminal command instead of using a string? The [jobstart() api](https://neovim.io/doc/user/builtin.html#jobstart()) it is possible to supply a list, which is often convenient when calling a process, because all the argument quoting will be done by `jobstart()`.
I looked [at the code of task:__spawn()](https://github.com/akinsho/toggleterm.nvim/blob/6c7f5dbdd69bc5611a85194ddca83ac2c8ee84d6/lua/toggleterm/terminal.lua#L313-L333) and it seems that every command gets a comment with terminal id appended, e.g. `;#toggleterm#1`. I was wondering what is the reason for doing this? Are these id/filetype used somewhere else? Or would it be safe to remove it? This way it would be possible to just pass shell directly.
I guess that this is also the reason why https://github.com/akinsho/toggleterm.nvim/issues/184 happens. In `local cmd = self.cmd or config.get("shell")` a new shell invocation is created, but later `termopen` also starts a shell process, so there are 2 shells.
And a follow up question: would it be possible to pass other opts to [jobstart() api](https://neovim.io/doc/user/builtin.html#jobstart()). The interesting option is `env` which can be helpful for starting jobs that e.g. need to first load some environment like when using Python virtual environments. Then we could just pass `PYTHONPATH` via `env` instead of doing things like `cmd = "sh -c 'source venv/bin/activate && python script.py'"`.
I could create a PR, but wanted to hear your opinion first.
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Valutazione
Questa issue non è ancora stata valutata.