Commit Graph

11 Commits

Author SHA1 Message Date
Eric Nielsen eaebf1731c
Give credit to zrecompile doc in zshcontrib(1)
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!
2020-01-02 12:58:03 -05:00
Eric Nielsen 7139771ec6
Rename zimfw action clean-modules to uninstall
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).
2020-01-02 12:58:03 -05:00
Eric Nielsen 196a0585f7
Don't fail zimfw compile on empty fpath dir
otherwise it would fail with, for example

    zrecompile:zcompile:133: can't open file /usr/local/share/zsh/site-functions
2020-01-02 12:58:02 -05:00
Eric Nielsen 3ec1772ef2
Add LICENSE to zimfw.zsh 2020-01-02 12:58:02 -05:00
Eric Nielsen cec82ea0e5
Add zimfw init action for a quick build
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
2020-01-02 12:58:02 -05:00
Eric Nielsen c47c4fc08b
Compile also after upgrade, add ZIM_HOME to info
We want to recompile zimfw.zsh if it changes.
ZIM_HOME is not required to be set beforehand anymore, so let's give the
users the variable info back.
2020-01-02 12:58:02 -05:00
Eric Nielsen a227f134a5
Source .zimrc twice when installing/updating
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.
2020-01-02 12:58:01 -05:00
Eric Nielsen dfe35e1bfa
Generate static init.zsh script \o/
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.
2020-01-02 12:58:01 -05:00
Eric Nielsen 109279fc59
Indent git log in zimfw update 2020-01-02 12:58:01 -05:00
Eric Nielsen e7ba68511a
Fix git log in zimfw update not showing backtick
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.
2020-01-02 12:58:01 -05:00
Eric Nielsen 1980ca091d
Zim script in a single file \o/
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`.
2020-01-02 12:58:01 -05:00