Commit Graph

10 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 78e6d1fc91 Also still not zrecompile prompt_*_setup files
missed that on the last commit.
2018-04-09 18:12:34 -05:00
Eric Nielsen d74ceedef7 Generic approach for zrecompiling scripts
* create digest of scripts in a `functions` directory that don't start
  with `_` (completion functions) and that don't have a `.` (function
  names cannot have that character)
* zrecompile any `.zsh` or `.zsh-theme` file that is not in a `*test*`
  directory (see 2a9a003), and that is a plain file with more than 1K of
  size.

instead of the fixed logic that was zrecompiling syntax-highlighting and
history-substring-search modules' scripts.

Closes #260
2018-04-09 18:09:07 -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 e4e0c55ef3 Ignore *.zwc.old files when compiling functions
These files are generated by `zrecompile`.

Also update the .gitignore file.

Closes #218
2017-11-24 19:08:39 -05:00
Eric Nielsen fc84b645e9 [template] Move templates/zlogin to login_init.zsh
so it's not a template anymore and can be under version control, instead
of being manually updated by the user, as currently is the case with
`~/.zlogin` and `${ZIM_HOME}/templates/zlogin`.

Closes #218
2017-11-24 19:08:25 -05:00
Renamed from templates/zlogin (Browse further)