MacOS

Keyboard

System Preferences

  • Key Repeat: Fast
  • Delay Until Repeat: Short
  • Modifier Keys: Caps Lock -> Escape
defaults write -g ApplePressAndHoldEnabled -bool false

Shortcuts

  • App Shortcuts, +
    • All Applications, Zoom, CMD+M
    • All Applications, Minimize, CMD+H
    • Chrome, Bookmark This Tab/Tab…, CMD+L
    • Chrome, Open Location…, CMD+D
    • Chrome, Downloads, SHIFT+CMD+D
  • Input Sources
    • Select the previous input source, CMD+E
  • Spotlight

iTerm2

iTerm2

Terminal emulator for macOS.

Preferences config

  • Search -> Dim inactive split panes
  • Search -> Global key bindings, +
    • Select Split Pane Above, CMD+I
    • Select Split Pane on Left, CMD+J
    • Select Split Pane Below, CMD+K
    • Select Split Pane on Right, CMD+L

Oh My Zsh

Installation command

sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

Custom Alias:

# custom aliases
alias zsh='vim ~/.zshrc'
alias q='exit'
alias s='sudo'
alias v='vim'
alias g='git'
alias ga='git add'
alias gc='git checkout'
alias gs='git status'
alias gd='git diff'
alias sv='sudo vim'
alias sc="source ~/.zshrc"
alias ..='cd ..'
alias cls='clear'
alias nano="vim"
alias tailf="tail -f"
alias lf='ll -p | grep -v /'
alias ldir='ls -ld -- */'

HSTR

HSTR

Easily view, navigate and search your command history.

brew install hstr

Configure HSTR just by running:

hstr --show-zsh-configuration >> ~/.zshrc

Git Config

Replace name, email, GitHub user.

[user]
    name = kuga
    email = kuga@cestbon.mbp

[alias]
    pr = pull --rebase
    br = branch -avv
    ci = commit
    co = checkout
    cm = checkout master
    mg = merge
    st = status
    l = log --color --graph --pretty=format:'%Cred%h%Creset -%C(bold yellow)%d%Creset %s %Cgreen(%cd) %C(bold blue)<%an>%Creset' --abbrev-commit
    accept-ours = "!f() { files=\"$@\"; [ -z $files ] && files='.'; git checkout --ours -- $files; git add -u $files; }; f"
    accept-theirs = "!f() { files=\"$@\"; [ -z $files ] && files='.'; git checkout --theirs -- $files; git add -u $files; }; f"
    diffeol = diff --ignore-space-at-eol

[core]
    excludesfile = /Users/hairdresser/.gitignore

[color]
    branch = auto
    diff = auto
    status = auto

[GitHub]
    user = kuga

[credential]
    helper = osxkeychain

[pull]
    rebase = false

Kubernetes

kubectl

kubectl

The Kubernetes command-line tool.

brew install kubectl

kubectx

kubectx

Switch between contexts & namespaces.

brew install kubectx

Add the following to your .zshrc file:

# kubectx
alias kc="kubectx"
alias kn="kubens"

KUBECTX_CURRENT_FGCOLOR=$(tput setaf 6)

kube-ps1

kube-ps1

Kubernetes prompt for bash and zsh.

brew install kube-ps1

Add the following to your .zshrc file:

# kube-ps1
# https://github.com/jonmosco/kube-ps1
# todo change source path
source /usr/local/Cellar/kube-ps1/0.7.0/share/kube-ps1.sh
PROMPT='$(kube_ps1)'$PROMPT
KUBE_PS1_PREFIX="["
KUBE_PS1_SUFFIX="]"
KUBE_PS1_SYMBOL_ENABLE=false
KUBE_PS1_CTX_COLOR="83"
KUBE_PS1_NS_COLOR="201"

kubectl-aliases

kubectl-aliases

Convenient shell aliases for kubectl.

Download .kubectl_aliases file & Add the following to your .zshrc file:

# load kubectl aliases file
[ -f ~/.kubectl_aliases ] && source ~/.kubectl_aliases

# Print the full command before running it
function kubectl() { echo "+ kubectl $@">&2; command kubectl $@; }