Skip to content

Instantly share code, notes, and snippets.

@mpdude
Last active March 31, 2022 15:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mpdude/7a8df4b26c150f6909cbaf4b9ba3ff9d to your computer and use it in GitHub Desktop.
Save mpdude/7a8df4b26c150f6909cbaf4b9ba3ff9d to your computer and use it in GitHub Desktop.
~/.profile für OS X
# ~/.profile wird bei jedem Shell-Start ausgeführt
# (In der Bash: NUR ausgeführt, wenn ~/.bash_profile nicht existiert)
# Autocompletion z. B. auch für SSH-Hostnamen
if [ -f $(brew --prefix)/etc/bash_completion ]; then
. $(brew --prefix)/etc/bash_completion
fi
# Shortcut für: Bei einem SSH-Login auf einer anderen Maschine, den eigenen
# SSH-Schlüssel mitnehmen (z.B. damit man dort dann ein per SSH ausgechecktes
# Projekt aktualisieren kann)
alias ssh='ssh -A'
# Shortcut für: Sicheres verschieben
alias rm='rm -i'
# Shortcut für: Ein Verzeichnis hoch springen
alias ..='cd ..'
# Shortcut für: Zwei Verzeichnisse hoch springen
alias ...='cd ../..'
# Shortcut für: Verzeichnisinhalt mit allen Informationen anzeigen
alias l='ls -alh'
# Shortcut für: Verzeichnisinhalt mit versteckten Dateien anzeigen
alias la='ls -a'
# Shortcut für: Verzeichnisinhalt mit allen Informationen anzeigen, und Verzeichnisse mit einem Slash beenden, und Multi-Column layout
alias ll='ls -lCF'
# Shortcut für: Rückfrage bei Dateien, die sonst überschrieben werden würden.
alias mv='mv -i'
export CLICOLOR=
# Apple Silicon (M1) Macs:
test -x /opt/homebrew/bin/brew && eval $(/opt/homebrew/bin/brew shellenv)
# Intel based Macs:
test -x /usr/local/bin/brew && eval $(/usr/local/bin/brew shellenv)
# ~/.zprofile wird bei jedem Shell-Start ausgeführt
# Shortcut für: Bei einem SSH-Login auf einer anderen Maschine, den eigenen
# SSH-Schlüssel mitnehmen (z.B. damit man dort dann ein per SSH ausgechecktes
# Projekt aktualisieren kann)
alias ssh='ssh -A'
# Shortcut für: Sicheres verschieben
alias rm='rm -i'
# Shortcut für: Ein Verzeichnis hoch springen
alias ..='cd ..'
# Shortcut für: Zwei Verzeichnisse hoch springen
alias ...='cd ../..'
# Shortcut für: Verzeichnisinhalt mit allen Informationen anzeigen
alias l='ls -alh'
# Shortcut für: Verzeichnisinhalt mit versteckten Dateien anzeigen
alias la='ls -a'
# Shortcut für: Verzeichnisinhalt mit allen Informationen anzeigen, und Verzeichnisse mit einem Slash beenden, und Multi-Column layout
alias ll='ls -lCF'
# Shortcut für: Rückfrage bei Dateien, die sonst überschrieben werden würden.
alias mv='mv -i'
export CLICOLOR=
# Apple Silicon (M1) Macs:
test -x /opt/homebrew/bin/brew && eval $(/opt/homebrew/bin/brew shellenv)
# Intel based Macs:
test -x /usr/local/bin/brew && eval $(/usr/local/bin/brew shellenv)
# Es folgt die zsh-Autocompletion (Hinweis von Martin), vgl. https://www.codyhiar.com/blog/zsh-autocomplete-with-ssh-config-file/
# Highlight the current autocomplete option
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
# Better SSH/Rsync/SCP Autocomplete
zstyle ':completion::(scp|rsync):' tag-order ' hosts:-ipaddr:ip\ address hosts:-host:host files'
zstyle ':completion::(ssh|scp|rsync)::hosts-host' ignored-patterns '(.|:)' loopback ip6-loopback localhost ip6-localhost broadcasthost
zstyle ':completion::(ssh|scp|rsync)::hosts-ipaddr' ignored-patterns '^(<->.<->.<->.<->|(|::)([[:xdigit:].]##:(#c,2))##(|%))' '127.0.0.<->' '255.255.255.255' '::1' 'fe80::'
# Allow for autocomplete to be case insensitive
zstyle ':completion:*' matcher-list '' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}'
'+l:|?=** r:|?=**'
# Initialize the autocompletion
autoload -Uz compinit && compinit -i
AddKeysToAgent yes
UpdateHostKeys yes
Host wf-development-vm-1804
User vagrant
Hostname 10.37.129.10
Host wf-development-vm-2004
User vagrant
Hostname 10.37.129.15
Host github.com
CheckHostIP no
@relthyg
Copy link

relthyg commented Apr 10, 2018

In die ssh-config muss zusätzlich noch

Host *
    UseKeychain yes

eingetragen werden, sonst klappt das key-forwarding noch nicht.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment