aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorHsieh Chin Fan <typebrook@gmail.com>2022-07-06 00:09:47 +0800
committerHsieh Chin Fan <typebrook@gmail.com>2022-07-06 00:09:47 +0800
commitf6a075b34f12d0e665234f0c5c5bc796d29b5b5d (patch)
treecfd473e420a5f7925351d9cf945db27555690e41
parentaa1e12d7a92b1491919319b57fdf9d1f1b8d1c33 (diff)
Reformat script
-rwxr-xr-xtools/init/load-settings.sh19
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}
2export EDITOR=vim 2export EDITOR=vim
3export TERM=xterm-256color 3export TERM=xterm-256color
4 4
5trap 'exit.sh' EXIT
6
5# load custom aliases 7# load custom aliases
6source $SETTING_DIR/alias 8source $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 12shell=$(</proc/$$/cmdline tr -d '[\0\-]')
11shell=$(</proc/$$/cmdline tr -d '\0' | tr -d '-')
12shell=${shell##*/} 13shell=${shell##*/}
13 14
14# Add custom scripts into PATH 15# Add custom scripts into PATH
15BIN_DIR=$HOME/bin 16BIN_DIR=$HOME/bin
16PATH=$BIN_DIR:$PATH 17PATH=$BIN_DIR:$PATH
17mkdir -p $BIN_DIR 18mkdir -p $BIN_DIR
18find $BIN_DIR -xtype l | xargs rm 2>/dev/null || true 19find $BIN_DIR -xtype l -exec rm {} + 2>/dev/null
19 20find $SETTING_DIR/tools -type f -executable -exec realpath {} + | \
20find $SETTING_DIR/tools -type f -executable | \ 21xargs -I{} ln -sf {} $BIN_DIR
21xargs realpath | xargs -I{} ln -sf {} $BIN_DIR
22 22
23# Mail 23# Mail
24MAIL=$HOME/Maildir 24MAIL=$HOME/Maildir
@@ -43,6 +43,7 @@ if which fzf &>/dev/null; then
43 source ~/.fzf.${shell} &>/dev/null 43 source ~/.fzf.${shell} &>/dev/null
44fi 44fi
45 45
46# Set zsh or bash
46if [[ $shell == zsh ]]; then 47if [[ $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'
61fi 62fi
62 63
63# Run something after exit shell 64# Working DIR
64trap 'exit.sh' EXIT
65
66[[ `pwd` == $HOME ]] && cd ~/Downloads 65[[ `pwd` == $HOME ]] && cd ~/Downloads
67 66
68true 67true