1
0
Fork 0
mirror of synced 2024-11-22 15:25:34 -05:00
Commit graph

654 commits

Author SHA1 Message Date
Eric Nielsen
424526ebee
Refactor: extract _zimfw_print function 2020-01-09 07:13:31 -05:00
Marko Kaznovac
2cc69d5d6f
Add .zprofile to the list of startup files
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.html

Closes #358
2020-01-08 16:58:55 -05:00
Eric Nielsen
12a4bb6000
Zsh 5.2 does not recognize the :P modifier
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
2020-01-08 16:45:54 -05:00
Eric Nielsen
0213f77805
Update ISSUE_TEMPLATE.md
Closes #352.
2020-01-07 11:34:17 -05:00
Eric Nielsen
4c2487eef5
Add CHANGELOG.md
Closes #356. Closes #352.
2020-01-07 11:26:38 -05:00
Eric Nielsen
dd84c41ae5
v1.0.0
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.
2020-01-02 13:13:12 -05:00
Eric Nielsen
edee218bb6
Merge branch 'develop' 2020-01-02 13:02:34 -05:00
Eric Nielsen
d1b984aeb2
Update .gitignore
due to latest changes on how Zim works.
2020-01-02 12:58:05 -05:00
Eric Nielsen
0b19b2f89a
Update README.md and zimfw output
due to latest changes on how Zim works.
2020-01-02 12:58:04 -05:00
Eric Nielsen
5587ea14da
Update autoload functions glob
based on glob used in Prezto:
https://github.com/sorin-ionescu/prezto/blob/1bc0da5f48init.zsh#L79
and in compinit:
https://github.com/zsh-users/zsh/blob/b816291a17/Completion/compinit#L499
2020-01-02 12:58:04 -05:00
Eric Nielsen
ae3e71cb84
Don't create function digest files
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 ...
2020-01-02 12:58:04 -05:00
Eric Nielsen
c13fe60b02
Update README.md with new zshenv template 2020-01-02 12:58:04 -05:00
Eric Nielsen
aade4704b1
Generate login_init.zsh file
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.
2020-01-02 12:58:04 -05:00
Eric Nielsen
93bbc35634
Use ASCII characters only
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.
2020-01-02 12:58:03 -05:00
Eric Nielsen
4b750cb72f
Fix zimfw failing in termux with NO_CASE_GLOB
that is set by the completion module.
This is a known still unsolved issue with termux.
See https://github.com/termux/termux-packages/issues/1894
2020-01-02 12:58:03 -05:00
Eric Nielsen
3ae4fec895
Use builtin cd -q
to bypass aliases and to avoid calling any chpwd hook functions.
2020-01-02 12:58:03 -05:00
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
e2e2cfc22c
Rename clean-modules to uninstall in README.md too 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
8c7d0081b1
Add manual installation to README.md 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
Eric Nielsen
27508e363c
Stop supporting themes that require prompinit
Only 5% (18/342) of the themes listed under [unixorn/awesome-zsh-plugins]
are actually compatible with prompinit. Of these, [clean] also allows
being sourced directly. On the other hand, 3 others are prezto themes.

promptinit would be useful for who wants to try many themes without the
need to restart their shell session. And must be many many, so
"brute-force" starting a new shell to experiment each new theme would be
a burden! Even the cleanup feature of promptinit is still incomplete, so
you eventually get a messy prompt after trying many with it. And that's
not even a everyday use case of the average Zsh user.

So prompinit it not widely supported out there, and also not very useful
for the everyday let-me-use-my-beloved-and-carefully-customized-prompt-during-the-whole-shell-session-pleasee
scenario. It's also faster and simpler to directly just source the prompt
theme to be used, not even having to autoload promptinit and let it scan
all the others themes in fpath that won't be used.
And the Zim "philosophy" is to use fast and simple solutions.
So here we go.

Fixes #325

[unixorn/awesome-zsh-plugins]: e226f3de04/README.md (themes)
[clean]: https://github.com/BrandonRoehl/zsh-clean
2020-01-02 12:58:01 -05:00
Eric Nielsen
536d7b7890
Allow modules that are not repos
so going into their ${ZIM_HOME}/modules/foo directory would be like
still being inside the Zim repo, in ${ZIM_HOME}. Don't try to update
them in this case.

This was supposed to be working before, but my ${ZIM_HOME} was not a
repo when I was still developing this locally.
2020-01-02 12:58:00 -05:00
Eric Nielsen
2a51211ab7
Update README.md with automatic installer
Also change formatting of the settings. Using `<em></em>` to prevent
URL autolinking in some cases, and to add emphasis where `*foo*` would
be ambiguous for the Markdown format.

Copy was also slightly improved, hopefully for better clarity.
2020-01-02 12:58:00 -05:00
Eric Nielsen
8dc3e43a0d
Add a plugin mechanism \o/
This is a major change, where Zsh modules/plugins are not git submodules
in the Zim repo anymore, but customized and installed separately as
individual repositories. The discussion about this started more than 2
years ago in #88. Closes #299.

This will allow contributors' modules to live in their own repositories.
See #33, #138, #262, #281, #324.

The current code has what, up to this point, I considered to be the best
balance between simplicity, execution speed and number of files.

One measured decision was to make the initialization of modules depend
only on the `':zim' modules` style, keeping it as fast as possible.
The `':zim:module' module` style is used to install, update and clean
the modules, all operations that happen after the user got his
as-blazing-fast-possible shell prompt.

Even though I didn't care much about making install or update fast,
`xargs` has a nice feature of allowing commands to be executed in
parallel with `-P`. I took advantage of that.

I've also worked on making the `zimfw` utility give the user some nice
(while still minimalistic) output. Also I'm suggesting this as the new
name for the `zmanage` tool, since `zimfw` does not shadow the `zim`
wiki tool.
2020-01-02 12:58:00 -05:00
Eric Nielsen
5d66578c47 Update submodules
* zsh-syntax-highlighting to HEAD
* lean to HEAD
* liquidprompt to HEAD
* pure to release v1.11.0
2019-11-19 14:54:39 -05:00
Matt Hamilton
954f53d01d
update static image URL 2019-11-14 09:06:26 -05:00
Grant Guthrie
d19c8dde68 [history-substring-search] Verify terminfo before bindkey
Closes #341
2019-09-28 07:57:28 -05:00
Eric Nielsen
b180b40b27 Update submodules
* zsh-autosuggestions to release v0.6.3
* zsh-completions to release 0.30.0
* zsh-history-substring-search to HEAD
* zsh-syntax-highlighting to HEAD
* lean to HEAD
* liquidprompt to HEAD
* pure to release v1.10.3
2019-07-13 18:30:33 -05:00
Eric Nielsen
de8027f19d Remove cursor highlighter from zimrc template
Not needed in MacOS iTerm and Terminal, (u)rxvt, termite, alacritty and
gnome-terminal.
Does it do any good in any situation?

Closes #337

The develop branch already has this out:
229cea08e5/src/templates/zimrc.zsh.erb (L83-L85)
2019-06-05 20:30:30 -05:00
Eric Nielsen
accabdb18b Scope local variable in anonymous function
so it does not leek into the shell.

Copied from zimfw/git@fea95a7655
2019-06-01 00:08:28 -05:00
Eric Nielsen
507f5d58e0 Update log formats
Use fuller format with committer info instead of medium format, as that
is more complete, and info for author and committer seems to fit in one
line each.

Fix one-line medium format so it truncates the subject at 50, instead of
at the fixed column 60, as that was not good to graph logs.

Remove `--all` from graph log aliases, to increase their flexibility.
We're then able to use it just for the current or for a branch passed
as parameter (as we already could with the other log aliases).

Copied from zimfw/git@63008c817e
2019-06-01 00:07:59 -05:00
Oskar Grunning
dc6ef566af [git] Add aliases for merge sign and verify
Adds the following aliases:
  - gmS: GPG-sign the resulting merge commit.
  - gmV: Verify that the tip commit of the side branch being merged is
  signed with a valid key, i.e. a key that has a valid uid: in the
  default trust model, this means the signing key has been signed by a
  trusted key. If the tip commit of the side branch is not signed with a
  valid key, the merge is aborted.

Closes #333
2019-03-22 08:35:42 -05:00
Eric Nielsen
d2c1e613ae [git] Allow aliases prefix to be something else than g
There were a couple of reports before about aliases shadowing commands
in #59 and #139. And I was impressed to check how many actually shadow existing commands using Ubuntu's command-not-found:

    'gb'  : apt install gb
    'gc'  : apt install graphviz
    'gcp' : apt install gcp
    'gcs' : apt install opengcs
    'gcv' : apt install scotch
    'gdc' : apt install gdc
    'gfm' : apt install gfm
    'gid' : apt install id-utils
    'gld' : apt install postfix-gld
    'gm'  : apt install graphicsmagick
    'gmt' : apt install gmt
    'gp'  : apt install pari-gp
    'gpa' : apt install gpa
    'gpp' : apt install gpp
    'gpt' : apt install gpt
    'grc' : apt install grc
    'gri' : apt install gri
    'gs'  : apt install ghostscript
    'gsl' : apt install generator-scripting-language
    'gss' : apt install libgss-dev
    'gt'  : apt install genometools
    'gtv' : apt install smpeg-gtv
    'gwc' : apt install geneweb
    'gwd' : apt install geneweb

The ability to customize the prefix fixes this issue. Picking `G` for
example is a good one (Vim's Fugitive uses upper case `G` in the
beginning of is commands, to mention another place where it's used).

Closes zimfw/git#1

Copied from zimfw/git@b2a2ffbd31
2019-03-22 08:15:11 -05:00
Eric Nielsen
38b3b9517e [git] Add glr alias for git reflog
and change the commit format to bold yellow, since that's the default
git log format for the commit when colored.

Closes #334

Copied from zimfw/git@013c9d9bf3
2019-03-22 08:12:53 -05:00
Oskar Grunning
45927aa8a2 [prompt] lean: Update submodule
Closes #332
2019-02-22 10:50:24 -05:00
Eric Nielsen
4f6ae96b12
Update LICENSE.md
Closes #322
2019-01-15 10:42:27 -05:00
Eric Nielsen
5371975f37 Update README.md instructions
> You should never have a pipeline both reading from and writing to a file.

My bad. See https://stackoverflow.com/a/25335116/2654518

Fixes #316
2019-01-05 18:18:42 -05:00
Eric Nielsen
1ab110c264 [git-info] Add complete example to README.md
so users don't need to look at our prompts code to figure out how having
all the pieces together looks like.
2018-12-26 20:56:57 -05:00
Eric Nielsen
882408b762 [prompt] eriner: Fix ${USER} not being evaluated
I broke this on the last commit. My bad.

Fixes #318
2018-12-23 18:21:18 -05:00
Eric Nielsen
21696a4f70 [git-info] Document that flag (e) is needed
so proper expansion of ref names occurs, due to changes done in 53a3cd7.
2018-12-21 22:48:54 -05:00
Eric Nielsen
5b90c96cd1 Update modules' README.md
Stick with the following style:

* Header 1 with the module name is in `lowercase`.
* Other headers are in `Sentence case`. Common header names that should
  be consistently used are `Aliases`, `Contributing`, `Functions`,
  `Settings`, and `Zsh options`.
* The names `Zim` and `Zsh` always appear capitalized, even in the
  middle of sentences.
* Prefer

      print 'code indented with 4 spaces'

  instead of
  ```zsh
  print 'code fenced by lines with three back-ticks'
  print 'unless you want syntax highlighting'
  ```
2018-12-17 14:11:16 -05:00