diff options
author | Hsieh Chin Fan <typebrook@gmail.com> | 2022-07-06 00:09:47 +0800 |
---|---|---|
committer | Hsieh Chin Fan <typebrook@gmail.com> | 2022-07-06 00:09:47 +0800 |
commit | f6a075b34f12d0e665234f0c5c5bc796d29b5b5d (patch) | |
tree | cfd473e420a5f7925351d9cf945db27555690e41 | |
parent | aa1e12d7a92b1491919319b57fdf9d1f1b8d1c33 (diff) |
Reformat script
-rwxr-xr-x | tools/init/load-settings.sh | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/tools/init/load-settings.sh b/tools/init/load-settings.sh index 9a01a74..cd5b6bb 100755 --- a/tools/init/load-settings.sh +++ b/tools/init/load-settings.sh | |||
@@ -2,23 +2,23 @@ export SETTING_DIR=${SETTING_DIR:=$HOME/helper} | |||
2 | export EDITOR=vim | 2 | export EDITOR=vim |
3 | export TERM=xterm-256color | 3 | export TERM=xterm-256color |
4 | 4 | ||
5 | trap 'exit.sh' EXIT | ||
6 | |||
5 | # load custom aliases | 7 | # load custom aliases |
6 | source $SETTING_DIR/alias | 8 | source $SETTING_DIR/alias |
7 | [[ -d $SETTING_DIR/private ]] && for f in $SETTING_DIR/private/*; do source $f; done | 9 | [[ -d $SETTING_DIR/private ]] && for f in $SETTING_DIR/private/*; do source $f; done |
8 | 10 | ||
9 | # Config shell | 11 | # Get current shell |
10 | 12 | shell=$(</proc/$$/cmdline tr -d '[\0\-]') | |
11 | shell=$(</proc/$$/cmdline tr -d '\0' | tr -d '-') | ||
12 | shell=${shell##*/} | 13 | shell=${shell##*/} |
13 | 14 | ||
14 | # Add custom scripts into PATH | 15 | # Add custom scripts into PATH |
15 | BIN_DIR=$HOME/bin | 16 | BIN_DIR=$HOME/bin |
16 | PATH=$BIN_DIR:$PATH | 17 | PATH=$BIN_DIR:$PATH |
17 | mkdir -p $BIN_DIR | 18 | mkdir -p $BIN_DIR |
18 | find $BIN_DIR -xtype l | xargs rm 2>/dev/null || true | 19 | find $BIN_DIR -xtype l -exec rm {} + 2>/dev/null |
19 | 20 | find $SETTING_DIR/tools -type f -executable -exec realpath {} + | \ | |
20 | find $SETTING_DIR/tools -type f -executable | \ | 21 | xargs -I{} ln -sf {} $BIN_DIR |
21 | xargs realpath | xargs -I{} ln -sf {} $BIN_DIR | ||
22 | 22 | ||
23 | 23 | ||
24 | MAIL=$HOME/Maildir | 24 | MAIL=$HOME/Maildir |
@@ -43,6 +43,7 @@ if which fzf &>/dev/null; then | |||
43 | source ~/.fzf.${shell} &>/dev/null | 43 | source ~/.fzf.${shell} &>/dev/null |
44 | fi | 44 | fi |
45 | 45 | ||
46 | # Set zsh or bash | ||
46 | if [[ $shell == zsh ]]; then | 47 | if [[ $shell == zsh ]]; then |
47 | setopt extended_glob | 48 | setopt extended_glob |
48 | fpath=($SETTING_DIR/zsh $fpath) | 49 | fpath=($SETTING_DIR/zsh $fpath) |
@@ -60,9 +61,7 @@ elif [[ $shell == bash ]]; then | |||
60 | bind -m emacs-standard -x '"\ek": fzf_preview' | 61 | bind -m emacs-standard -x '"\ek": fzf_preview' |
61 | fi | 62 | fi |
62 | 63 | ||
63 | # Run something after exit shell | 64 | # Working DIR |
64 | trap 'exit.sh' EXIT | ||
65 | |||
66 | [[ `pwd` == $HOME ]] && cd ~/Downloads | 65 | [[ `pwd` == $HOME ]] && cd ~/Downloads |
67 | 66 | ||
68 | true | 67 | true |