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