From f19ec5de5965f814db66aaff4131c7081e3ac72b Mon Sep 17 00:00:00 2001 From: Jonathan Hodgson Date: Mon, 10 Jul 2017 09:40:27 +0100 Subject: [PATCH] Update zsh config --- .gitmodules | 3 + custom-oh-my-zsh/aliases.zsh | 112 +++++++++++++++++++++++++++ custom-oh-my-zsh/functions.zsh | 68 ++++++++++++++++ custom-oh-my-zsh/themes/powerlevel9k | 1 + zshrc | 4 +- 5 files changed, 186 insertions(+), 2 deletions(-) create mode 100644 custom-oh-my-zsh/aliases.zsh create mode 100644 custom-oh-my-zsh/functions.zsh create mode 160000 custom-oh-my-zsh/themes/powerlevel9k diff --git a/.gitmodules b/.gitmodules index 2173c3c7..29ce5d1d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "config/vim"] path = config/vim url = git@github.com:Jab2870/vim.git +[submodule "custom-oh-my-zsh/themes/powerlevel9k"] + path = custom-oh-my-zsh/themes/powerlevel9k + url = https://github.com/bhilburn/powerlevel9k.git diff --git a/custom-oh-my-zsh/aliases.zsh b/custom-oh-my-zsh/aliases.zsh new file mode 100644 index 00000000..f1b0a4d5 --- /dev/null +++ b/custom-oh-my-zsh/aliases.zsh @@ -0,0 +1,112 @@ +# These alow me to easily set the file and folder permissions for a wordpress instilation. +alias folder-perms='find . -type d -not -path "./.git/*" -not -path "./.git" -exec chmod 775 {} \;' +alias file-perms='find . -type f -not -path "./.git/*" -not -path "./.git" -exec chmod 664 {} \;' +alias wp-perms='folder-perms; file-perms' +alias magentoPerms='cd ${PWD%/public_html*}/public_html;sudo chown -R jonathan:http .; folder-perms; file-perms; chmod +x bin/magento; cd -' + # +# Make ls add Indicator#s to file names and colour the output +alias ls='ls -F --color=auto' + +# Make tree add indicators and color +alias tree='tree -F -C' + +#Start cups +alias cups='sudo systemctl start org.cups.cupsd.service' + +#Start network manager +alias net='sudo systemctl start NetworkManager.service' + +# Alias lampp because I don't want to clog my PATH +alias lampp='/opt/lampp/lampp' +alias glampp='gksudo /opt/lampp/manager-linux-x64.run' +alias php='/opt/lampp/bin/php' +alias php-cgi='/opt/lampp/bin/php-cgi' +alias php-config='/opt/lampp/bin/php-config' + +#Always make all directories necesary +alias mkdir='mkdir -p' + +# Shortcut for rewriting wp permalinks +alias perms='wp rewrite flush' + +#Clear terminal and screenfetch +alias cls='clear; screenfetch' + +#An alias for my standard less configuration +#I don't set it to lessc because sometimes I don't use this config and I always forget how to ignore an alias +#alias myless='lessc --clean-css --source-map-basepath=/home/jonathan/Sites/charts/public_html --source-map --autoprefix="last 3 versions, ie >= 9" styles.less styles.min.css' +alias myless='lessc --clean-css --source-map --autoprefix="last 3 versions, ie >= 9" styles.less styles.min.css' + +# Git shortcuts +alias status='git status ' +alias st='git status' +alias checkout='git checkout' +alias ch='git checkout' +alias push='git push ' +alias pull='git pull ' +alias bb='git open' + +# Always make grep ouput color +alias grep="grep --color=auto" + +# Shortcuts to sites folder +alias sites="cd ~/Sites" +alias s="cd ~/Sites" + +# Shortcuts to documents folder +alias documents="cd ~/Documents/" +alias d="cd ~/Documents/" + +# Shortcuts to home folder +alias home="cd ~/" +alias ~="cd ~/" + +#Goes up to the public_html folder +alias ph='cd ${PWD%/public_html*}/public_html' + +# Quit the terminal using :q (The same as Vi/Vim) +alias :q='exit;' + +# Not sure why and how but this makes sudo work with my aliases +alias sudo='sudo ' + +#Make the cal command default to start on Sunday +alias cal='cal -s' + +# update the third party wordpress plugins we are mirroring +alias u3p='update3rdPartyPlugins' + +# Edit my bashrc +alias brc='$EDITOR ~/.bashrc' + +# Edit my vimrc +alias vrc='$EDITOR ~/.vimrc' + +# Go to my .vim folder +alias .v='cd ~/.vim/' +# Go to my dotfiles folder +#if [[ $(hostname) == "jonathansnuc" ]]; then +# #Please don't judge - This is a reminant from first days of version controlling dotfiles +# alias df='cd ~/Downloads/laptopConfig/' +#else + alias df='cd ~/.dotfiles' +#fi + +#Make vim start in server mode +alias vim='vim --servername jab2870' + +# moon phase +alias moonphase='weather moon' + +#Radio Stations +AUDIO=mpv +alias radio2="$AUDIO http://a.files.bbci.co.uk/media/live/manifesto/audio/simulcast/hls/uk/sbr_med/llnw/bbc_radio_two.m3u8" +alias radio4="$AUDIO http://a.files.bbci.co.uk/media/live/manifesto/audio/simulcast/hls/uk/sbr_med/llnw/bbc_radio_fourfm.m3u8" +alias classic="$AUDIO http://icy-e-bab-04-cr.sharp-stream.com/absoluteradio.mp3" +alias absolute="$AUDIO http://network.absoluteradio.co.uk/core/audio/mp3/live.pls?service=vrbb" + +alias bs="curl -s http://cbsg.sourceforge.net/cgi-bin/live | grep -Eo '^
  • .*
  • ' | sed s,\\,,g | shuf -n 1 | cowsay" + +alias jq="jq -C" + +alias debugBuild='node --inspect-brk /usr/bin/grunt build' diff --git a/custom-oh-my-zsh/functions.zsh b/custom-oh-my-zsh/functions.zsh new file mode 100644 index 00000000..0a0804cd --- /dev/null +++ b/custom-oh-my-zsh/functions.zsh @@ -0,0 +1,68 @@ +function big-chromium () { + chromium --force-device-scale-factor=$1 +} + +function big-new-chromium () { + chromium-snapshot-bin --force-device-scale-factor=$1 +} + +#Swap two files +function swap() { + mv $1 $1._tmp; + mv $2 $1; + mv $1._tmp $2; +} + +function old() { + mv "$1" "$1.old" +} + +#Takes you to the aquarius theme +function aquarius() { + public_html=${PWD%/public_html*}/public_html + if [ -d $public_html ]; then + theme=$public_html/wp-content/themes + if [ -d $theme ]; then + cdls $theme/aquarius + else + echo " Can't find theme folder " + fi + else + echo " Can't find public_html folder." + fi +} + +#Takes you to the child theme +function theme() { + public_html=${PWD%/public_html*}/public_html + if [ -d $public_html ]; then + theme=$public_html/wp-content/themes + if [ -d $theme ]; then + child=$(ls -d $theme/*/ | grep -v "$theme\/aquarius" | grep -v "$theme\/twenty*" | grep -v "$theme\/barelycorporate" -m 1) + cdls $child + else + echo " Can't find theme folder " + fi + else + echo " Can't find public_html folder." + fi +} + +######################################## +## ## +## Search Functions ## +## ## +######################################## + +#These search functions use grep to search all sub-folders of the current working directory +searchjs() { + # This will search through .js and .es6 files but won't search minified files + grep -r -i -n --color="always" --include=\*.{js,es6} --exclude=\*.min.js "$1" . +} +searchcss() { + # This will search through .css and .less files but won't search minified files + grep -r -i -n --color="always" --include=\*.{css,less,scss,sass} --exclude=\*.min.css "$1" . +} +searchphp() { + grep -r -i -n --color="always" --include="*.php" "$1" . +} diff --git a/custom-oh-my-zsh/themes/powerlevel9k b/custom-oh-my-zsh/themes/powerlevel9k new file mode 160000 index 00000000..4be16020 --- /dev/null +++ b/custom-oh-my-zsh/themes/powerlevel9k @@ -0,0 +1 @@ +Subproject commit 4be16020b7cd7241b75c23db9f5bd3d4fce84686 diff --git a/zshrc b/zshrc index 5765fd01..b0fe25c3 100644 --- a/zshrc +++ b/zshrc @@ -7,7 +7,7 @@ # Set name of the theme to load. Optionally, if you set this to "random" # it'll load a random theme each time that oh-my-zsh is loaded. # See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes -ZSH_THEME="robbyrussell" +ZSH_THEME="powerlevel9k/powerlevel9k" # Uncomment the following line to use case-sensitive completion. # CASE_SENSITIVE="true" @@ -45,7 +45,7 @@ ZSH_THEME="robbyrussell" # HIST_STAMPS="dd.mm.yyyy" # Would you like to use another custom folder than $ZSH/custom? -# ZSH_CUSTOM=/path/to/new-custom-folder +ZSH_CUSTOM=$HOME/.dotfiles/custom-oh-my-zsh # 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/