/
zshrc.zsh
101 lines (85 loc) · 3.11 KB
/
zshrc.zsh
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
# Locale
export LC_ALL=en_US.UTF-8
export LANG="en_US"
# Do not overwrite files when redirecting using ">". Note that you can still override this with ">|"
set -o noclobber
# Prepend $PATH without duplicates
function _prepend_path() {
if ! $( echo "$PATH" | tr ":" "\n" | grep -qx "$1" ) ; then
PATH="$1:$PATH"
fi
}
# Construct $PATH
PATH='/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin'
[ -d /usr/local/bin ] && _prepend_path "/usr/local/bin"
[ -d /usr/local/opt/ruby/bin ] && _prepend_path "/usr/local/opt/ruby/bin"
[ -d /usr/local/share/npm/bin ] && _prepend_path "/usr/local/share/npm/bin"
[ -d /usr/local/opt/coreutils/libexec/gnubin ] && _prepend_path "/usr/local/opt/coreutils/libexec/gnubin"
[ -d ~/dotfiles/bin ] && _prepend_path "$HOME/dotfiles/bin"
[ -d ~/bin ] && _prepend_path "$HOME/bin"
export PATH
# Preferred editor for local and remote sessions
if [[ -n $SSH_CONNECTION ]]; then
export EDITOR='nano'
else
export EDITOR='subl'
fi
# Make less the default pager, add some options and enable syntax highlight using source-highlight
LESSPIPE=`which src-hilite-lesspipe.sh`
[ -n "$LESSPIPE" ] && export LESSOPEN="| ${LESSPIPE} %s"
local less_options=(
# If the entire text fits on one screen, just show it and quit. (Be more
# like "cat" and less like "more".)
--quit-if-one-screen
# Do not clear the screen first.
--no-init
# Like "smartcase" in Vim: ignore case unless the search pattern is mixed.
--ignore-case
# Do not automatically wrap long lines.
--chop-long-lines
# Allow ANSI colour escapes, but no other escapes.
--RAW-CONTROL-CHARS
# Do not ring the bell when trying to scroll past the end of the buffer.
--quiet
# Do not complain when we are on a dumb terminal.
--dumb
);
export LESS="${less_options[*]}"
export PAGER='less'
# Terminal title
DISABLE_AUTO_TITLE="true"
function _set_terminal_title() {
local title="$(basename "$PWD")"
if [[ -n $SSH_CONNECTION ]]; then
title="$title \xE2\x80\x94 $HOSTNAME"
fi
echo -ne "\033];$title\007"
}
precmd_functions+=(_set_terminal_title)
# Homebrew install badge: beer sucks, coffee rules
export HOMEBREW_INSTALL_BADGE='☕'
# Disable bundle for git-friendly
export GIT_FRIENDLY_NO_BUNDLE=true
# Oh My Zsh
# Path to your oh-my-zsh installation.
export ZSH="$HOME/.oh-my-zsh"
# Theme.
ZSH_THEME="squirrelbook"
# Uncomment the following line to use hyphen-insensitive completion. Case
# sensitive completion must be off. _ and - will be interchangeable.
# HYPHEN_INSENSITIVE="true"
# Uncomment the following line to disable bi-weekly auto-update checks.
# DISABLE_AUTO_UPDATE="true"
# Uncomment the following line to display red dots whilst waiting for completion.
# COMPLETION_WAITING_DOTS="true"
# Format of command execution time stamp shown in the history command output.
# The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
HIST_STAMPS="dd.mm.yyyy"
# Custom custom folder
ZSH_CUSTOM="$HOME/dotfiles/zsh"
# Plugins (see ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
plugins=(brew extract git-extras git-flow thefuck vagrant)
source $ZSH/oh-my-zsh.sh
# Load extra (private) settings
[ -f ~/.zshlocal ] && source ~/.zshlocal