about summary refs log tree commit diff
path: root/configs/shared/.zsh_profile
blob: 2dde7e43a13034f6ee574f76304cc9eceec4573b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
export PATH=$HOME/bin:/opt/local/bin:/opt/local/sbin:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/opt/fzf/bin:$HOME/n/bin:$HOME/.cargo/bin


# use emacs bindings (default) for terminal input
set -o emacs


source $HOME/pc_settings/aliases.sh
source $HOME/pc_settings/functions/index.sh
source $HOME/pc_settings/scripts/setup_keybindings.sh
source $HOME/pc_settings/emacs/index.sh


bindkey "^R" history-incremental-search-backward


# export docker env variables
# re-enable this line when using docker otherwise you will receive
# a TLS error since docker-machine won't be running
# eval "$(docker-machine env default)"

# run cmatrix command for 3 seconds before exiting
#. $HOME/pc_settings/.matrix_intro.sh

# syntax highlighting for CLI; if not installed, run the following command
# brew install zsh-syntax-highlighting
source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh

# Regain control of CLI <C- mappings for vim keybindings
# RE: http://superuser.com/questions/588846/cannot-get-vim-to-remap-ctrls-to-w
stty -ixon


# Allows FZF to search hidden files (excluding .git repository)
export FZF_DEFAULT_COMMAND='ag --hidden --ignore .git -l -g ""'
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"


# CTRL-Y - Paste the selected branch(es) into the command line
__bsel() {
  local cmd="git branch -a | tr -d '* ' | sed 's/^remotes\/origin\///' | sort | uniq"
  setopt localoptions pipefail 2> /dev/null
  eval "$cmd" | FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} --reverse $FZF_DEFAULT_OPTS $FZF_CTRL_T_OPTS" $(__fzfcmd) -m "$@" | while read item; do
    echo -n "${(q)item} "
  done
  local ret=$?
  echo
  return $ret
}

fzf-branch-widget() {
  LBUFFER="${LBUFFER}$(__bsel)"
  local ret=$?
  zle redisplay
  typeset -f zle-line-init >/dev/null && zle zle-line-init
  return $ret
}
zle     -N   fzf-branch-widget
bindkey '^Y' fzf-branch-widget


# Run Autojump at shell startup
[[ $(brew --prefix)/etc/profile.d/autojump.sh ]] && \
. $(brew --prefix)/etc/profile.d/autojump.sh