Skip to content

Instantly share code, notes, and snippets.

@mohsenil85
Forked from scottstanfield/.zshrc
Last active January 5, 2021 19:27
Show Gist options
  • Save mohsenil85/ee6d8e1a7eae0daaece638d872fbfae6 to your computer and use it in GitHub Desktop.
Save mohsenil85/ee6d8e1a7eae0daaece638d872fbfae6 to your computer and use it in GitHub Desktop.
my
# wget https://gist.githubusercontent.com/mohsenil85/ee6d8e1a7eae0daaece638d872fbfae6/raw/ -O ~/.zshrc
# taken from: https://www.codyhiar.com/blog/zsh-autocomplete-with-ssh-config-file/
# 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::*'
autoload -Uz compinit && compinit -i
# taken from https://gist.github.com/scottstanfield/fa1085c225069160225d18b1dc16ee1c
# History settings
HISTFILE=~/.zhistory
HISTSIZE=10000
SAVEHIST=10000
setopt append_history # allow multiple sessions to append to one history
setopt bang_hist # treat ! special during command expansion
setopt extended_history # Write history in :start:elasped;command format
setopt hist_expire_dups_first # expire duplicates first when trimming history
setopt hist_find_no_dups # When searching history, don't repeat
setopt hist_ignore_dups # ignore duplicate entries of previous events
#setopt hist_ignore_space # prefix command with a space to skip it's recording
setopt hist_reduce_blanks # Remove extra blanks from each command added to history
setopt hist_verify # Don't execute immediately upon history expansion
setopt inc_append_history # Write to history file immediately, not when shell quits
setopt share_history # Share history among all sessions
setopt complete_in_word # cd /ho/sco/tm<TAB> expands to /home/scott/tmp
setopt auto_menu # show completion menu on succesive tab presses
setopt autocd # cd to a folder just by typing it's name
ZLE_REMOVE_SUFFIX_CHARS=$' \t\n;&' # These "eat" the auto prior space after a tab complete
# taken from https://medium.com/pareture/simplest-zsh-prompt-configs-for-git-branch-name-3d01602a6f33
# Enabling and setting git info var to be used in prompt config.
autoload -Uz vcs_info
zstyle ':vcs_info:*' enable git svn
# This line obtains information from the vcs.
zstyle ':vcs_info:git*' formats "(%b) "
precmd() {
vcs_info
}
# Enable substitution in the prompt.
setopt prompt_subst
# Config for the prompt. PS1 synonym.
prompt='${SSH_TTY:+"%n@%m"}%3~ ${vcs_info_msg_0_}%(!.#.$) '
#append / to directories
alias ls=ls -p
#emacs line editing
bindkey -e
EDITOR=vim
path+=(~/.bin)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment