Browse Source

Added full zsh configs

master
Joshua Wolfe 5 years ago
parent
commit
a2567de8e0

+ 1
- 0
.vimrc View File

@@ -89,6 +89,7 @@ endif

" Custom Keybinds {{{

nnoremap <Space> <nop>
let g:mapleader = "\<Space>"

nnoremap <leader>vimrc :vs ~/.vimrc<cr><C-w>r

+ 7
- 0
.zsh/completion/_ag View File

@@ -0,0 +1,7 @@
#compdef ag

if (( CURRENT == 2 )); then
compadd $(cut -f 1 tmp/tags .git/tags 2>/dev/null)
else;
_files
fi

+ 72
- 0
.zsh/completion/_bundler View File

@@ -0,0 +1,72 @@
#compdef bundle

local curcontext="$curcontext" state line _gems _opts ret=1

_arguments -C -A "-v" -A "--version" \
'(- 1 *)'{-v,--version}'[display version information]' \
'1: :->cmds' \
'*:: :->args' && ret=0

case $state in
cmds)
_values "bundle command" \
"install[Install the gems specified by the Gemfile or Gemfile.lock]" \
"update[Update dependencies to their latest versions]" \
"package[Package the .gem files required by your application]" \
"exec[Execute a script in the context of the current bundle]" \
"config[Specify and read configuration options for bundler]" \
"check[Determine whether the requirements for your application are installed]" \
"list[Show all of the gems in the current bundle]" \
"show[Show the source location of a particular gem in the bundle]" \
"console[Start an IRB session in the context of the current bundle]" \
"open[Open an installed gem in the editor]" \
"lock[Generate a lockfile for your dependencies]" \
"viz[Generate a visual representation of your dependencies]" \
"init[Generate a simple Gemfile, placed in the current directory]" \
"gem[Create a simple gem, suitable for development with bundler]" \
"help[Describe available tasks or one specific task]" \
"platform[Displays platform compatibility information]" \
"outdated[Show all of the outdated gems in the current bundle]" \
"clean[Cleans up unused gems in your bundler directory]"
ret=0
;;
args)
case $line[1] in
help)
_values 'commands' 'install' 'update' 'package' 'exec' 'config' 'check' 'list' 'show' 'console' 'open' 'lock' 'viz' 'init' 'gem' 'help' 'platform' 'outdated' 'clean' && ret=0
;;
install)
_arguments \
'(--no-color)--no-color[disable colorization in output]' \
'(--local)--local[do not attempt to connect to rubygems.org]' \
'(--quiet)--quiet[only output warnings and errors]' \
'(--gemfile)--gemfile=-[use the specified gemfile instead of Gemfile]:gemfile' \
'(--system)--system[install to the system location]' \
'(--deployment)--deployment[install using defaults tuned for deployment environments]' \
'(--frozen)--frozen[do not allow the Gemfile.lock to be updated after this install]' \
'(--path)--path=-[specify a different path than the system default]:path:_files' \
'(--binstubs)--binstubs=-[generate bin stubs for bundled gems to ./bin]:directory:_files' \
'(--without)--without=-[exclude gems that are part of the specified named group]:groups'
ret=0
;;
exec)
_normal && ret=0
;;
(open|show)
_gems=( $(bundle show 2> /dev/null | sed -e '/^ \*/!d; s/^ \* \([^ ]*\) .*/\1/') )
if [[ $_gems != "" ]]; then
_values 'gems' $_gems && ret=0
fi
;;
*)
_opts=( $(bundle help $line[1] | sed -e '/^ \[-/!d; s/^ \[\(-[^=]*\)=.*/\1/') )
_opts+=( $(bundle help $line[1] | sed -e '/^ -/!d; s/^ \(-.\), \[\(-[^=]*\)=.*/\1 \2/') )
if [[ $_opts != "" ]]; then
_values 'options' $_opts && ret=0
fi
;;
esac
;;
esac

return ret

+ 2
- 0
.zsh/completion/_g View File

@@ -0,0 +1,2 @@
#compdef g
compdef g=git

+ 2
- 0
.zsh/completion/_production View File

@@ -0,0 +1,2 @@
#compdef production
compdef production=heroku

+ 3
- 0
.zsh/completion/_rspec View File

@@ -0,0 +1,3 @@
#compdef rspec

compadd -P spec/ $(ls spec/**/*_spec.rb | sed -E "s/spec\///g")

+ 2
- 0
.zsh/completion/_staging View File

@@ -0,0 +1,2 @@
#compdef staging
compdef staging=heroku

+ 6
- 0
.zsh/configs/color.zsh View File

@@ -0,0 +1,6 @@
# makes color constants available
autoload -U colors
colors

# enable colored output from ls, etc. on FreeBSD-based systems
export CLICOLOR=1

+ 2
- 0
.zsh/configs/editor.zsh View File

@@ -0,0 +1,2 @@
export VISUAL=vim
export EDITOR=$VISUAL

+ 4
- 0
.zsh/configs/history.zsh View File

@@ -0,0 +1,4 @@
setopt hist_ignore_all_dups inc_append_history
HISTFILE=~/.zhistory
HISTSIZE=4096
SAVEHIST=4096

+ 13
- 0
.zsh/configs/keybindings.zsh View File

@@ -0,0 +1,13 @@
# vi mode
bindkey -v
bindkey "^F" vi-cmd-mode

# handy keybindings
bindkey "^A" beginning-of-line
bindkey "^E" end-of-line
bindkey "^K" kill-line
bindkey "^R" history-incremental-search-backward
bindkey "^P" history-search-backward
bindkey "^Y" accept-and-hold
bindkey "^N" insert-last-word
bindkey -s "^T" "^[Isudo ^[A" # "t" for "toughguy"

+ 9
- 0
.zsh/configs/options.zsh View File

@@ -0,0 +1,9 @@
# awesome cd movements from zshkit
setopt autocd autopushd pushdminus pushdsilent pushdtohome cdablevars
DIRSTACKSIZE=5

# Enable extended globbing
setopt extendedglob

# Allow [ or ] whereever you want
unsetopt nomatch

+ 6
- 0
.zsh/configs/post/completion.zsh View File

@@ -0,0 +1,6 @@
# load our own completion functions
fpath=(~/.zsh/completion /usr/local/share/zsh/site-functions $fpath)

# completion
autoload -U compinit
compinit

+ 12
- 0
.zsh/configs/post/path.zsh View File

@@ -0,0 +1,12 @@
# ensure dotfiles bin directory is loaded first
PATH="$HOME/.bin:/usr/local/sbin:$PATH"

# load rbenv if available
if command -v rbenv >/dev/null; then
eval "$(rbenv init - --no-rehash)"
fi

# mkdir .git/safe in the root of repositories you trust
PATH=".git/safe/../../bin:$PATH"

export -U PATH

+ 9
- 0
.zsh/configs/prompt.zsh View File

@@ -0,0 +1,9 @@
# modify the prompt to contain git branch name if applicable
git_prompt_info() {
current_branch=$(git current-branch 2> /dev/null)
if [[ -n $current_branch ]]; then
echo " %{$fg_bold[green]%}$current_branch%{$reset_color%}"
fi
}
setopt promptsubst
PS1='${SSH_CONNECTION+"%{$fg_bold[green]%}%n@%m:"}%{$fg_bold[blue]%}%c%{$reset_color%}$(git_prompt_info) %# '

+ 4
- 0
.zsh/functions/_git_delete_branch View File

@@ -0,0 +1,4 @@
_git_delete_branch ()
{
__gitcomp "$(__git_heads)"
}

+ 9
- 0
.zsh/functions/change-extension View File

@@ -0,0 +1,9 @@
# Change file extensions recursively in current directory
#
# change-extension erb haml

function change-extension() {
foreach f (**/*.$1)
mv $f $f:r.$2
end
}

+ 10
- 0
.zsh/functions/envup View File

@@ -0,0 +1,10 @@
# Load .env file into shell session for environment variables

function envup() {
if [ -f .env ]; then
export $(cat .env)
else
echo 'No .env file found' 1>&2
return 1
fi
}

+ 9
- 0
.zsh/functions/g View File

@@ -0,0 +1,9 @@
# No arguments: `git status`
# With arguments: acts like `git`
g() {
if [[ $# -gt 0 ]]; then
git "$@"
else
git status
fi
}

+ 5
- 0
.zsh/functions/mcd View File

@@ -0,0 +1,5 @@
# Make directory and change into it.

function mcd() {
mkdir -p "$1" && cd "$1";
}

+ 29
- 0
.zshenv View File

@@ -0,0 +1,29 @@
local _old_path="$PATH"

# Local config
[[ -f ~/.zshenv.local ]] && source ~/.zshenv.local

if [[ $PATH != $_old_path ]]; then
# `colors` isn't initialized yet, so define a few manually
typeset -AHg fg fg_bold
if [ -t 2 ]; then
fg[red]=$'\e[31m'
fg_bold[white]=$'\e[1;37m'
reset_color=$'\e[m'
else
fg[red]=""
fg_bold[white]=""
reset_color=""
fi

cat <<MSG >&2
${fg[red]}Warning:${reset_color} your \`~/.zshenv.local' configuration seems to edit PATH entries.
Please move that configuration to \`.zshrc.local' like so:
${fg_bold[white]}cat ~/.zshenv.local >> ~/.zshrc.local && rm ~/.zshenv.local${reset_color}

(called from ${(%):-%N:%i})

MSG
fi

unset _old_path

+ 46
- 94
.zshrc View File

@@ -1,94 +1,46 @@
# Path to your oh-my-zsh installation.
export ZSH=/Users/wolfe/.oh-my-zsh

skip_global_compinit=1

# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="wolfe"

# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"

# 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 change how often to auto-update (in days).
# export UPDATE_ZSH_DAYS=13

# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"

# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"

# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"

# Uncomment the following line to display red dots whilst waiting for completion.
# COMPLETION_WAITING_DOTS="true"

# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"

# Uncomment the following line if you want to change the 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="mm/dd/yyyy"

# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder

# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(fancy-ctrl-z)

# User configuration

export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
# export MANPATH="/usr/local/man:$MANPATH"

source $ZSH/oh-my-zsh.sh

# You may need to manually set your language environment
# export LANG=en_US.UTF-8

# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
# export EDITOR='vim'
# else
# export EDITOR='mvim'
# fi

# Compilation flags
# export ARCHFLAGS="-arch x86_64"

# ssh
# export SSH_KEY_PATH="~/.ssh/dsa_id"

# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"

alias vim='nvim'
alias hideFiles='defaults write com.apple.finder AppleShowAllFiles NO; killall Finder /System/Library/CoreServices/Finder.app'
alias showFiles='defaults write com.apple.finder AppleShowAllFiles YES;killall Finder /System/Library/CoreServices/Finder.app'
alias vlc='/Applications/VLC.app/Contents/MacOS/VLC -I rc'
alias chrome='/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --app=https://www.google.com&;disown'

test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell_integration.zsh"
# load custom executable functions
for function in ~/.zsh/functions/*; do
source $function
done

# extra files in ~/.zsh/configs/pre , ~/.zsh/configs , and ~/.zsh/configs/post
# these are loaded first, second, and third, respectively.
_load_settings() {
_dir="$1"
if [ -d "$_dir" ]; then
if [ -d "$_dir/pre" ]; then
for config in "$_dir"/pre/**/*(N-.); do
. $config
done
fi

for config in "$_dir"/**/*(N-.); do
case "$config" in
"$_dir"/pre/*)
:
;;
"$_dir"/post/*)
:
;;
*)
if [ -f $config ]; then
. $config
fi
;;
esac
done

if [ -d "$_dir/post" ]; then
for config in "$_dir"/post/**/*(N-.); do
. $config
done
fi
fi
}
_load_settings "$HOME/.zsh/configs"

# aliases
[[ -f ~/.aliases ]] && source ~/.aliases

# Local config
[[ -f ~/.zshrc.local ]] && source ~/.zshrc.local

Loading…
Cancel
Save