Skip to content

Commit 1365891

Browse files
committed
Migration to Zsh & Oh my Zsh, updated VS Code extensions
1 parent 8d6d537 commit 1365891

File tree

6 files changed

+389
-3
lines changed

6 files changed

+389
-3
lines changed

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,30 @@ sudo git config --global color.ui true
5252

5353

5454

55+
### ZSH Shell
56+
57+
Make ZSH the default shell:
58+
```
59+
chsh -s /bin/zsh
60+
```
61+
62+
Install [Oh My Zsh](https://ohmyz.sh):
63+
```
64+
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
65+
```
66+
67+
68+
Create Symlinks to ZSH config:
69+
```
70+
ln -sf ~/Projects/dotfiles/config/shell/zshrc ~/.zshrc
71+
ln -sf ~/Projects/dotfiles/config/shell/zshenv ~/.zshenv
72+
ln -sf ~/Projects/dotfiles/config/shell/oh-my-zsh-aliases ~/.oh-my-zsh/custom/aliases.zsh
73+
ln -sf ~/Projects/dotfiles/config/shell/editorconfig ~/.editorconfig
74+
ln -sf ~/Projects/dotfiles/config/shell/inputrc ~/.inputrc
75+
```
76+
77+
78+
5579
### Bash Shell
5680

5781
Make Bash the default shell:

apps/visual-studio-code/User/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,5 +169,6 @@
169169
"editor.renderLineHighlight": "all",
170170
"projectManager.git.baseFolders": [
171171
"/Users/raphaelgerber/Projects"
172-
]
172+
],
173+
"liveServer.settings.CustomBrowser": "firefox"
173174
}

config/shell/oh-my-zsh-aliases

Lines changed: 237 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,237 @@
1+
# Reload Shell
2+
alias reload=". ~/.zshrc"
3+
4+
5+
# ---------------------------------------------------------------------
6+
# Path Shortcuts
7+
# ---------------------------------------------------------------------
8+
alias appsupport='cd ~/Library/Application\ Support'
9+
alias apps='cd ~/Applications'
10+
alias desktop='cd ~/Desktop'
11+
alias documents='cd ~/Documents'
12+
alias dotfiles='cd ~/Projects/dotfiles'
13+
alias downloads='cd ~/Downloads'
14+
alias home='cd ~'
15+
alias library='cd ~/Library'
16+
alias onedrive='cd ~/OneDrive'
17+
alias projects='cd ~/Projects'
18+
alias sites='cd ~/Sites'
19+
alias transfer='cd ~/OneDrive/Transfer'
20+
21+
# Projects
22+
alias codeyard='cd ~/Projects/codeyard'
23+
alias cashtml='cd ~/Projects/cas-html5'
24+
alias cassd='cd ~/Projects/cas-sd'
25+
alias wogv3='cd ~/Projects/WoG/wog-v3'
26+
27+
# Download
28+
alias bandcamp-dl='youtube-dl --output "~/Downloads/Mp3/%(title)s.%(ext)s"'
29+
alias youtube-mp3='youtube-dl --output "~/Downloads/Mp3/%(title)s.%(ext)s" --extract-audio --audio-format mp3'
30+
alias youtube-mp4='youtube-dl --output "~/Downloads/%(title)s.%(ext)s" --format mp4'
31+
32+
33+
34+
35+
# ---------------------------------------------------------------------
36+
# Apache
37+
# ---------------------------------------------------------------------
38+
39+
# Open Apache Folder
40+
alias apaopen='open /etc/apache2'
41+
42+
# Edit Apache Configuration
43+
alias apaconf='code /private/etc/apache2/httpd.conf'
44+
45+
# Edit Apache Virtual Hosts
46+
alias apahosts='code /private/etc/apache2/extra/httpd-vhosts.conf'
47+
48+
# Open Apache Error Log
49+
alias apalog='code /private/var/log/apache2/error_log'
50+
51+
# Start, Stop, Restart Apache
52+
alias aparestart='sudo apachectl restart'
53+
alias apastop='sudo apachectl stop'
54+
alias apastart='sudo apachectl start'
55+
56+
# Test Apache Syntax
57+
alias apatest='sudo apachectl -t'
58+
59+
60+
61+
62+
# ---------------------------------------------------------------------
63+
# Docker
64+
# ---------------------------------------------------------------------
65+
alias dockstart='docker start cfelastic mssql'
66+
alias dockstop='docker stop cfelastic mssql'
67+
alias dcfrestart='docker restart cfelastic'
68+
alias dockcf='docker exec -it cfelastic bash'
69+
alias docksql='docker exec -it mssql bash'
70+
71+
72+
73+
74+
# ---------------------------------------------------------------------
75+
# Hosts
76+
# ---------------------------------------------------------------------
77+
78+
# Edit Hosts File
79+
alias hhosts='code /etc/hosts'
80+
81+
# Flush Hosts File Cache
82+
alias flushhosts='dscacheutil -flushcache'
83+
84+
85+
86+
87+
# ---------------------------------------------------------------------
88+
# Abbreviations
89+
# ---------------------------------------------------------------------
90+
91+
# Directory Browsing
92+
alias ..='cd ..'
93+
alias ...='cd ../..'
94+
alias ....='cd ../../..'
95+
alias .3='cd ../../..'
96+
alias .4='cd ../../../..'
97+
alias .5='cd ../../../../..'
98+
alias .6='cd ../../../../../..'
99+
100+
alias _='sudo'
101+
alias c='clear'
102+
alias g='git'
103+
104+
# Get week number
105+
alias week='date +%V'
106+
107+
108+
109+
110+
# ---------------------------------------------------------------------
111+
# List & Tree
112+
# ---------------------------------------------------------------------
113+
114+
# List all in long, ungrouped, human-readable format
115+
alias la='ls -lhaoG'
116+
117+
# List in long, ungrouped, human-readable format
118+
alias ll='ls -lhoG'
119+
120+
# List directories instead of contents, and do not dereference symbolic links
121+
alias ld='ls -ldo */'
122+
123+
# List only directories & files
124+
alias l1='ls -1'
125+
126+
# Tree: include hidden files
127+
alias treea='tree -aC --dirsfirst'
128+
129+
# Tree: list directories only
130+
alias treed='tree -dC'
131+
132+
# File size
133+
alias fsize="stat -f \"%z bytes\""
134+
135+
136+
137+
138+
# ---------------------------------------------------------------------
139+
# Network Utils
140+
# ---------------------------------------------------------------------
141+
142+
# Get IP Addresses
143+
alias localip='ipconfig getifaddr en1'
144+
alias ips="ifconfig -a | perl -nle'/(\d+\.\d+\.\d+\.\d+)/ and print $1'"
145+
146+
alias myip='curl ipecho.net/plain; echo'
147+
#alias myip='dig +short myip.opendns.com @resolver1.opendns.com'
148+
149+
150+
151+
152+
# ---------------------------------------------------------------------
153+
# Mac OS X Utils
154+
# ---------------------------------------------------------------------
155+
156+
# Activity Monitor
157+
alias monitor='top -o cpu'
158+
alias top25='top -o cpu -n 25'
159+
alias topmem='top -o mem'
160+
161+
# List running processes
162+
alias processes="command ps -SAcr -o 'uid,pid,ppid,time,rss,command'"
163+
164+
# Mute, Unmute
165+
alias mute="osascript -e 'set volume output muted true'"
166+
alias unmute="osascript -e 'set volume output muted false'"
167+
168+
# Disable Startup Chime
169+
alias nochime="sudo nvram SystemAudioVolume=%01"
170+
171+
# Hide/show all desktop icons (useful when presenting)
172+
alias showdeskicons='defaults write com.apple.finder CreateDesktop -bool true && killall Finder'
173+
alias hidedeskicons='defaults write com.apple.finder CreateDesktop -bool false && killall Finder'
174+
175+
# Launch iOS Simulator
176+
alias iossim="open -a /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app"
177+
178+
# Lock screen
179+
alias lock="/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend"
180+
181+
182+
183+
# MAINTENANCE
184+
185+
# Update Homebrew packages
186+
alias brewupd='brew update; brew upgrade; brew cleanup'
187+
188+
# Update Node packages
189+
alias npmupd='npm update npm -g; npm update -g'
190+
191+
# Update Homebrew & Node packages
192+
alias update='brew update; brew upgrade; brew cleanup; npm update npm -g; npm update -g'
193+
194+
# Flush Directory Service cache
195+
alias flush='dscacheutil -flushcache'
196+
197+
# Free up inactive Memory
198+
alias purge='sudo purge'
199+
200+
# Empty the Trash
201+
alias emptytrash='rm -rfv ~/.Trash'
202+
203+
# Empty the Trash on all mounted volumes and the main HDD
204+
# Also, clear Apple’s System Logs to improve shell startup speed
205+
alias emptyalltrash="sudo rm -rfv /Volumes/*/.Trashes; sudo rm -rfv ~/.Trash; sudo rm -rfv /private/var/log/asl/*.asl"
206+
207+
# Recursively delete `.DS_Store` files
208+
alias cleanup="find . -type f -name '*.DS_Store' -ls -delete"
209+
210+
# Enable, Disable Spotlight
211+
alias spotoff='sudo mdutil -a -i off'
212+
alias spoton='sudo mdutil -a -i on'
213+
214+
# Hide the Spotlight Menu Icon
215+
alias spothide='sudo chmod 600 /System/Library/CoreServices/Search.bundle/Contents/MacOS/Search; killall SystemUIServer'
216+
217+
# Remove Double 'Open With' Entries
218+
alias cleanopenwith='/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user && killall Finder'
219+
220+
221+
222+
223+
# ---------------------------------------------------------------------
224+
# Utilities
225+
# ---------------------------------------------------------------------
226+
227+
# Generate Random Password
228+
alias randpw='dd if=/dev/urandom bs=1 count=12 2>/dev/null | base64 | rev | cut -b 2- | rev'
229+
230+
# Generate Random Password and copy to clipboard
231+
alias randpwc='dd if=/dev/urandom bs=1 count=12 2>/dev/null | base64 | rev | cut -b 2- | rev | pbcopy'
232+
233+
# grep with color
234+
alias grep='grep --color=auto'
235+
236+
# Weather Forecast for Bern
237+
alias weather='curl http://wttr.in/bern'

config/shell/zshenv

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# ---------------------------------------------------------------------
2+
# Zsh Command History
3+
# ---------------------------------------------------------------------
4+
export HISTSIZE=10000 # Maximum events for internal history
5+
export SAVEHIST=10000 # Maximum events in history file
6+
7+
8+
9+
10+
# ---------------------------------------------------------------------
11+
# Settings & Options
12+
# ---------------------------------------------------------------------
13+
14+
# Brew Cask: Set Path where the symlinks to the applications will be generated
15+
export HOMEBREW_CASK_OPTS="--appdir=/Applications"
16+
17+
# Set Default Editor to Visual Studio Code
18+
export EDITOR='code -w'
19+
alias edit="$EDITOR"
20+
21+
export PATH="/usr/local/sbin:$PATH"

0 commit comments

Comments
 (0)