Created
July 12, 2020 04:44
-
-
Save HunterKohler/85a45e7152b09a5ddec529a59face73b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export EDITOR=nano | |
export ZSH=~/.oh-my-zsh | |
export RC=~/.zshrc | |
export LIBRARY="/mnt/c/Users/Hunter Kohler" | |
export PATH="/home/jkohler/.local/bin:/home/jkohler/mongodb/bin:$PATH" | |
source $ZSH/oh-my-zsh.sh | |
source ~/powerlevel10k/powerlevel10k.zsh-theme | |
ZSH_THEME="powerlevel10k/powerlevel10k" | |
export LS_COLORS="$LS_COLORS:ow=1;34:tw=1;34:" | |
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh. | |
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh | |
plugins=( | |
git | |
git-prompt | |
python | |
ubuntu | |
# colored-man-pages | |
# zsh-autosuggestions | |
jsontools | |
# zsh-syntax-highlighting | |
) | |
source ~/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh | |
# colored-man-pages alternative, if plugin colored-man-pages doesn't work | |
export LESS_TERMCAP_mb=$'\e[1;32m' | |
export LESS_TERMCAP_md=$'\e[1;32m' | |
export LESS_TERMCAP_me=$'\e[0m' | |
export LESS_TERMCAP_se=$'\e[0m' | |
export LESS_TERMCAP_so=$'\e[01;33m' | |
export LESS_TERMCAP_ue=$'\e[0m' | |
export LESS_TERMCAP_us=$'\e[1;4;31m' | |
# OPENING WINDOWS PROGRAMS FROM WSL | |
alias notepad="'/mnt/c/Windows/System32/notepad.exe'" | |
alias {sublimetext,st}="'/mnt/c/Program Files/Sublime Text 3/sublime_text.exe'" | |
alias 'notepad++'="'/mnt/c/Program Files (x86)/Notepad++/notepad++.exe'" | |
alias chrome="'/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe'" | |
alias {openpdf,sumatra,sumatrapdf}="'/mnt/c/Users/Hunter Kohler/AppData/Local/SumatraPDF/SumatraPDF.exe'" | |
##### Aliases/Functions ##### | |
alias p10kconfig="nano ~/.p10k.zsh" | |
alias config="nano $RC" | |
alias copyconfig="cat '/mnt/c/Users/Hunter Kohler/documents/Config Files/.zshrc' > $RC" | |
alias src="copyconfig ; source $RC" | |
alias l="ls" | |
alias ll="ls -l" | |
alias la="ls -la" | |
alias c="clear" | |
alias rmdir="rm -r" | |
alias cdrive="cd /mnt/c" | |
alias hdrive="cd /mnt/h" | |
alias drives="cd /mnt" | |
alias {D,d}ocuments="cd '$LIBRARY/Documents'" | |
alias {D,d}ownloads="cd '$LIBRARY/Downloads'" | |
alias {D,d}esktop="cd '$LIBRARY/Desktop'" | |
alias curdir="echo $PWD" | |
alias {G,g}ists="cd '/mnt/c/Users/Hunter Kohler/Documents/Gists'" | |
alias {G,g}its="cd '/mnt/c/Users/Hunter Kohler/Documents/Git Projects'" | |
alias {G,g}it{s,S}ite="cd '/mnt/c/Users/Hunter Kohler/Documents/Git Projects/hunterkohler.github.io'" | |
alias {devcourse,nodecourse}="gits; cd 'Node.js Developers Course'" | |
function findrepos { | |
for i in $@ | |
do | |
cd $i | |
find / -name ".git" | |
done | |
} | |
function confirm { # Usage: "confirm [prompt]" for [Y/N] response and boolean. | |
state=-1 | |
while (( $state == -1 )) ; do | |
read yn\?"$1[yn]: " | |
case $yn in | |
[Yy] | [Yy][Ee][Ss] ) state=0 ;; # true == 0 by bash convention | |
[Nn] | [Nn][Oo] ) state=1 ;; | |
* ) echo "Invalid input, '$yn', please confirm or deny:" ;; | |
esac | |
done | |
return $state | |
} | |
function fname { | |
local base=$(basename -- "$1") | |
local filename="${base%.*}" | |
echo "$filename" | |
} | |
function fextension { | |
local base=$(basename -- "$1") | |
local extension="${base##*.}" | |
echo "$extension" | |
} | |
function exists { | |
if [ -f "$1" ] || [ -d "$1" ] ; then | |
echo true | |
else | |
echo false | |
fi | |
} | |
#string functions | |
function strlen { | |
echo "${#1}" | |
} | |
function substring { | |
str=$1 | |
index=$2 | |
length=$3 | |
echo "${str:${index}:${length}}" | |
} | |
function replacefirst { | |
str=$1 | |
pattern=$2 | |
newstr=$3 | |
echo "${str/${pattern}/${newstr}}" | |
} | |
function replaceall { | |
str=$1 | |
pattern=$2 | |
newstr=$3 | |
echo "${str//${pattern}/${newstr}}" | |
} | |
#array functions | |
function arrfill { | |
arr=$1 | |
val=$2 | |
for i in "${!arr[@]}" ; do | |
arr[$i]="$val" | |
done | |
} | |
alias python="python3.8" | |
alias python3="python3.8" | |
alias npm="/usr/bin/npm" | |
alias apt-repos="sudo nano /etc/apt/sources.list" | |
function groupfiles { | |
for file in * | |
do | |
dir=$(fname $file) | |
echo $dir | |
if ! [ -d "$dir" ] | |
then | |
mkdir $dir | |
fi | |
mv $file $dir | |
done | |
} | |
# function colors { | |
# for i in {0..255} ; do print -Pn "%K{$i} %k%F{$i}${(l:3::0:)i}%f " ${${(M)$((i%6)):#3}:+$'\n'} ; done | |
# } | |
alias nodedoc="chrome 'https://nodejs.org/dist/latest-v14.x/docs/api/'" | |
function npmman { | |
chrome https://npmjs.com/package/$1 | |
} | |
function mdn { | |
chrome https://developer.mozilla.org/en-US/docs/Web/$1 | |
} | |
# function app { | |
# main=$(jq .main package.json) | |
# node $(substring $main 1 $(($(strlen $main) - 2))) $@ | |
# } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment