# after calling ^P.
bindkey -a '^N' history-beginning-search-forward
+# Use current input when pressing Ctrl-R. Thanks to Mikachu in #zsh on
+# Freenode (2016-07-08 20:54 CEST).
+zshrc-history-incremental-pattern-search-backward() {
+ zle .history-incremental-pattern-search-backward $BUFFER
+}
+zle -N history-incremental-pattern-search-backward \
+ zshrc-history-incremental-pattern-search-backward
# Enable incremental search which is especially useful when the string is an
# argument and not the command.
bindkey '^R' history-incremental-pattern-search-backward
local yellow="%{${fg[yellow]}%}"
local default="%{${fg[default]}%}"
+# Linux network namespace
+local netns="$(ip netns identify 2>/dev/null)"
+
# vcs_info was added in 4.3.9 but it works in earlier versions too. So load it
# if the necessary files are available in ~/.zsh/functions/vcs_info (often a
# symbolic link to current checkout of Zsh's sources).
if [[ -n $SSH_CONNECTION ]]; then
host="%U${host}%u"
fi
+ # Linux network namespace if any
+ if [[ -n $netns ]]; then
+ host="${host}[$netns]"
+ fi
# Number of background processes in yellow if not zero.
local background="%(1j.${yellow}%j${default}.)"
compdef slocate=locate
compdef srsync=rsync
compdef srsync-incremental=rsync
-compdef svalgrind=valgrind
compdef sc=systemctl
alias -g SL='| sort | less'
alias -g T='| tail'
alias -g U='| uniq'
-alias -g X='`xsel -p || xclip -o`' # X selection
+alias -g X='-- "$(xsel -p || xclip -o)"' # X selection
# Make going up directories simple.
alias -g ...='../..'