Closed ben-hansske closed 2 years ago
thank you so much for writing all of this ! i'm gonna go ahead and split the terminal code into its own module, also i renamed the element type to "term"
i'll try testing this and pushing whatever fixes i can later, too
printing out is also awfully slow on my machine for some reason, this is something else to investigate
another todo: hide the cursor in the terminal buffer
There is one more issue I forgot to mention up there: lolcat
for example sees that it does not output to a terminal and does not print colors unless it is forced with -f
. I already checked the $TERM
variable, but it looked fine. I think the best way to get around this might be to use vim.fn.termopen
instead of vim.api.nvim_open_term
. I'll give it a try.
let me know if you need/want testing from my side
Sorry for not responding in a while! Testing is of course much appreciated.
With the last commit I was able to sort out the following issues:
Remaining issues are still:
I am not sure how much you care about these two remaining issues. I would leave them as they are if you don't mind?
any update here what is missing ?
i'll try messing with animating the window position, but if it's not fruitful i'll just merge it as is for now, i think
line
does work, i don't really understand why line('.')
always returns 0 (even in normal files) but line('w0', winid)
is more like what we want i think
Hey @ben-hansske just coming to this now. Hadn't realised we had this awesome pull request in the works and more than happy to test this out. Is there anything we can borrow from dashboard.nvim's recent refactor?
Hi @olimorris, I am quite busy right now, but I will try to schedule some time the next week looking into the recent developement on dashboard.nvim.
@ben-hansske could you share the config you use with this pull request? I'm going to try and play around with it tonight.
There is an example theme: https://github.com/ben-hansske/alpha-nvim/blob/50-show-cmd-output-in-floating-window/lua/alpha/themes/dashboard-term.lua To use it
require'alpha'.setup(require'alpha.themes.dashboard-term'.opts)
should be enough.
Feel free to play around with it! The lines 37 - 56 are probably what you are looking for.
closed in favor of https://github.com/goolord/alpha-nvim/pull/124 for the moment
The code does what it should. You can run a execute a shell command and it will output to a terminal buffer inside a floating window. It can also run any other lua function that outputs a string via
vim.api.nvim_chan_send
. The filedashboard-term.lua
gives a short example on how to configure it and how to write a function that outputs to the terminal buffer. However there have been a couple of issues that I have not been able to solve or would like to hear your feedback:plenary.job
to run the external command. Is it ok to pull in an external dependency? Should I make it an optional dependency?sh -c
and then also pass the command as a string, so that it will be executed by the shell and can contain pipes.:vsplit
or:split
is executed, no second floating window will be spawned.alpha.lua
I had to setmodifiable
on the alpha buffer to true, because I got error messages otherwise. I do not really understand why I had to do this, because I thought with the functions called I would not even touch it? Just felt weird to me, that's why I tell you here. I am not very experienced with lua and neovims api.I am using this for almost a week now and did not encounter further problems. Please let me know what you think about this.