Skip to content

Commit 46af611

Browse files
benjamineskolageoffharcourt
authored andcommitted
Make _load_settings() more concise
- Use the `~` glob operator to exclude *.zwc insead of a separate test (requires `setopt extendedglob`). - Exclude both `pre` and `post` in one case alternative.
1 parent 42c8204 commit 46af611

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

Diff for: zshrc

+4-11
Original file line numberDiff line numberDiff line change
@@ -9,31 +9,24 @@ _load_settings() {
99
_dir="$1"
1010
if [ -d "$_dir" ]; then
1111
if [ -d "$_dir/pre" ]; then
12-
for config in "$_dir"/pre/**/*(N-.); do
13-
if [ ${config:e} = "zwc" ] ; then continue ; fi
12+
for config in "$_dir"/pre/**/*~*.zwc(N-.); do
1413
. $config
1514
done
1615
fi
1716

1817
for config in "$_dir"/**/*(N-.); do
1918
case "$config" in
20-
"$_dir"/pre/*)
21-
:
22-
;;
23-
"$_dir"/post/*)
19+
"$_dir"/(pre|post)/*|*.zwc)
2420
:
2521
;;
2622
*)
27-
if [[ -f $config && ${config:e} != "zwc" ]]; then
28-
. $config
29-
fi
23+
. $config
3024
;;
3125
esac
3226
done
3327

3428
if [ -d "$_dir/post" ]; then
35-
for config in "$_dir"/post/**/*(N-.); do
36-
if [ ${config:e} = "zwc" ] ; then continue ; fi
29+
for config in "$_dir"/post/**/*~*.zwc(N-.); do
3730
. $config
3831
done
3932
fi

0 commit comments

Comments
 (0)