diff options
author | Hsieh Chin Fan <pham@topo.tw> | 2024-06-25 23:09:03 +0800 |
---|---|---|
committer | Hsieh Chin Fan <pham@topo.tw> | 2024-06-25 23:09:03 +0800 |
commit | 59de29d5164d245dda1608f5e14cf4e1c981ad3e (patch) | |
tree | 6ac4d17b0db9b59fbc70e74efe5a06f458973904 /bin/init/load-settings.sh | |
parent | ba90f7398b34736f1ace01b0af90dff795fca8fb (diff) |
Update
Diffstat (limited to 'bin/init/load-settings.sh')
-rwxr-xr-x | bin/init/load-settings.sh | 81 |
1 files changed, 0 insertions, 81 deletions
diff --git a/bin/init/load-settings.sh b/bin/init/load-settings.sh deleted file mode 100755 index cf1273a..0000000 --- a/bin/init/load-settings.sh +++ /dev/null | |||
@@ -1,81 +0,0 @@ | |||
1 | # trap 'exit.sh' EXIT | ||
2 | |||
3 | export SETTING_DIR=${SETTING_DIR:=$HOME/helper} | ||
4 | export BIN_DIR=~/bin | ||
5 | export PATH=$BIN_DIR:$PATH | ||
6 | export TERM=xterm-256color | ||
7 | export XDG_CONFIG_HOME=~/.config | ||
8 | export XDG_STATE_HOME=~/.local/share/ | ||
9 | export MAIL=$HOME/Maildir | ||
10 | if which nvim &>/dev/null; then | ||
11 | export EDITOR=nvim | ||
12 | export VISUAL=nvim | ||
13 | export TIG_EDITOR=nvim | ||
14 | export GIT_EDITOR=nvim | ||
15 | else | ||
16 | export EDITOR=vim | ||
17 | export VISUAL=vim | ||
18 | export TIG_EDITOR=vim | ||
19 | export GIT_EDITOR=vim | ||
20 | fi | ||
21 | |||
22 | # Get current shell | ||
23 | shell=$(</proc/$$/cmdline sed -E 's/(.)-.+$/\1/' | tr -d '[\0\-]') | ||
24 | export shell=${shell##*/} | ||
25 | |||
26 | # load custom aliases | ||
27 | source $SETTING_DIR/alias | ||
28 | |||
29 | # sourcr rc files in private/ and bin/ | ||
30 | [[ -d $SETTING_DIR/private ]] && for f in $SETTING_DIR/private/*; do source $f; done | ||
31 | find $SETTING_DIR/bin -not -executable -name '*rc' | while read rcfile; do source $rcfile; done | ||
32 | |||
33 | # local | ||
34 | PATH=$PATH:$HOME/.local/bin | ||
35 | # go | ||
36 | PATH=$PATH:$HOME/go/bin | ||
37 | # android-studio | ||
38 | PATH=$PATH:$HOME/android-studio/bin | ||
39 | # cargo | ||
40 | PATH=$PATH:$HOME/.cargo/bin | ||
41 | # yarn | ||
42 | PATH=$PATH:$HOME/.yarn/bin | ||
43 | # gem | ||
44 | PATH=$PATH:$HOME/.local/share/gem/ruby/3.0.0/bin | ||
45 | |||
46 | # fzf | ||
47 | if which fzf &>/dev/null; then | ||
48 | export FZF_COMPLETION_OPTS='--bind=ctrl-c:print-query' | ||
49 | export FZF_CTRL_T_OPTS='--no-multi --bind=ctrl-c:print-query' | ||
50 | export FZF_CTRL_R_OPTS='--bind=ctrl-c:print-query' | ||
51 | fzf_preview() { fzf --preview 'cat {}'; } | ||
52 | source ~/.fzf.${shell} | ||
53 | fi | ||
54 | |||
55 | # Set zsh or bash | ||
56 | if [[ $- =~ i ]]; then | ||
57 | if [[ $shell == zsh ]]; then | ||
58 | setopt extended_glob | ||
59 | fpath=($SETTING_DIR/zsh $fpath) | ||
60 | alias history='history -i' | ||
61 | autoload compinit; compinit | ||
62 | |||
63 | #autoload -U deer | ||
64 | #zle -N deer | ||
65 | #bindkey '\ek' deer | ||
66 | bindkey -s '\ek' 'fzf_preview ' | ||
67 | elif [[ $shell == bash ]]; then | ||
68 | shopt -s extglob | ||
69 | HISTTIMEFORMAT='%Y-%m-%d %T ' | ||
70 | |||
71 | bind -m emacs-standard -x '"\ek": fzf_preview' | ||
72 | fi | ||
73 | fi | ||
74 | |||
75 | # Apply nvm | ||
76 | [ -e $HOME/.config/nvm/nvm.sh ] && source "$HOME/.config/nvm/nvm.sh" | ||
77 | |||
78 | # Working DIR | ||
79 | [[ `pwd` == $HOME ]] && test -d ~/Downloads && cd ~/Downloads | ||
80 | |||
81 | true | ||