aboutsummaryrefslogtreecommitdiff
path: root/zsh
diff options
context:
space:
mode:
authorCamil Staps2016-02-09 13:33:49 +0100
committerCamil Staps2016-11-30 19:11:06 +0100
commitae4fdb755a6e07e9f86ae34551987a446092f0db (patch)
tree2b754ae5b224c3d9fe7d073228d220555fcebac1 /zsh
parenttype pass (diff)
zsh
Diffstat (limited to 'zsh')
-rw-r--r--zsh/aliases.zsh1
-rw-r--r--zsh/completion.zsh5
-rw-r--r--zsh/config.zsh48
-rw-r--r--zsh/fpath.zsh2
m---------zsh/oh-my-zsh0
-rw-r--r--zsh/prompt.zsh82
-rw-r--r--zsh/window.zsh19
-rw-r--r--zsh/zshrc.symlink44
8 files changed, 201 insertions, 0 deletions
diff --git a/zsh/aliases.zsh b/zsh/aliases.zsh
new file mode 100644
index 0000000..d8fb4b3
--- /dev/null
+++ b/zsh/aliases.zsh
@@ -0,0 +1 @@
+alias reload!='. ~/.zshrc'
diff --git a/zsh/completion.zsh b/zsh/completion.zsh
new file mode 100644
index 0000000..1862eec
--- /dev/null
+++ b/zsh/completion.zsh
@@ -0,0 +1,5 @@
+# matches case insensitive for lowercase
+zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
+
+# pasting with tabs doesn't perform completion
+zstyle ':completion:*' insert-tab pending
diff --git a/zsh/config.zsh b/zsh/config.zsh
new file mode 100644
index 0000000..bdf8f98
--- /dev/null
+++ b/zsh/config.zsh
@@ -0,0 +1,48 @@
+if [[ -n $SSH_CONNECTION ]]; then
+ export PS1='%m:%3~$(git_info_for_prompt)%# '
+else
+ export PS1='%3~$(git_info_for_prompt)%# '
+fi
+
+export LSCOLORS="exfxcxdxbxegedabagacad"
+export CLICOLOR=true
+
+fpath=($ZSH/functions $fpath)
+
+autoload -U $ZSH/functions/*(:t)
+
+HISTFILE=~/.zsh_history
+HISTSIZE=10000
+SAVEHIST=10000
+
+setopt NO_BG_NICE # don't nice background tasks
+setopt NO_HUP
+setopt NO_LIST_BEEP
+setopt LOCAL_OPTIONS # allow functions to have local options
+setopt LOCAL_TRAPS # allow functions to have local traps
+setopt HIST_VERIFY
+setopt SHARE_HISTORY # share history between sessions ???
+setopt EXTENDED_HISTORY # add timestamps to history
+setopt PROMPT_SUBST
+setopt CORRECT
+setopt COMPLETE_IN_WORD
+setopt IGNORE_EOF
+
+setopt APPEND_HISTORY # adds history
+setopt INC_APPEND_HISTORY SHARE_HISTORY # adds history incrementally and share it across sessions
+setopt HIST_IGNORE_ALL_DUPS # don't record dupes in history
+setopt HIST_REDUCE_BLANKS
+
+# don't expand aliases _before_ completion has finished
+# like: git comm-[tab]
+setopt complete_aliases
+
+zle -N newtab
+
+bindkey '^[^[[D' backward-word
+bindkey '^[^[[C' forward-word
+bindkey '^[[5D' beginning-of-line
+bindkey '^[[5C' end-of-line
+bindkey '^[[3~' delete-char
+bindkey '^[^N' newtab
+bindkey '^?' backward-delete-char
diff --git a/zsh/fpath.zsh b/zsh/fpath.zsh
new file mode 100644
index 0000000..eaff4f4
--- /dev/null
+++ b/zsh/fpath.zsh
@@ -0,0 +1,2 @@
+#add each topic folder to fpath so that they can add functions and completion scripts
+for topic_folder ($ZSH/*) if [ -d $topic_folder ]; then fpath=($topic_folder $fpath); fi;
diff --git a/zsh/oh-my-zsh b/zsh/oh-my-zsh
new file mode 160000
+Subproject 15d52fd4fbabda6c3c9fad80cb4378478d86a40
diff --git a/zsh/prompt.zsh b/zsh/prompt.zsh
new file mode 100644
index 0000000..2e96295
--- /dev/null
+++ b/zsh/prompt.zsh
@@ -0,0 +1,82 @@
+autoload colors && colors
+# cheers, @ehrenmurdick
+# http://github.com/ehrenmurdick/config/blob/master/zsh/prompt.zsh
+
+if (( $+commands[git] ))
+then
+ git="$commands[git]"
+else
+ git="/usr/bin/git"
+fi
+
+git_branch() {
+ echo $($git symbolic-ref HEAD 2>/dev/null | awk -F/ {'print $NF'})
+}
+
+git_dirty() {
+ if $(! $git status -s &> /dev/null)
+ then
+ echo ""
+ else
+ if [[ $($git status --porcelain) == "" ]]
+ then
+ echo "on %{$fg_bold[green]%}$(git_prompt_info)%{$reset_color%}"
+ else
+ echo "on %{$fg_bold[red]%}$(git_prompt_info)%{$reset_color%}"
+ fi
+ fi
+}
+
+git_prompt_info () {
+ ref=$($git symbolic-ref HEAD 2>/dev/null) || return
+# echo "(%{\e[0;33m%}${ref#refs/heads/}%{\e[0m%})"
+ echo "${ref#refs/heads/}"
+}
+
+unpushed () {
+ $git cherry -v @{upstream} 2>/dev/null
+}
+
+need_push () {
+ if [[ $(unpushed) == "" ]]
+ then
+ echo " "
+ else
+ echo " with %{$fg_bold[magenta]%}unpushed%{$reset_color%} "
+ fi
+}
+
+ruby_version() {
+ if (( $+commands[rbenv] ))
+ then
+ echo "$(rbenv version | awk '{print $1}')"
+ fi
+
+ if (( $+commands[rvm-prompt] ))
+ then
+ echo "$(rvm-prompt | awk '{print $1}')"
+ fi
+}
+
+rb_prompt() {
+ if ! [[ -z "$(ruby_version)" ]]
+ then
+ echo "%{$fg_bold[yellow]%}$(ruby_version)%{$reset_color%} "
+ else
+ echo ""
+ fi
+}
+
+directory_name() {
+ echo "%{$fg_bold[cyan]%}%1/%\/%{$reset_color%}"
+}
+
+export PROMPT=$'\n$(rb_prompt)in $(directory_name) $(git_dirty)$(need_push)\n› '
+set_prompt () {
+ export RPROMPT="%{$fg_bold[cyan]%}%{$reset_color%}"
+}
+
+precmd() {
+ title "zsh" "%m" "%55<...<%~"
+ set_prompt
+}
diff --git a/zsh/window.zsh b/zsh/window.zsh
new file mode 100644
index 0000000..805cb92
--- /dev/null
+++ b/zsh/window.zsh
@@ -0,0 +1,19 @@
+# From http://dotfiles.org/~_why/.zshrc
+# Sets the window title nicely no matter where you are
+function title() {
+ # escape '%' chars in $1, make nonprintables visible
+ a=${(V)1//\%/\%\%}
+
+ # Truncate command, and join lines.
+ a=$(print -Pn "%40>...>$a" | tr -d "\n")
+
+ case $TERM in
+ screen)
+ print -Pn "\ek$a:$3\e\\" # screen title (in ^A")
+ ;;
+ xterm*|rxvt)
+ print -Pn "\e]2;$2\a" # plain xterm title ($3 for pwd)
+ ;;
+ esac
+}
+
diff --git a/zsh/zshrc.symlink b/zsh/zshrc.symlink
new file mode 100644
index 0000000..87c5ace
--- /dev/null
+++ b/zsh/zshrc.symlink
@@ -0,0 +1,44 @@
+# shortcut to this dotfiles path is $ZSH
+export ZSH=$HOME/dotfiles
+
+# your project folder that we can `c [tab]` to
+export PROJECTS=~/VersionControl
+
+# Stash your environment variables in ~/.localrc. This means they'll stay out
+# of your main dotfiles repository (which may be public, like this one), but
+# you'll have access to them in your scripts.
+if [[ -a ~/.localrc ]]
+then
+ source ~/.localrc
+fi
+
+# all of our zsh files
+typeset -U config_files
+config_files=($ZSH/**/*.zsh)
+
+# load the path files
+for file in ${(M)config_files:#*/path.zsh}
+do
+ source $file
+done
+
+# load everything but the path and completion files
+for file in ${${config_files:#*/path.zsh}:#*/completion.zsh}
+do
+ source $file
+done
+
+# initialize autocomplete here, otherwise functions won't be loaded
+autoload -U compinit
+compinit
+
+# load every completion after autocomplete loads
+for file in ${(M)config_files:#*/completion.zsh}
+do
+ source $file
+done
+
+unset config_files
+
+### Oh-my-zsh
+ZSH_THEME="agnoster"