Browse Source

Add initial zsh configuration

master
Noah Petherbridge 4 years ago
parent
commit
7a19f4cebd
3 changed files with 117 additions and 0 deletions
  1. 3
    0
      .gitmodules
  2. 113
    0
      home/.zshrc
  3. 1
    0
      zsh/zgen

+ 3
- 0
.gitmodules View File

@@ -28,3 +28,6 @@
28 28
 [submodule "home/.vim/bundle/editorconfig-vim"]
29 29
 	path = home/.vim/bundle/editorconfig-vim
30 30
 	url = https://github.com/editorconfig/editorconfig-vim
31
+[submodule "zsh/zgen"]
32
+	path = zsh/zgen
33
+	url = https://github.com/tarjoilija/zgen

+ 113
- 0
home/.zshrc View File

@@ -0,0 +1,113 @@
1
+###
2
+# .zshrc
3
+#
4
+# Kirsle's Global ZSH Configuration
5
+# Updated: 2015-07-07
6
+###
7
+
8
+export LANG=en_US.UTF-8       # Unicode
9
+setopt prompt_subst           # Allow for dynamic prompts
10
+autoload -U colors && colors  # Get color aliases
11
+
12
+# 256 colors
13
+[[ "$TERM" == "xterm" ]] && export TERM=xterm-256color
14
+
15
+# Load color aliases
16
+setopt prompt_subst
17
+autoload -U colors && colors
18
+
19
+# Normalize the PATH
20
+export PATH="/usr/sbin:/sbin:/usr/bin:/bin:/usr/local/sbin:/usr/local/bin:${HOME}/bin:${HOME}/go/bin:${HOME}/android/sdk/platform-tools"
21
+export EDITOR="/usr/bin/vim"
22
+
23
+# Virtualenv
24
+export WORKON_HOME=~/.virtualenv
25
+
26
+# Reload zshrc
27
+alias rezsh="source ${HOME}/.zshrc"
28
+
29
+# Allow overriding hostname in the prompt from a local config
30
+export PROMPT_HOSTNAME="%m"
31
+
32
+# Source local (system specific) configurations
33
+if [[ -f "${HOME}/.zshrc-local" ]]; then
34
+	source "${HOME}/.zshrc-local"
35
+fi
36
+
37
+###
38
+# Base shell prompt.
39
+###
40
+
41
+# I slowly build the prompt up over multiple places and store it in
42
+# in $base_prompt, so I can modify it before exporting it (for example,
43
+# so the git branch appears before the % at the end of the prompt).
44
+
45
+# For the color palette, see: http://www.pixelbeat.org/docs/terminal_colours/
46
+# Use light shades of blue and pink.
47
+local blue="%F{39}"
48
+local pink="%F{213}"
49
+local orange="%F{208}"
50
+local lime="%F{46}"
51
+local cyan="%F{51}"
52
+local base_prompt="%{$blue%}[%{$pink%}%n%{$blue%}@%{$pink%}${PROMPT_HOSTNAME} %{$lime%}%1~"
53
+
54
+###
55
+# Include git branch in the prompt
56
+###
57
+
58
+git_branch() {
59
+	local res=`git branch 2>/dev/null | grep -v '^[^*]' | perl -pe 's/^\*\s+//g'`
60
+	if [[ "$res" != "" ]]; then
61
+		local res=" ($res)"
62
+	fi
63
+	echo $res
64
+	return $res
65
+}
66
+
67
+local git_prompt='%{$cyan%}$(git_branch)%{$reset_color%}'
68
+local base_prompt="${base_prompt}${git_prompt}"
69
+
70
+# End the base prompt
71
+local base_prompt="${base_prompt}%{$blue%}]%# %{%f%}"
72
+
73
+###############################################################################
74
+# zsh plugins                                                                 #
75
+###############################################################################
76
+
77
+# Load zgen (plugin manager)
78
+source "${HOME}/.dotfiles/zsh/zgen/zgen.zsh"
79
+
80
+# Initialize zgen plugins
81
+if ! zgen saved; then
82
+	echo "Creating a zgen save"
83
+
84
+	# Load plugins
85
+	zgen oh-my-zsh plugins/virtualenv
86
+	zgen oh-my-zsh plugins/virtualenvwrapper
87
+	zgen load jimmijj/zsh-syntax-highlighting
88
+	zgen load tarruda/zsh-autosuggestions # depends on syntax-highlighting
89
+
90
+	# Save all to the init script
91
+	zgen save
92
+fi
93
+
94
+###
95
+# Configure plugin: virtualenvwrapper
96
+###
97
+
98
+# Virtualenv prompt. The dynamic part (name of the virtualenv) needs to
99
+# recompute each time so we separate it out into a single-quoted variable.
100
+# See: http://stackoverflow.com/questions/11877551/zsh-not-re-computing-my-shell-prompt
101
+export ZSH_THEME_VIRTUALENV_PREFIX="("
102
+export ZSH_THEME_VIRTUALENV_SUFFIX=")"
103
+local virtualenv_prompt='%{$orange%}$(virtualenv_prompt_info)%{$reset_color%}'
104
+local base_prompt="${virtualenv_prompt}${base_prompt}"
105
+
106
+###
107
+# Configure plugin: zsh-autosuggestions
108
+###
109
+export AUTOSUGGESTION_HIGHLIGHT_COLOR="fg=2"
110
+export AUTOSUGGESTION_ACCEPT_RIGHT_ARROW=1
111
+
112
+# Finalize and export the prompt
113
+export PROMPT=$base_prompt

+ 1
- 0
zsh/zgen

@@ -0,0 +1 @@
1
+Subproject commit 111f9e3fcc1c3d4e261d458cb6d65c5a95ec2f1c

Loading…
Cancel
Save