akinsho / akinsho/toggleterm.nvim
Spawn terminal job using a list (and other jobstart() opts)
- Lenguaje dominante
- Lua
- Estrellas
- 5.6k
- Forks
- 206
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
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.
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Evaluación
Este issue todavía no se ha evaluado.