summaryrefslogtreecommitdiff
path: root/zsh
diff options
context:
space:
mode:
authorBrian Picciano <mediocregopher@gmail.com>2017-10-17 18:12:57 -0600
committermediocregopher <mediocregopher@gmail.com>2021-10-03 17:22:56 -0600
commit07ab3a77b44944a1ac234fbd717391f36370416e (patch)
treeedd959740bf9256bf38e9c2e3cacda8c555f8c56 /zsh
initial public commit
Diffstat (limited to 'zsh')
-rw-r--r--zsh/aliases38
-rw-r--r--zsh/custom/themes/mediocregopher.zsh-theme23
-rw-r--r--zsh/default.nix31
-rw-r--r--zsh/env18
-rw-r--r--zsh/zshrc18
5 files changed, 128 insertions, 0 deletions
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