2016-05-14 17:28:15 -04:00
|
|
|
|
|
|
|
|
2015-12-15 00:12:17 -05:00
|
|
|
#
|
2015-12-31 11:05:09 -05:00
|
|
|
# startup file read in interactive login shells
|
2015-12-15 00:12:17 -05:00
|
|
|
#
|
|
|
|
# The following code helps us by optimizing the existing framework.
|
2015-12-28 02:09:44 -05:00
|
|
|
# This includes zcompile, zcompdump, etc.
|
2015-12-15 00:12:17 -05:00
|
|
|
#
|
|
|
|
|
2015-12-28 02:09:44 -05:00
|
|
|
(
|
Compile functions.zwc for each functions directory
instead of a big single `functions.zwc` file containing functions from
all the `functions` subdirectories.
Having a big single digest file did reduce the number of OS file
descriptors to 1, instead of:
* as many functions as are declared in enabled modules, what we had
before commit 55df5a4
* as many enabled modules, as we have implemented in this commit
but it also raised bigger and still unsolved issues as #231, #232, and
#234.
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`
A relevant change in this approach is also having individual entries
back in `fpath` for the `functions` subdirectory of each enabled module
(as was the case before commit 55df5a4). With this back, we don't need
to worry anymore about being absolutely sure that all functions are
zcompiled, thanks to the autoloading mechanism described above.
Fixes #231. Fixes #232. Closes #234.
2018-01-03 10:16:45 -05:00
|
|
|
local dir file
|
2017-09-26 13:28:08 -04:00
|
|
|
setopt LOCAL_OPTIONS EXTENDED_GLOB
|
|
|
|
autoload -U zrecompile
|
|
|
|
|
|
|
|
# zcompile the completion cache; siginificant speedup
|
|
|
|
zrecompile -pq ${ZDOTDIR:-${HOME}}/${zcompdump_file:-.zcompdump}
|
2015-12-15 00:12:17 -05:00
|
|
|
|
2016-01-04 18:11:30 -05:00
|
|
|
# zcompile .zshrc
|
2017-09-26 13:28:08 -04:00
|
|
|
zrecompile -pq ${ZDOTDIR:-${HOME}}/.zshrc
|
|
|
|
|
|
|
|
# zcompile enabled module autoloaded functions
|
Compile functions.zwc for each functions directory
instead of a big single `functions.zwc` file containing functions from
all the `functions` subdirectories.
Having a big single digest file did reduce the number of OS file
descriptors to 1, instead of:
* as many functions as are declared in enabled modules, what we had
before commit 55df5a4
* as many enabled modules, as we have implemented in this commit
but it also raised bigger and still unsolved issues as #231, #232, and
#234.
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`
A relevant change in this approach is also having individual entries
back in `fpath` for the `functions` subdirectory of each enabled module
(as was the case before commit 55df5a4). With this back, we don't need
to worry anymore about being absolutely sure that all functions are
zcompiled, thanks to the autoloading mechanism described above.
Fixes #231. Fixes #232. Closes #234.
2018-01-03 10:16:45 -05:00
|
|
|
for dir in ${ZIM_HOME}/modules/${^zmodules}/functions(/FN); do
|
|
|
|
zrecompile -pq ${dir}.zwc ${dir}/^([_.]*|prompt_*_setup|README*|*.zwc|*.zwc.old)(-.N)
|
|
|
|
done
|
2017-09-26 13:28:08 -04:00
|
|
|
|
|
|
|
# zcompile enabled module init scripts
|
Compile functions.zwc for each functions directory
instead of a big single `functions.zwc` file containing functions from
all the `functions` subdirectories.
Having a big single digest file did reduce the number of OS file
descriptors to 1, instead of:
* as many functions as are declared in enabled modules, what we had
before commit 55df5a4
* as many enabled modules, as we have implemented in this commit
but it also raised bigger and still unsolved issues as #231, #232, and
#234.
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`
A relevant change in this approach is also having individual entries
back in `fpath` for the `functions` subdirectory of each enabled module
(as was the case before commit 55df5a4). With this back, we don't need
to worry anymore about being absolutely sure that all functions are
zcompiled, thanks to the autoloading mechanism described above.
Fixes #231. Fixes #232. Closes #234.
2018-01-03 10:16:45 -05:00
|
|
|
for file in ${ZIM_HOME}/modules/${^zmodules}/init.zsh(-.N); do
|
|
|
|
zrecompile -pq ${file}
|
2016-01-04 18:11:30 -05:00
|
|
|
done
|
|
|
|
|
2017-09-26 13:28:08 -04:00
|
|
|
# zcompile all prompt setup scripts
|
|
|
|
for file in ${ZIM_HOME}/modules/prompt/functions/prompt_*_setup; do
|
|
|
|
zrecompile -pq ${file}
|
2016-02-27 19:43:19 -05:00
|
|
|
done
|
|
|
|
|
2016-01-04 18:11:30 -05:00
|
|
|
# syntax-highlighting
|
2017-09-26 13:28:08 -04:00
|
|
|
for file in ${ZIM_HOME}/modules/syntax-highlighting/external/highlighters/**^test-data/*.zsh; do
|
|
|
|
zrecompile -pq ${file}
|
2016-01-04 18:11:30 -05:00
|
|
|
done
|
2017-09-26 13:28:08 -04:00
|
|
|
zrecompile -pq ${ZIM_HOME}/modules/syntax-highlighting/external/zsh-syntax-highlighting.zsh
|
2016-01-04 18:11:30 -05:00
|
|
|
|
|
|
|
# zsh-histery-substring-search
|
2017-09-26 13:28:08 -04:00
|
|
|
zrecompile -pq ${ZIM_HOME}/modules/history-substring-search/external/zsh-history-substring-search.zsh
|
2015-12-15 00:12:17 -05:00
|
|
|
|
2015-12-28 02:09:44 -05:00
|
|
|
) &!
|