Had to remove ${DIR} before renaming ${dir_new} to ${DIR}.
Also also add ${REV} to the info file, in case we need it in the future,
when extracting Zim's degit as a standalone tool for example.
and rename previous to git.
Tools allow for different install and update scripts. The git tool does
what the previous implementation did (installs and updates using the git
client). The new tool installs and updates with the GitHub API, not
using the git client, but using curl/wget and tar instead.
Closes#373
`foo | sed 's?^.*/v??' | sort -n -t. -k1,1 -k2,2 -k3,3 | tail -n1` is
the same as `${${(On)${(f)"$(foo)"}##*v}[1]}`. We don't want to depend
on external tools that might not be available in all platforms.
to avoid conflicts when we have Zim modules made to also be compatible
with ohmyzsh, like https://github.com/zimfw/pvenv
We don't want to be affected by the noise a `${module_name}.plugin.zsh`
file creates, as we always want to source `init.zsh` when a module also
has a `functions` subdir. Hope this better protects us from the "wild
west out there".
We need to fetch all branches first to handle the scenario when the HEAD
remote branch was renamed. Recently repositories started changing their
HEAD branch names from master to main.
Fixes#424
The regression was introduced in commit 3567694. I wrongly assumed that
`git fetch -pq origin HEAD` would fetch from the remote default branch.
Fixes#423
as we do for init.zsh, so behavior is symmetric. This guarantees that
both init.zsh and login_init.zsh will always have newer timestamps than
.zimrc after a build.
gunzip should not try to seek the stream, but an issue was reported
in #407, where it fails with
gzip: stdin: unexpected end of file
So we're writing to a file first just to be safer.
Fixes#407.
Pattern must match from the beginning (`##`).
Also don't quote ${ZIM_HOME}. We don't want to have an array like
('${ZIM_HOME}' '/path/to/zim_home'), so it needs to be unquoted for the
uniqueness to work.
instead of allowing xargs to execute the action with no positional
parameters.
Also don't try to write to .latest_version if there's no write
permission. This is supposed to be a background/optional operation, so
we don't want to show an error message in this case.
And use Zsh globs instead of find with -exec, and find won't fail if
there's an error with the -exec command.
before initial check for latest version. Not all versions of Zsh or all
OSs are affected. Error seen with Zsh 5.6.2 running on FreeBSD is:
_zimfw_version_check:10: no such file or directory: /path/to/.latest_version
Last-minute minor fixes:
* Delete .latest_version after upgrading. Having a cache brings in these
complexities.
* Print warning to stderr, to distinguish it from the normal output.
* Update help to be in sync with the README.md.
as it was being used to update the login_init.zsh script. BUT the
function mentioned, which updates that script, would only be updated
after zimfw.zsh is sourced again, so no point in trying to call it at
this point.
so the normal output is focused on the given action, and output for
additional steps perfomed after the given action is only shown in
verbose mode.
Also, the output of wget is only shown in verbose mode. This is because
wget always shows some output (to stderr) even when there are no errors.
See https://serverfault.com/q/70889/302338
This should give a friendlier output.
See #360
Zim does not use/modify .zprofile in it's templates. For completeness/
performance, the .zprofile should be compiled/cleaned if present.
Ref: http://zsh.sourceforge.net/Intro/intro_3.htmlCloses#358
It fails with
_zimfw_build_init:8: unrecognized modifier `P'
The `:P` modifier was introduced in Zsh 5.3. Replace it by `:A`, as we
still want to keep compatibility with Zsh 5.2.
Fixes#349
Changes:
* Reduce the Zim "core" to a single file
* Simplify installation with an installation script (Closes#182)
* Put the configuration into .zshrc instead of a separate .zimrc
(Closes#288)
* Do not support themes that require promptinit (See #325)
* Generate a static script that does autoload the functions and source
the modules
This version is not backwards-compatible with previous versions, so a
new installation of Zim is required.
At least until Zsh version 5.7.1, no performance improvement is observed
out of using those.
In some cases, the performance is even worsened, like when using
autoload -w functions_digest.zwc
instead of
autoload func_name1 func_name2 ...
So we can have the following code in the zlogin template:
source ${ZIM_HOME}/login_init.zsh -q &!
instead of depending on the zimfw function there. This allows fixing the
issue were a non-interactive login shell currently yields:
command not found: zimfw.
To fully fix the issue, we also need a new zshenv template containing:
ZIM_HOME=${ZDOTDIR:-${HOME}}/.zim
Templates will be updated in the install script.
we want to be a universal Zsh framework, and send the message that
"less is less"! ;- )
Don't indent done and failed messages with an indicator, at the end of
actions, to differentiate them from intermediate okay and error messages.
and make code closer to the one in the manual pages (unless for our code
style). Why reinvent the wheel?
This last change makes the arguments to zrecompile shorter (passing
relative paths instead of full paths to each function file).
The number of arguments can be huge. There are 1143 of them currently
for /usr/local/Cellar/zsh/5.7.1/share/zsh/functions!
and have `zimfw clean` only do `clean-compiled` and `clean-dumpfile`.
Semantically, it makes much more sense because we will be then cleaning
temporary files that are later compiled/generated again, which is not
the case for a module (which we'll be uninstalling now instead of
cleaning).
Having to manually do `zimfw build` every time after you edit your
.zimrc file is boring. So by having the following in .zshrc before
sourcing init.zsh will do a quick build automatically when needed:
if [[ ~/.zim/init.zsh -ot ~/.zimrc ]]; then
source ~/.zim/zimfw.zsh init -q
fi
Once before installing/updating to prepare _zmodule_xargs, and once
after modules are updated, so functions and scripts can be found inside
them. Installation of Zim from scratch was failing because all modules
are empty at first.
to autoloads the functions and sources the scripts, instead of executing
zimfw during startup, and having it always figuring out what do to on
the fly.
This takes out the worry about zimfw interfering with the startup time,
and allows room to add more features to it. So, zstyle was replaced by a
custom zmodule function to define the modules, with the extra ability of
allowing users to set custom fpath paths, autoloaded functions and
sourced scripts per module.
because it was being processed as the beginning of a escape sequence.
Using `print -R` fixes that. Probably a good idea to use it when
printing other messages that contain externally-generated output.
Also moved the templates out of this repository, and into the
zimfw/install repo.
This is a second big change after introducing the plugin mechanism. This
makes installation and upgrading of Zim straightforward. Maybe the most
important aspect of having the script in a single file is not having to
manage "git repos inside git repos" (see #297), since the single file
exists by itself and is not version-controlled (with git).
I've implemented a two-stage sourcing of the file, so most of the file
is only sourced when needed (namely when calling `zimfw` with any action
other than `login-init`). The two-stage process is designed to avoid
compromising the startup speed, which is our top priority.
In an effort to help making the script maintainable, I've broken it into
small ERB templates. This also adds the ability to pre-process the Zsh
code with Ruby code. To build the script, use `make`.