aboutsummaryrefslogtreecommitdiffhomepage
path: root/profile
diff options
context:
space:
mode:
authorHsieh Chin Fan <pham@topo.tw>2024-11-06 08:25:12 +0800
committerHsieh Chin Fan <pham@topo.tw>2024-11-06 08:25:12 +0800
commita6061b61fa52b5c810c4214cc0682f4b21f1592c (patch)
tree1429ad3771a0387fc2fe073aa5ea19a68e6020dd /profile
parent69b2b3532b22898c7df8c5ee43a98d095bab67c2 (diff)
Update
Diffstat (limited to 'profile')
-rwxr-xr-xprofile81
1 files changed, 81 insertions, 0 deletions
diff --git a/profile b/profile
new file mode 100755
index 0000000..e689376
--- /dev/null
+++ b/profile
@@ -0,0 +1,81 @@
1# trap 'exit.sh' EXIT
2
3export SETTING_DIR=${SETTING_DIR:=$HOME/helper}
4export BIN_DIR=~/bin
5export PATH=$BIN_DIR:$PATH
6export TERM=xterm-256color
7export XDG_CONFIG_HOME=~/.config
8export XDG_STATE_HOME=~/.local/share/
9export MAIL=$HOME/Maildir
10if which nvim &>/dev/null; then
11 export EDITOR=nvim
12else
13 export EDITOR=vim
14fi
15export VISUAL=$EDITOR
16export TIG_EDITOR=$EDITOR
17export GIT_EDITOR=$EDITOR
18
19# Get current shell
20shell=$(</proc/$$/cmdline sed -E 's/(.)-.+$/\1/' | tr -d '[\0\-]')
21export shell=${shell##*/}
22
23# load custom aliases
24source $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
28find $SETTING_DIR/bin -not -executable -name '*rc' | while read rcfile; do source $rcfile; done
29
30# local
31PATH=$PATH:$HOME/.local/bin
32# go
33PATH=$PATH:$HOME/go/bin
34# android-studio
35PATH=$PATH:$HOME/android-studio/bin
36# cargo
37PATH=$PATH:$HOME/.cargo/bin
38# yarn
39PATH=$PATH:$HOME/.yarn/bin
40# gem
41PATH=$PATH:$HOME/.local/share/gem/ruby/3.0.0/bin
42
43# fzf
44if 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}
50fi
51
52# Set zsh or bash
53if [[ $- =~ 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
71fi
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
78cd ~/git/dumbymap 2>/dev/null || cd ~/Downloads
79source ~/.profile 2>/dev/null
80
81true