Closed olimorris closed 2 years ago
there's a few other things i'll do to clean this up later & add some documentation, but other than that yeah this is a decent simplification of this feature
i'm unconvinced this is for the best but i pushed this commit https://github.com/goolord/alpha-nvim/pull/124/commits/8c373b14ab3fd8dbfdcd34526f6e92055636c266 which pushes all of the logic for the terminal type into alpha.term
.
pros
cons
term
thing to work. maybe it would be best if the extension api was a bit more formalized than 'mutate this table' so this wasn't a problem local alpha = require'alpha'
require'alpha.term'
since it's its own file, anyone who wants to use this before it gets merged can just copy the file somewhere and use it today 👍
I much prefer shifting all of the logic away from alpha.lua
. Keeps it much cleaner. The require("alpha.term")
makes sense too.
As for the damn scrolling 😆 . Tell me about it! I'm out of ideas on that. Dashboard hasn't worked it out either.
My workflow is I use the shortcuts to access buttons in my dashboard so don't even use j
or k
.
I would love to be able to use your nifty longest_line
method combined with total lines in a file to auto-populate the width and height.
You can do some weird stuff with lolcat
😆 :
https://user-images.githubusercontent.com/9512444/178848403-796b3093-c23c-4c1f-8f27-845e80cb12b8.mp4
i changed the api around a little to make it more consistent with the other element types, now you write
dashboard.section.terminal.command = "cat | lolcat -F 0.3 " .. os.getenv("HOME") .. "/.config/nvim/static/neovim.cat"
dashboard.section.terminal.width = 69
dashboard.section.terminal.height = 8
and the window configuration lives in opts.window_configuration
Just pushed a fix to term.lua
as the vim.tbl_extend
in the last commit was throwing an error when I amended my config.
New API is brilliant btw.
- the terminal does show a little 'process exited with code x' string at the bottom of the command, but maybe that's not a huge deal since you have to specify the height anyways
My solution to this is to use a pipe to cat so the process never exits.
cat | lolcat banner.txt
cat | cat myfile
Firstly, I want to say this is heavily inspired by the awesome work on #63 by Ben. This pull request builds on that. Secondly, under no pressure to merge this into main at all. This is simply my itch that I wanted to scratch :wink:.
Goal
The primary aim of this pull request is to create a simple API (fitting in with the existing API) which displays the output from a command as my header in my existing dashboard.
Context
I tried out dashboard.nvim again recently and the only positive it has over this plugin is its ability to display the output of a given command. It turned out it mattered to me quite a lot as I chase a glorious aesthetic of a Neovim dashboard.
Summary
I analysted #63 quite significantly alongside the dashboard.nvim implementation and in truth, borrowed a significant chunk of the actual logic to display the command from the latter. Changes to
alpha.lua
are pretty minimal as most of the logic resides in aterm.lua
file.But...in essence, the user passes a command to alpha-nvim which then runs it asynchronously before displaying it.
My config
My config which I used in testing:
with neovim.cat being the file I serve up with
lolcat
.Next steps
There's not a whole lot else I would add to this so keen to seek your views on how we could make it slicker or more in keeping with your API. Finally, thanks for such a great and well written plugin.