From 07ab3a77b44944a1ac234fbd717391f36370416e Mon Sep 17 00:00:00 2001 From: Brian Picciano Date: Tue, 17 Oct 2017 18:12:57 -0600 Subject: initial public commit --- zsh/aliases | 38 ++++++++++++++++++++++++++++++ zsh/custom/themes/mediocregopher.zsh-theme | 23 ++++++++++++++++++ zsh/default.nix | 31 ++++++++++++++++++++++++ zsh/env | 18 ++++++++++++++ zsh/zshrc | 18 ++++++++++++++ 5 files changed, 128 insertions(+) create mode 100644 zsh/aliases create mode 100644 zsh/custom/themes/mediocregopher.zsh-theme create mode 100644 zsh/default.nix create mode 100644 zsh/env create mode 100644 zsh/zshrc (limited to 'zsh') diff --git a/zsh/aliases b/zsh/aliases new file mode 100644 index 0000000..1c71cea --- /dev/null +++ b/zsh/aliases @@ -0,0 +1,38 @@ +alias grep='grep --color=auto' +alias lal='ls -la' + +alias src='cd ~/src/' +alias s='src && ls' +alias gosrc='cd ~/src/go/src' +alias gs='gosrc && ls' + +alias t='tmuxn' +alias tmuxn='tmux new -s' +alias ta='tmuxa' +alias tmuxa='tmux attach -d -t' +alias tls='tmux ls' + +alias cb='xsel -bi; xsel -bo' + +alias rsyncv='rsync -av --progress' + +function psgrep { + ps aux | grep -P "[^]]$1" +} + +function pskill { + PROCS=$(psgrep "$1") + echo "$PROCS" + echo "$PROCS" | awk '{print $2}' | xargs kill +} + +# takes in a search regex and a replace string, and does a recursive +# find/replace inside the current directory. Safe to run on repos with .git +# folders and shit like that +function agsed { + search="$1" + replace="$2" + files=$(ag "$search" -l0) + echo -n "$files" | xargs -0 -n1 echo + echo -n "$files" | xargs -0 sed -i "s/$search/$replace/g" +} diff --git a/zsh/custom/themes/mediocregopher.zsh-theme b/zsh/custom/themes/mediocregopher.zsh-theme new file mode 100644 index 0000000..529f46b --- /dev/null +++ b/zsh/custom/themes/mediocregopher.zsh-theme @@ -0,0 +1,23 @@ +#!/usr/bin/env zsh + +# Unique string based on hostname +sha1=$(echo $(hostname) | sha1sum | awk '{print $1}' | grep -oP '[0-9a-f]{8}' | head -n1) +# Turn sha1 into int +asint=$(printf "%d" 0x$sha1) + +colorint=$(printf "%03d" $(expr $asint % 255)) +color=$FG[$colorint] + +PROMPT='%{$color%} %~%{$reset_color%}$(git_prompt_info)$(git_prompt_status)%{$reset_color%} :: ' + +ZSH_THEME_GIT_PROMPT_PREFIX=" ::%{$fg[green]%} " +ZSH_THEME_GIT_PROMPT_SUFFIX="" +ZSH_THEME_GIT_PROMPT_DIRTY="" +ZSH_THEME_GIT_PROMPT_CLEAN="" + +ZSH_THEME_GIT_PROMPT_ADDED=" +" +ZSH_THEME_GIT_PROMPT_MODIFIED=" ^" +ZSH_THEME_GIT_PROMPT_DELETED=" -" +ZSH_THEME_GIT_PROMPT_RENAMED=" >" +ZSH_THEME_GIT_PROMPT_UNMERGED=" @" +ZSH_THEME_GIT_PROMPT_UNTRACKED=" *" diff --git a/zsh/default.nix b/zsh/default.nix new file mode 100644 index 0000000..5071c9f --- /dev/null +++ b/zsh/default.nix @@ -0,0 +1,31 @@ +{ + + pkgs ? (import ../pkgs.nix) {}, + +}: rec { + + ohMyZsh = ./oh-my-zsh; + + zshrc = pkgs.writeTextDir ".zshrc" '' + + # oh-my-zsh + export ZSH=${pkgs.oh-my-zsh}/share/oh-my-zsh + ZSH_CUSTOM=${./custom} + ZSH_THEME=mediocregopher + DISABLE_AUTO_UPDATE=true + plugins=(git vi-mode) + source $ZSH/oh-my-zsh.sh + + PATH=${../bin}:$PATH + + . ${./zshrc} + . ${./env} + . ${./aliases} + . ${pkgs.nix}/etc/profile.d/nix.sh + ''; + + zsh = pkgs.writeScriptBin "zsh" '' + #!${pkgs.bash}/bin/bash + ZDOTDIR=${zshrc} exec ${pkgs.zsh}/bin/zsh "$@" + ''; +} diff --git a/zsh/env b/zsh/env new file mode 100644 index 0000000..0188d76 --- /dev/null +++ b/zsh/env @@ -0,0 +1,18 @@ +#Global stuff shitty programs use +export EDITOR=~/.nix-profile/bin/nvim + +#Basics +export PATH=$PATH:/bin +export PATH=$PATH:/usr/bin +export PATH=$PATH:/usr/local/bin + +#my shit +export PATH=~/bin:$PATH + +#Go has its own path system. Way to be difficult go +export GOPATH=~/.go +export GOBIN=$GOPATH/bin +export PATH=$GOPATH/bin:$PATH + +# GPG is needy +export GPG_TTY=$(tty) diff --git a/zsh/zshrc b/zsh/zshrc new file mode 100644 index 0000000..c939401 --- /dev/null +++ b/zsh/zshrc @@ -0,0 +1,18 @@ +#Correctly background processes +setopt nohup + +#Stop zsh from stupidly asking me to correct vim to .vim +unsetopt correctall + +#Bind my shit +bindkey -s "\eu" "cd ..\n" #cd up + +#Turn off share history +unsetopt share_history + +#zmv is the bee's-knees +autoload -U zmv + +# Save ssh password within a terminal +eval $(ssh-agent) 2>&1 >/dev/null +trap "kill $SSH_AGENT_PID" 0 -- cgit v1.2.3