Ladies and gentlemen, we have README
.
Today was documentation day, and I now have a better screenshot (on the README). I am still unsure where to go from here. I may ask feedback from other established zsh project devs, just in case.
Ladies and gentlemen, we have README
.
Today was documentation day, and I now have a better screenshot (on the README). I am still unsure where to go from here. I may ask feedback from other established zsh project devs, just in case.
Today was a day of cleanup.
I got a few GitHub notifications on projects I worked on in the past. There was a new mako release, which I am happy to be a small part of. I do need to fix something that slipped my mind, which I’m kinda embarrassed about.
Additionally, I got an issue in on my vi-increment plugin, which I promptly fixed and pushed a point-release of. This actually was really good news; this is confirmation that other people actually use the stuff I write!
I need to change some process, I have a tendency to break stuff when renaming.
So a bad cold and a busy day made me take off Thursday.
“Today” (yesterday as I write this) I went ahead and added caching for truncation, as well as refactored the prompt function into its own file, and re-merged the code from the helper functions into the main function.
Not a terribly productive day, but I’m running out of useful changes. I may dedicate a day or two to README/wiki writing; never underestimate how important good docs are.
The way I implemented caching was flawed. I cached the entire formatted directory, for example:
# this is: -t c6 --pre '%F{magenta}'
__prompt_dir_glob__cache[/tmp/something]='%F{magenta}somet\u2025'
This will break if the user wants the last directory to always be not-truncated.
So, we now cache only the glob that matches, and check prefix/suffix/truncate every time.
The second thing I did was to split ::add_glob
out to its own file,
and add a --help
for it.
Finally, I also renamed things to use underscores.
While I prefer hyphens in functions,
the P10K API requires segments to be called prompt_$name
.
To prevent confusion, I just renamed everything.
I may revert this in the future, though.
Things are in place enough that I can make the demo more interesting. The demo now shows three use cases:
/some/path
with the default separator
(causing all /
to be colored as the previous dir)./some/path
with a colored separator./ 〉some 〉path
(but using nerd-fonts powerline symbols)
with a seperated root.(Ignore my bad cropping job pls)
The demo, of course, turned up some more bugs, so I took care of those too. I came up with an idea for next time, so I wrote a TODO as well.
I’m pretty confident 3 or 4 more days on this will do it.
After some discussion on the issue,
it was decided
that the WidnowId
class isn’t consistently defined as signed or unsigned.
So, by not specifying either,
we can adapt if projects do eventually agree.
Neat.
Anyway, not much happening today due to a family event.
The most code I wrote today was
in response to a Reddit post,
where I showed someone how zparseopts
works.
Here’s a link to the demo code on TIO.
I think I want to make a more comprehensive post on zparseopts,
maybe write a compatible Bash function to do the same thing.
(Or maybe I should stop taking on new projects.)
That said, I also fixed a bug in p10k-dir-glob.
More writing my custom powerlevel10k segment.
It’s to a point where I have it in my $ZDOTDIR/.zshrc
.
I split the main logic into its own autoloaded function file,
since I expect most users to have cache misses on 90% of their sessions.
Now that I’m using it daily,
I’ll probably get distracted by whatever paper cuts still remain in the project.
I also made an error? miscalculation? in a contribution to waybar. I’m curious what is wrong, because I made what looks like a fix to me, but not to the owner. They are almost certainly right, but I’m hoping to learn why.
Today was more work on p10k-dir-glob. I got a reply from romaktv, and I ended up implementing caching myself.
I also reworked how the initial-dir case was handled, and fixed some bugs.
Today, I started by pulling up a partially finished project: A replacement for Powerlevel10k’s default directory segment.
I intend to talk with romkatv (the author of P10k) to get some insight on how I can use the cache when displaying the prompt.
I ran a diff
between my existing code and where I ended today,
it can be found here.
The project will live here.
I converted to Zsh a while back, when I first saw the Oh-My-Zsh framework.
OMZ is really just a long chain of source
calls
with some logic to turn groups of features on or off.
I’ve since changed to Zplugin
(not to be confused with a similar framework, zplug),
a wonderful framework which supports asynchronous plugin loading.
This has better than halved the load time for Zsh on my Pi and phone (Termux).
However, my theme had not changed, it still has to wait until (relatively)
expensive git
calls have completed before redrawing the prompt.
Now is the time to change this.