numToStr / FTerm.nvim

:fire: No-nonsense floating terminal plugin for neovim :fire:
MIT License
743 stars 23 forks source link

Interface for sending commands to terminal #27

Closed jonathf closed 3 years ago

jonathf commented 3 years ago

Thanks for this project. Awesome to see what neovim can do these days with a little lua code.

I played around and I noticed that sending commands to running terminals was lacking. Think e.g. having a Python REPL which you want to send commands to like:

require 'FTerm.terminal':new():setup( cmd = "ipython" ):run("%run "..vim.fn.expand("%").."\n")

Current implementaiton can not be used for this, as it neither supports persisting the shell after a comand is run, nor allow sending commands to already running terminals.

It was easy enough to add this, so I made a patch for my own use. If this feature is of interested to you, I am open for discussing implementation details.

numToStr commented 3 years ago

Thanks for the contribution. Indeed, this is a useful feature and I was earlier wanted to implement it but didn't have any use case at that time.

So, I am willing to accept the changes, before that, I've left some comments to address. I am also open to add some patches to other parts of the code if required.

numToStr commented 3 years ago

Hi @jonathf sorry for delaying this for so long. I finally got the time to actually try this and I am pretty much satisfied with this. Although I've added some tweaks and updated the readme and raised another PR https://github.com/numToStr/FTerm.nvim/pull/33 that supersedes this. I hope you can review and If everything looks OK then I'll merge it.

And Thanks a lot for working on this.

jonathf commented 3 years ago

No worries. As I noted, I have an implementation for my own use. Glad to see that you found it useful enough to merge. :)

numToStr commented 3 years ago

Indeed this feature is useful :)