Skip to content

Commit 6a2ca19

Browse files
committed
Fix use LC_ALL=C for tr and sort
Previously, `LC_ALL=C` was exported, which affected the user's shell. Now `LC_ALL=C` is set only for `tr` and `sort`, limiting the C local to those commands. Fixes: #33
1 parent ae7888d commit 6a2ca19

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

history-sync.plugin.zsh

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
# ----------------------------------------------------------------
88
# James Fraser <[email protected]> - https://www.wulfgar.pro
99
# ----------------------------------------------------------------
10-
export LC_ALL=C
1110

1211
autoload -U colors && colors
1312

@@ -18,7 +17,7 @@ alias zhsync="history_sync_pull && history_sync_push"
1817
CP() { command cp "$@"; }
1918
MV() { command mv "$@"; }
2019
RM() { command rm "$@"; }
21-
TR() { command tr "$@"; }
20+
TR() { LC_ALL=C command tr "$@"; }
2221
AWK() { command awk "$@"; }
2322
CAT() { command cat "$@"; }
2423
GIT() { command git "$@"; }
@@ -29,7 +28,7 @@ FOLD() { command fold "$@"; }
2928
GREP() { command grep "$@"; }
3029
HEAD() { command head "$@"; }
3130
PERL() { command perl "$@"; }
32-
SORT() { command sort "$@"; }
31+
SORT() { LC_ALL=C command sort "$@"; }
3332
MKTEMP() { command mktemp "$@"; }
3433

3534
ZSH_HISTORY_PROJ="${ZSH_HISTORY_PROJ:-${HOME}/.zsh_history_proj}"
@@ -180,8 +179,8 @@ history_sync_pull() {
180179

181180
# Merge
182181
CAT "$ZSH_HISTORY_FILE" "$ZSH_HISTORY_FILE_DECRYPT_NAME" | \
183-
AWK '/:[0-9]/ { if(s) { print s } s=$0 } !/:[0-9]/ { s=s"\n"$0 } END { print s }' \
184-
| SORT -u > "$ZSH_HISTORY_FILE_MERGED_NAME"
182+
AWK '/:[0-9]/ { if(s) { print s } s=$0 } !/:[0-9]/ { s=s"\n"$0 } END { print s }' | \
183+
SORT -u > "$ZSH_HISTORY_FILE_MERGED_NAME"
185184
MV "$ZSH_HISTORY_FILE_MERGED_NAME" "$ZSH_HISTORY_FILE"
186185
RM "$ZSH_HISTORY_FILE_DECRYPT_NAME"
187186
cd "$DIR"

0 commit comments

Comments
 (0)