-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbashrc_zshrc
102 lines (87 loc) · 3.41 KB
/
bashrc_zshrc
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# vi: ft=sh
export PATH="$HOME/dotfiles/bin:$PATH"
export PATH="/opt/homebrew/opt/openjdk/bin:$PATH"
export EDITOR=vim
if [ -n "$ZSH_NAME" ]; then
# Set keybindings to EMACS style (e.g. CTRL-A goes to beginning of line)
bindkey -e
autoload -U colors && colors
typeset -Ag FX FG BG
for color in {000..255}; do
FG[$color]="%{[38;5;${color}m%}"
BG[$color]="%{[48;5;${color}m%}"
done
SEP=' '
NEWLINE=$'\n'
export PROMPT="%{$FG[135]%}%~%(40l.${NEWLINE}.${SEP})\$%{$reset_color%} "
#export PROMPT='%h %~> '
# Load SFDX autocompletion
SFDX_AC_ZSH_SETUP_PATH=/Users/meckert/Library/Caches/sfdx/autocomplete/zsh_setup && test -f $SFDX_AC_ZSH_SETUP_PATH && source $SFDX_AC_ZSH_SETUP_PATH;
# Setup autocompletion stuff
if type brew &>/dev/null
then
FPATH="$(brew --prefix)/share/zsh/site-functions:${FPATH}"
autoload -Uz compinit
compinit
else
autoload -U compinit
compinit
fi
zmodload zsh/complist
zstyle ':completion:*' menu yes select
bindkey -M menuselect '/' history-incremental-search-forward
bindkey -M menuselect '?' history-incremental-search-backward
# Edit current command line in editor (like in bash) via CTRL-X CTRL-E
autoload edit-command-line
zle -N edit-command-line
bindkey '^x^e' edit-command-line
# Insert "help" in current command line after the command (first space) via CTRL-X CTRL-H
add-or-remove-help() {
local CURRENT_LINE=$BUFFER
local CURRENT_POINT=$CURSOR
if [[ "$CURRENT_LINE" =~ ^[^[:space:]]+[[:space:]]help ]]; then
BUFFER=${CURRENT_LINE/ help/}
CURSOR=`expr $CURRENT_POINT '-' 5`
else
BUFFER=${CURRENT_LINE/ / help }
CURSOR=`expr $CURRENT_POINT '+' 5`
fi
}
zle -N add-or-remove-help
bindkey '^X^H' add-or-remove-help
else
export PS1="\[\e[0;36m\]\w \\$\[\e[0m\] "
add-or-remove-help() {
local CURRENT_LINE=$READLINE_LINE
local CURRENT_POINT=$READLINE_POINT
if [[ "$CURRENT_LINE" =~ ^[^[:space:]]+[[:space:]]help ]]; then
READLINE_LINE=${CURRENT_LINE/ help/}
READLINE_POINT=`expr $CURRENT_POINT - 5`
else
READLINE_LINE=${CURRENT_LINE/ / help }
READLINE_POINT=`expr $CURRENT_POINT + 5`
fi
}
bind -x '"\C-x\C-h":add-or-remove-help'
SFDX_AC_BASH_SETUP_PATH=/Users/meckert/Library/Caches/sfdx/autocomplete/bash_setup && test -f $SFDX_AC_BASH_SETUP_PATH && source $SFDX_AC_BASH_SETUP_PATH;
fi
if [[ "$OSTYPE" == darwin* ]]; then
export PATH="/usr/local/heroku/bin:$PATH"
export NODE_PATH=$NODE_PATH:/usr/local/lib/node_modules
export PATH="$PATH:/Applications/Postgres.app/Contents/Versions/latest/bin"
export DATABASE_URL=postgres:///$(whoami)
if [ -d "/Users/meckert/bin/gradle-2.13" ]; then
export GRADLE_HOME="/Users/meckert/bin/gradle-2.13/"
export PATH="$PATH:/Users/meckert/bin/gradle-2.13/bin"
export ANDROID_HOME=/Users/meckert/Library/Android/sdk
export PATH="$PATH:/Users/meckert/Library/Android/sdk/platform-tools"
fi
if [ -d /Applications/GIMP.app/ ]; then
GIMP_DIR=`echo /Applications/GIMP.app/`
alias gimp="open -a $GIMP_DIR"
fi
alias ibrew="arch -x86_64 /usr/local/bin/brew"
fi
# TODO: This won't work on windows if we're using c:/dotfiles
# together with MSYS or similar
source ~/dotfiles/shell/alias_func.sh