aboutsummaryrefslogtreecommitdiffhomepage
path: root/profile.sh
diff options
context:
space:
mode:
Diffstat (limited to 'profile.sh')
-rwxr-xr-xprofile.sh78
1 files changed, 78 insertions, 0 deletions
diff --git a/profile.sh b/profile.sh
new file mode 100755
index 0000000..9ebe755
--- /dev/null
+++ b/profile.sh
@@ -0,0 +1,78 @@
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 elif [[ $shell == bash ]]; then
65 shopt -s extglob
66 HISTTIMEFORMAT='%Y-%m-%d %T '
67
68 bind -m emacs-standard -x '"\ek": fzf_preview'
69 fi
70fi
71
72# Apply nvm
73[ -e $HOME/.config/nvm/nvm.sh ] && source "$HOME/.config/nvm/nvm.sh"
74
75# Working DIR
76[[ `pwd` == $HOME ]] && test -d ~/Downloads && cd ~/Downloads
77
78true