Commit Graph

20 Commits

Author SHA1 Message Date
Eric Nielsen d371d80af2
Unify the `for` syntax
For short single commands, prefer a one-liner `for` with the zsh syntax:
```
for x (foo bar) print ${x}
```
Otherwise just place `; do` on the same line as the POSIX `for ... in`:
```
for x in foo bar; do
  print ${x}
done
```

Closes #268
2018-04-25 08:59:19 -05:00
Eric Nielsen e29c4e9cde Use bindkey instead of set -o
Using `bindkey` is the preferred zsh way to do it.

As far as I checked, also `set -o emacs` defines a less complete set of
key bindings compared to `bindkey -e`.
2018-04-19 12:32:56 -05:00
Anton Shiryaev acdb1d4bc7 Add .zimrc option 'zinput_mode'
Closes #261
2018-04-19 12:32:56 -05:00
Eric Nielsen 13eb86d4c8 And also simplify functions glob in init.zsh
to match the change done in `login_init.zsh`.

Also call autoloaded function only when autoload succeeded.
2018-04-09 18:20:54 -05:00
Eric Nielsen fd822d28bb Change order or module loading system
First choice is `init.zsh`, the script we use, introduced by Prezto.

Next choices are based on which are the most common init scripts in the
zsh-users repositories:

* `zsh-autosuggestions`, `zsh-history-substring-search` and
  `zsh-syntax-highlighting` have `${zmodule}.zsh`
* `zsh-completions` has `${zmodule}.plugin.zsh`

Latter format apparently was introduced by Oh-My-Zsh.

Leaving `${zmodule}.zsh-theme` and `${zmodule}.sh` as the last options.
2018-04-05 08:24:17 -05:00
Atomic Coding 2ea2ba2fc8 Update the module loading system
to load modules with `{module_name}.plugin.zsh` and `{module_name}.zsh`
in order to improve compatibility.

Closes ##257
2018-04-05 08:24:17 -05:00
Eric Nielsen ae133abca9 Compile functions.zwc for each functions directory
instead of a big single `functions.zwc` file containing functions from
all the `functions` subdirectories.

This solution here better suits the functions autoloading mechanism in
zsh, as documented in
http://zsh.sourceforge.net/Doc/Release/Functions.html#index-autoloading-functions

Given `~/.zim/modules/foo/functions` is in the `fpath`, autoload looks
for functions in the following files, picking the **newest one** in this
order:
* `~/.zim/modules/foo/functions.zwc`, which should contain all
  functions in the directory named `functions`
* `~/.zim/modules/foo/functions/function.zwc`
* `~/.zim/modules/foo/functions/function`

With this approach, we're also having individual entries back in `fpath`
for the `functions` subdirectory of each enabled module (as was the case
before commit 55df5a4).

This is also probably closest to the original plan at #86. The current
code was not compiling "*all* files in a folder into a single digest",
but instead compiling *all* files in *all* the functions folders into a
single digest, which was a bad idea. This commit fixes this.

Fixes #231. Fixes #232. Closes #234.

Closes #239
2018-01-08 11:56:18 -05:00
Eric Nielsen 3c96d0b8e1 Revert "Also zrecompile functions starting with _"
This reverts commit 07d32caaae.

Now I get the intention of not zcompiling or autoloading functions whose
names start with `_` or `.`: these are indented to be used by the com-
pletion system and dumped into the `.zcompdump ` file.

See
http://zsh.sourceforge.net/Doc/Release/Completion-System.html#index-compinit
2018-01-03 11:48:52 -05:00
Eric Nielsen 07d32caaae Also zrecompile functions starting with _
This was causing issues with https://github.com/jocelynmallon/zshmarks,
that has a `functions/_jump_showmarks_deletemarks` file.

Fixes #231
2018-01-02 12:27:05 -05:00
Eric Nielsen e0a7c679e0 [meta] Move zmanage to function in init.zsh
and delete the meta module altogether.

Also refactor `tools/zim_issue` to use `tools/zim_info`, use local
variables, and print the output directly without the need of the
intermediate `issue_md` array.

Closes #218
2017-11-24 19:08:39 -05:00
Eric Nielsen 55df5a4755 [template] Use zrecompile and create digest file
for the autoloaded functions. According to the `zshbuiltins`
documentation:

    Files containing multiple compiled functions are called `digest'
    files,  and are intended to be used as elements of the FPATH/fpath
    special array.

Compile all module init files, instead of some selected ones.
This didn't impact performance much (time to run async block in zlogin
when from 0.22s to 0.25s on my machine).

Also refactor the zim `init.zsh` script, and do not unset `zmodules`
anymore because we need it in zlogin.

Didn't manage to make adding the prompt `prompt_*_setup` functions to
the digest file work, so kept these separate.

Fixes #86. Closes #218.
2017-11-24 19:08:11 -05:00
Chet Gurevitch 9eaba9a3a3 [meta] Use ZIM_HOME in zmanage
And fix init.zhs to export ZIM_HOME. The zmanage script invokes a new
shell for the sub commands, and those would fail as there would be no
value for ZIM_HOME.

Closes #203
2017-09-04 17:29:34 -05:00
Thiago Kenji Okada f6bb75579f Allow arbitrary ZIM location with ZIM_HOME
This change allow arbitrary Zim location path by setting a new
environment variable, ZIM_HOME. If the user does not set it, Zim falls
back to the old "${ZDOTDIR:-${HOME}}/.zim" location.

Closes #203
2017-09-04 17:25:01 -05:00
Eric Nielsen 537f076603 Don't load zim if zsh < 5.2
and show an error message, as discussed in #184.

Code in modules/environment/init.zsh is also simplified to only support
zsh >= 5.2

Closes #200
2017-08-03 09:18:39 -05:00
Eric Nielsen ff32968ba9 Warning message for zsh < 5.2
as discussed in #184. We'll first give users this warning message. A
future update will replace this by an error.

Also, starting at that update, a new branch will be created for users
that still want to stick with zsh < 5.2.

Closes #194
2017-06-28 21:52:20 -05:00
Matt Hamilton a0706e0f46 slight init refactor
Removing argv removes the need to pass the arrays arround. Better to
just reference them directly.
2015-12-30 10:14:10 -05:00
Matt Hamilton e9a1018c25 unfunction loaders after use 2015-12-29 01:28:24 -05:00
Matt Hamilton a1a56ac63f use consistent variable style 2015-12-19 09:48:29 -05:00
Matt Hamilton 2f9b8437e2 It is probably better to prepend ranther than append 2015-12-16 14:56:54 -05:00
Matt Hamilton 3a62391e0e initial commit 2015-12-15 00:12:17 -05:00