Skip to content

Instantly share code, notes, and snippets.

@Nyubis
Last active September 26, 2018 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Nyubis/5b7939a22424e9962cb1ab675ab6aaf8 to your computer and use it in GitHub Desktop.
Save Nyubis/5b7939a22424e9962cb1ab675ab6aaf8 to your computer and use it in GitHub Desktop.
# .zshrc.local, assuming ~/.zshrc is from the grml project
# get better up-search
autoload -U up-line-or-beginning-search
autoload -U down-line-or-beginning-search
zle -N up-line-or-beginning-search
zle -N down-line-or-beginning-search
bind2maps emacs viins vicmd -- Up up-line-or-beginning-search
bind2maps emacs viins vicmd -- Down down-line-or-beginning-search
# Make ctrl-backspace work
#bindkey '^H' backward-kill-word
bind2maps emacs viins vicmd -- -s '^H' backward-kill-word
# safe paste url
autoload -U url-quote-magic
zle -N self-insert url-quote-magic
# useful aliases for better default behaviour
alias rm="/bin/rm -Iv --one-file-system"
alias mv="/bin/mv -iv"
alias cp="/bin/cp -iv"
alias ll="ls -lh"
alias la="ls -alh"
alias nemo="nemo 2>/dev/null"
alias cim=vim
alias bim=vim
alias find="noglob find"
# extra aliases for new functionality
alias mdview='/usr/bin/retext --preview 1>/dev/null 2>&1'
alias docker-stop-all="docker ps -q | xargs -r docker stop"
alias docker-rm-all="docker ps -q | xargs -r docker rm"
# year of our lord 2018 and this still isn't a default alias
alias unmount=umount
# Make completion work from the middle of the filename/command
zstyle ':completion:*' completer _complete
zstyle ':completion:*' matcher-list '' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}' '+l:|=* r:|=*'
autoload -Uz compinit
compinit
# Add git "dirty" status to grml prompt
zstyle ':vcs_info:*' check-for-changes true
zstyle ':vcs_info:*' unstagedstr "*"
zstyle ':vcs_info:*' stagedstr "!"
# Restyle vcs info to include dirty status, remove (git)- indicator
zstyle ':vcs_info:*' formats "%F{green}%b%f%c%u%f " "zsh: %r"
zstyle ':vcs_info:*' actionformats "%F{green}%b%f%c%u%F{yellow}|%F{red}%a%f " "zsh: %r"
zstyle ':vcs_info:(sv[nk]|bzr)' branchformat "%b%F{red}:%F{yellow}%r"
# setup for getting a smaller grml prompt
function prompt_grml-small_precmd () {
emulate -L zsh
local grmltheme=grml-small
local -a left_items right_items
if [[ `pwd` == $HOME ]]; then
left_items=(rc user at host path vcs percent)
else
left_items=(rc path vcs percent)
fi
right_items=(sad-smiley)
prompt_grml_precmd_worker
}
function prompt_grml-small_setup () {
grml_prompt_setup grml-small
}
prompt_themes+=( grml-small )
#zstyle ':prompt:grml-small:left:items:path' token '%(4~|
/%3~|%~) '
zstyle ':prompt:grml-small:left:items:path' token '%(5~|%3~|%~) '
zstyle ':prompt:grml-small:left:items:path' pre '%B%F{blue}'
zstyle ':prompt:grml-small:left:items:path' post '%b%f'
zstyle ':prompt:grml-small:left:items:percent' pre '%B'
zstyle ':prompt:grml-small:left:items:percent' post '%b'
autoload -Uz promptinit
promptinit
prompt grml-small
# Select _pure_ zsh prompt
#autoload -Uz promptinit
#promptinit
#prompt pure
# Set wordchars, for ctrl+arrows, ctrl+backspace etc
#WORDCHARS="*?_-.[]~=/&;!#\$%^(){}<>"
# Remove / from wordchars so our cursor stops at it
WORDCHARS="${WORDCHARS:s@/@}"
#### Original .zshrc.local below this line
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment