zsh-abbr
zsh-abbr copied to clipboard
support setting ABBR_TMPDIR to a value that doesn't end in `/`
Changes:
- Handle ABBR_TMPDIR values with or without trailing slash
- Create separate ABBR_TEMP per $UID or $USER (inspired by another user workaround on #54)
- chore: Remove (by vscode) trailing whitespaces in the file
Tested on Debian and MacOS.
Thanks for checking this. I changed the PR to focus on improving the handling of trailing slash to ABBR_TMP value. I'll create a separate PR for handling issue #54.
One question: How do I update this?
If we make this change, we'll also need to update the documentation
Thanks for making that update!
--
How do I update the documentation?
The repo is https://github.com/olets/zsh-abbr-v5-docs. There's also a direct "edit" link to the file at the bottom of every page on the docs site.
--
I apologize: Looking at this again, I would prefer the opposite of what I said in https://github.com/olets/zsh-abbr/pull/100#discussion_r1332109316. If we make ABBR_TMPDIR
always end in /
, then
- we only have to change that one line
- it won't be a breaking change. any third party scripts that expect
ABBR_TMPDIR
to end in/
will still work. I think..?
--
But before spending time on additional changes to this or to the docs, can you describe the problem you're solving?
I get that the "end custom ABBR_TMPDIR
values in a /
" is a gotcha. But I'm wary of changing it. I think the change is safe, but it feels like there might be some edge case. Not saying no, I just want to keep thinking about it for a bit.
I get that the "end custom ABBR_TMPDIR values in a /" is a gotcha.
It was indeed a gotcha moment for me that got me to suggest this change. I tried giving the ABBR_TMPDIR a custom value (based on suggestion from #54) without reading the documentation for it, and discovered it created weird directories like:
/tmp/zsh-abbr-ealapregular-user-abbreviations
/tmp/zsh-abbr-ealapglobal-user-abbreviations
And I think making it always end /
could make it look ambiguous on scripts that do not conventionally use ${}
for variables.
$ABBR_TMPDIRmycustomdir
But my goal here is to just make this variable accept both values with or without trailing /
. I want to use the variable without second guessing if I forgot to put a trailing /
or not.
make
ABBR_TMPDIR
always end in/
scripts that do not conventionally use
${}
for variables.
$ABBR_TMPDIRmycustomdir
would not only look funny, it wouldn't work: it's a single variable with that whole long name. ${X}y
isn't a stylistic choice, it's the way to distinguish between a variable Xy
and a variable X
followed by the string y
. In this case, not using ${}
is user error.
I tried giving the ABBR_TMPDIR a custom value (based on suggestion from https://github.com/olets/zsh-abbr/issues/54) without reading the documentation for it, and discovered it created weird directories
Makes sense. I'm going to keep thinking about this. Working on several other things right now so it might be a while. Silence doesn't mean I'm ignoring the proposal 👍
Hi @ealap thanks for your patience. I've merged your work trailing slash work, and released in it v5.6.0
(v5.6.0 also includes a solution to #54)
Lmk if you'd like me to add you to the list of contributors in https://github.com/olets/zsh-abbr#community and https://zsh-abbr.olets.dev/community/. If so I'll have the all-contributors bot open a pull request. I'll tag you in it, and you'll need to review to make sure the bot pulled the right info