From 59de29d5164d245dda1608f5e14cf4e1c981ad3e Mon Sep 17 00:00:00 2001 From: Hsieh Chin Fan Date: Tue, 25 Jun 2024 23:09:03 +0800 Subject: Update --- profile.sh | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100755 profile.sh (limited to 'profile.sh') diff --git a/profile.sh b/profile.sh new file mode 100755 index 0000000..9ebe755 --- /dev/null +++ b/profile.sh @@ -0,0 +1,78 @@ +# trap 'exit.sh' EXIT + +export SETTING_DIR=${SETTING_DIR:=$HOME/helper} +export BIN_DIR=~/bin +export PATH=$BIN_DIR:$PATH +export TERM=xterm-256color +export XDG_CONFIG_HOME=~/.config +export XDG_STATE_HOME=~/.local/share/ +export MAIL=$HOME/Maildir +if which nvim &>/dev/null; then + export EDITOR=nvim +else + export EDITOR=vim +fi +export VISUAL=$EDITOR +export TIG_EDITOR=$EDITOR +export GIT_EDITOR=$EDITOR + +# Get current shell +shell=$(/dev/null; then + export FZF_COMPLETION_OPTS='--bind=ctrl-c:print-query' + export FZF_CTRL_T_OPTS='--no-multi --bind=ctrl-c:print-query' + export FZF_CTRL_R_OPTS='--bind=ctrl-c:print-query' + fzf_preview() { fzf --preview 'cat {}'; } + source ~/.fzf.${shell} +fi + +# Set zsh or bash +if [[ $- =~ i ]]; then + if [[ $shell == zsh ]]; then + setopt extended_glob + fpath=($SETTING_DIR/zsh $fpath) + alias history='history -i' + autoload compinit; compinit + + #autoload -U deer + #zle -N deer + #bindkey '\ek' deer + bindkey -s '\ek' 'fzf_preview ' + elif [[ $shell == bash ]]; then + shopt -s extglob + HISTTIMEFORMAT='%Y-%m-%d %T ' + + bind -m emacs-standard -x '"\ek": fzf_preview' + fi +fi + +# Apply nvm +[ -e $HOME/.config/nvm/nvm.sh ] && source "$HOME/.config/nvm/nvm.sh" + +# Working DIR +[[ `pwd` == $HOME ]] && test -d ~/Downloads && cd ~/Downloads + +true -- cgit v1.2.3-70-g09d2