diff options
Diffstat (limited to '_zsh')
| -rw-r--r-- | _zsh/00-checks.zsh | 19 | ||||
| -rw-r--r-- | _zsh/10-param.zsh | 13 | ||||
| -rw-r--r-- | _zsh/10-setopt.zsh | 71 | ||||
| -rw-r--r-- | _zsh/20-colors.zsh | 20 | ||||
| -rw-r--r-- | _zsh/30-prompt.zsh | 50 | ||||
| -rw-r--r-- | _zsh/40-completion.zsh | 61 | ||||
| -rw-r--r-- | _zsh/40-functions.zsh | 155 | ||||
| -rw-r--r-- | _zsh/40-hooks.zsh | 19 | ||||
| -rw-r--r-- | _zsh/50-term.zsh | 13 | ||||
| -rw-r--r-- | _zsh/50-vi-mode.zsh | 62 | ||||
| -rw-r--r-- | _zsh/60-bindkeys.zsh | 104 | ||||
| -rw-r--r-- | _zsh/60-zle.zsh | 20 | ||||
| -rw-r--r-- | _zsh/70-history.zsh | 34 | ||||
| -rw-r--r-- | _zsh/80-emacs.zsh | 43 | ||||
| -rw-r--r-- | _zsh/80-gpg.zsh | 64 | ||||
| -rw-r--r-- | _zsh/80-tmux.zsh | 37 | ||||
| -rw-r--r-- | _zsh/90-aliases.zsh | 31 | ||||
| -rw-r--r-- | _zsh/90-exports.zsh | 23 | 
18 files changed, 0 insertions, 839 deletions
| diff --git a/_zsh/00-checks.zsh b/_zsh/00-checks.zsh deleted file mode 100644 index 69282a6..0000000 --- a/_zsh/00-checks.zsh +++ /dev/null @@ -1,19 +0,0 @@ -# -# zsh/checks.zsh -# -# Credits: http://zanshin.net/2013/02/02/zsh-configuration-from-the-ground-up/ -# - -if [[ $(uname) = 'Linux' ]]; then -    IS_LINUX=1 -elif [[ $(uname) = 'Darwin' ]]; then -    IS_MAC=1 -elif [[ $(uname) = 'FreeBSD' ]]; then -    IS_FREEBSD=1 -    IS_BSD=1 -elif [[ $(uname) = 'DragonFly' ]]; then -    IS_DRAGONFLY=1 -    IS_BSD=1 -fi - -# vim: set ts=8 sw=4 tw=0 fenc=utf-8 ft=zsh: # diff --git a/_zsh/10-param.zsh b/_zsh/10-param.zsh deleted file mode 100644 index 99f0942..0000000 --- a/_zsh/10-param.zsh +++ /dev/null @@ -1,13 +0,0 @@ -# -# zsh/param.zsh -# see zshparam(1) -# - -# Ask only if the top of the listing would scroll off the screen -LISTMAX=0 - -# Report consuming time statistics if user+system greater than 60 seconds -REPORTTIME=60 - -# Format of process time reports with the `time' keyword -TIMEFMT="%J  %U user %S system %P cpu %MM memory %*E total" diff --git a/_zsh/10-setopt.zsh b/_zsh/10-setopt.zsh deleted file mode 100644 index 8d95b41..0000000 --- a/_zsh/10-setopt.zsh +++ /dev/null @@ -1,71 +0,0 @@ -# -# zsh/setopt.zsh -# see zshoptions(1) -# - -## Basics -setopt NO_BEEP -setopt AUTO_CD -# make cd push the old directory onto the directory stack -setopt AUTO_PUSHD -# don't push multiple copies of the same directory into the directory stack -setopt PUSHD_IGNORE_DUPS -# exchange meanings of `+` and `-` when specifying a directory in the stack -setopt PUSHD_MINUS -# do not print the directory stack after `pushd` or `popd` -setopt PUSHD_SILENT -# treat #, ~, and ^ as part of patterns for filename generation -setopt EXTENDED_GLOB -# allow comments even in interactive shells (especially for Muness) -setopt INTERACTIVE_COMMENTS -# display PID when suspending processes as well -setopt LONG_LIST_JOBS -# disable output flow control via start/stop characters (^S/^Q) -unsetopt FLOW_CONTROL - -## History -# allow multiple terminal sessions to all append to one zsh command history -setopt APPEND_HISTORY -# include timestamp of command and duration to history -setopt EXTENDED_HISTORY -# add comamnds as they are typed, don't wait until shell exit -setopt INC_APPEND_HISTORY -# do not write events to history that are duplicates of previous events -setopt HIST_IGNORE_DUPS -# remove command line from history list when it begins a space -setopt HIST_IGNORE_SPACE -# when searching history don't display results already cycled through twice -setopt HIST_FIND_NO_DUPS -# remove extra blanks from each command line being added to history -setopt HIST_REDUCE_BLANKS -# don't execute, just expand history -setopt HIST_VERIFY - - -## Completion -# `*' shouldn't match dotfiles. ever. -setopt NO_GLOB_DOTS -# allow completion from within a word/phrase -setopt COMPLETE_IN_WORD -# when completing from middle of a word, move cursor to the end of the word -setopt ALWAYS_TO_END -# show completion menu on successive tab press (needs 'unsetopt MENU_COMPLETE') -setopt AUTO_MENU -unsetopt MENU_COMPLETE -# make the completion list compact -setopt LIST_PACKED - -## Correction -# spelling correction for commands -setopt CORRECT -# spelling correction for arguments -#setopt CORRECTALL - -## Prompt -# enable parameter expansion, command substitution, and arithmetic expansion -# in the prompt -setopt PROMPT_SUBST -# remove any right prompt from display when accepting a command line -setopt TRANSIENT_RPROMPT - -# vim: set ts=8 sw=4 tw=0 fenc=utf-8 ft=zsh: # diff --git a/_zsh/20-colors.zsh b/_zsh/20-colors.zsh deleted file mode 100644 index 427ea20..0000000 --- a/_zsh/20-colors.zsh +++ /dev/null @@ -1,20 +0,0 @@ -# -# zsh/colors.sh -# - -autoload -U colors && colors - -# The variables are wrapped in %{%}. This should be the case for every -# variable that does not contain space. -for COLOR in RED GREEN YELLOW BLUE MAGENTA CYAN BLACK WHITE; do -  eval PR_$COLOR='%{$fg_no_bold[${(L)COLOR}]%}' -  eval PR_BOLD_$COLOR='%{$fg_bold[${(L)COLOR}]%}' -done - -eval RESET='$reset_color' -export PR_RED PR_GREEN PR_YELLOW PR_BLUE PR_WHITE PR_BLACK -export PR_BOLD_RED PR_BOLD_GREEN PR_BOLD_YELLOW PR_BOLD_BLUE -export PR_BOLD_WHITE PR_BOLD_BLACK - - -# vim: set ts=8 sw=4 tw=0 fenc=utf-8 ft=zsh: # diff --git a/_zsh/30-prompt.zsh b/_zsh/30-prompt.zsh deleted file mode 100644 index cfd42f3..0000000 --- a/_zsh/30-prompt.zsh +++ /dev/null @@ -1,50 +0,0 @@ -# -# zsh/prompt.zsh -# -# Credit: http://chneukirchen.org/dotfiles/.zshrc -# - - -# gitpwd - format the current path with inline git branch for the -#          prompt; the current path is limited to $NDIR segments, -#          meanwhile long segments are shortened to be -#          '<prefix>…<suffix>'. -NDIRS=3 -function gitpwd() { -    local -a segs splitprefix -    local prefix branch -    segs=("${(Oas:/:)${(D)PWD}}") -    segs=("${(@)segs/(#b)(?(#c10))??*(?(#c5))/${(j:\u2026:)match}}") - -    if gitprefix=$(git rev-parse --show-prefix 2>/dev/null); then -        splitprefix=("${(s:/:)gitprefix}") -        if ! branch=$(git symbolic-ref -q --short HEAD); then -           branch=$(git name-rev --name-only HEAD 2>/dev/null) -           [[ $branch = *\~* ]] || branch+="~0"    # distinguish detached HEAD -        fi -        if (( $#splitprefix > NDIRS )); then -           print -n "${segs[$#splitprefix]}@$branch " -        else -           segs[$#splitprefix]+=@$branch -        fi -    fi - -    (( $#segs == NDIRS+1 )) && [[ $segs[-1] == "" ]] && print -n / -    print "${(j:/:)${(@Oa)segs[1,NDIRS]}}" -} - - -function myprompt() { -    setopt PROMPT_SUBST -    nbsp=$'\u00A0' -    PROMPT='%S%B%F{green}[%m]%s%(?.. %F{red}%??)%(1j. %F{yellow}%j&.)%b%f $(gitpwd)%B%(!.%F{red}.%F{green})%#${SSH_CONNECTION:+%#}$nbsp%b%f' -    RPROMPT='' -    # Prompt for spelling correction -    SPROMPT='zsh: correct %B%F{red}%R%b%f to %B%F{green}%r%b%f [(y)es (n)o (a)bort (e)dit]? ' -} - - -myprompt - - -# vim: set ts=8 sw=4 tw=0 fenc=utf-8 ft=zsh: # diff --git a/_zsh/40-completion.zsh b/_zsh/40-completion.zsh deleted file mode 100644 index 5275f6b..0000000 --- a/_zsh/40-completion.zsh +++ /dev/null @@ -1,61 +0,0 @@ -# -# zsh/completion.zsh -# - -fpath=(~/.zsh.completions $fpath) -autoload -U compinit && compinit -zmodload -i zsh/complist - -# man zshcontrib -zstyle ':vcs_info:*' actionformats '%F{5}(%f%s%F{5})%F{3}-%F{5}[%F{2}%b%F{3}|%F{1}%a%F{5}]%f ' -zstyle ':vcs_info:*' formats '%F{5}(%f%s%F{5})%F{3}-%F{5}[%F{2}%b%F{5}]%f ' -zstyle ':vcs_info:*' enable git #svn cvs - -# enable completion caching, use rehash to clear -zstyle ':completion::complete:*' use-cache on -zstyle ':completion::complete:*' cache-path ~/.cache/zsh/${HOST} - -# fallback to built in ls colors -zstyle ':completion:*' list-colors '' - -# make the list prompt friendly -zstyle ':completion:*' list-prompt '%SAt %p: Hit TAB for more, or the character to insert%s' - -# make the selection prompt friendly when there are a lot of choices -zstyle ':completion:*' select-prompt '%SScrolling active: current selection at %p%s' - -# add simple colors to kill -zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01' - -# list of completers to use -zstyle ':completion:*::::' completer _expand _complete _ignored _approximate - -zstyle ':completion:*' menu select=1 _complete _ignored _approximate - -# insert all expansions for expand completer -#zstyle ':completion:*:expand:*' tag-order all-expansions - -# match uppercase from lowercase -zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}' - -# offer indexes before parameters in subscripts -zstyle ':completion:*:*:-subscript-:*' tag-order indexes parameters - -# formatting and messages -zstyle ':completion:*' verbose yes -zstyle ':completion:*:descriptions' format '%B%d%b' -zstyle ':completion:*:messages' format '%d' -zstyle ':completion:*:warnings' format 'No matches for: %d' -zstyle ':completion:*:corrections' format '%B%d (errors: %e)%b' -zstyle ':completion:*' group-name '' - -# ignore completion functions (until the _ignored completer) -zstyle ':completion:*:functions' ignored-patterns '_*' -zstyle ':completion:*:scp:*' tag-order files users 'hosts:-host hosts:-domain:domain hosts:-ipaddr"IP\ Address *' -zstyle ':completion:*:scp:*' group-order files all-files users hosts-domain hosts-host hosts-ipaddr -zstyle ':completion:*:ssh:*' tag-order users 'hosts:-host hosts:-domain:domain hosts:-ipaddr"IP\ Address *' -zstyle ':completion:*:ssh:*' group-order hosts-domain hosts-host users hosts-ipaddr -zstyle '*' single-ignored show - - -# vim: set ts=8 sw=4 tw=0 fenc=utf-8 ft=zsh: # diff --git a/_zsh/40-functions.zsh b/_zsh/40-functions.zsh deleted file mode 100644 index cbf15ad..0000000 --- a/_zsh/40-functions.zsh +++ /dev/null @@ -1,155 +0,0 @@ -# -# zsh/functions.zsh -# -# execute 'functions <func_name>' to show function details. -# - -## Check the existence/accessibility of a command -# Credit: https://stackoverflow.com/a/677212/4856091 -function exists() { -    # 'command' is POSIX-compliant and more portable; -    # 'hash' only searches for commands; -    # while 'type' also considers builtins and keywords. -    type "$1" >/dev/null 2>&1 -} - - -## Check whether the program is running -function is_running() { -    pgrep -x -u "${USER}" "$1" >/dev/null 2>&1 -} - - -function zsh_recompile() { -    autoload -U zrecompile -    rm -f ~/.zsh/*.zwc -    [[ -f ~/.zshrc ]] && zrecompile -p ~/.zshrc -    [[ -f ~/.zshrc.zwc.old ]] && rm -f ~/.zshrc.zwc.old - -    local f -    for f in ~/.zsh/**/*.zsh; do -        [[ -f $f ]] && zrecompile -p $f -        [[ -f $f.zwc.old ]] && rm -f $f.zwc.old -    done - -    [[ -f ~/.zcompdump ]] && zrecompile -p ~/.zcompdump -    [[ -f ~/.zcompdump.zwc.old ]] && rm -f ~/.zcompdump.zwc.old - -    source ~/.zshrc -} - - -function extract() { -  echo "Extracting '$1' ..." -  if [ -f "$1" ] ; then -      case "$1" in -          *.tar.bz2) -              tar xjf "$1";; -          *.tar.gz) -              tar xzf "$1";; -          *.bz2) -              bunzip2 "$1";; -          *.rar) -              unrar x "$1";; -          *.gz) -              gunzip "$1";; -          *.tar) -              tar xf "$1";; -          *.tbz2) -              tar xjf "$1";; -          *.tgz) -              tar xzf "$1";; -          *.zip) -              unzip "$1";; -          *.Z) -              uncompress "$1";; -          *.7z) -              7z x "$1";; -          *) -              echo "Unable to extract: '$1'" ;; -      esac -  else -      echo "Invalid file: '$1'" -  fi -} - - -function trash() { -    local path -    for path in "$@"; do -        # ignore any arguments -        if [[ "${path}" = -* ]]; then -            : -        else -        local dst="${path##*/}" -        # append the time if necessary -        while [ -e ~/.trash/"${dst}" ]; do -            dst="${dst} "$(date +%H-%M-%S) -        done -        command mv "${path}" ~/.trash/"${dst}" -        fi -    done -} - - -## Print a horizontal rule -function rule() { -    printf "%$(tput cols)s\n" | tr ' ' "${1:-=}" -} - - -## Interactive move/rename: making renaming long filenames less sucks -# Credit: http://chneukirchen.org/dotfiles/.zshrc -function imv() { -    local src dst -    for src; do -        [[ -e "$src" ]] || { print -u2 "$src: does not exist"; continue } -        dst="$src" -        vared dst -        [[ "$src" != "$dst" ]] && mkdir -p ${dst:h} && mv -n $src $dst -    done -} - - -## Print pre-defined C macros -# Credit: http://chneukirchen.org/dotfiles/.zshrc -ccdef() { -    ${1:-cc} $@[2,-1] -dM -E - </dev/null -} - - -## Run up to N CMD in parallel with ARGS -#    zapply [-jN] [-iv] CMD... -- ARGS... -#    CMD will be run as zsh command if it contains a $ -#    without explicit '--', assume CMD is first argument -#    {} (or $1) may be used to access argument -# Credit: http://chneukirchen.org/dotfiles/.zshrc -zapply() { -    local s="$@[(i)--]" xopt= -    (( s > $# )) && argv[2]=(-- "$argv[2]") && s=2 -    zparseopts -D -M -A xopt n: p t P: j:=P v=t i=p   # map to xargs(1) flags -    (( $@[(i){}] < s )) && xopt[-I]={} -    [[ $1 = *'$'* ]] && argv[1]=(zsh -c "$1" --) && (( s += 3 )) -    printf '%s\0' "$@[s+1,-1]" | xargs -0 -r -n1 ${(kv)=xopt} "$@[1,s-1]" -} - - -## Generate random password/string -randpass() { -    local len=${1:-16} -    tr -dc '[:alnum:]' </dev/urandom | head -c ${len} | xargs -} - - -## Fix terminal -# Credit: https://unix.stackexchange.com/a/299922 -fix() { -    reset -    stty sane -    tput rs1 -    clear -    echo -e "\033c" -} - - -# vim: set ts=8 sw=4 tw=0 fenc=utf-8 ft=zsh: # diff --git a/_zsh/40-hooks.zsh b/_zsh/40-hooks.zsh deleted file mode 100644 index da15a29..0000000 --- a/_zsh/40-hooks.zsh +++ /dev/null @@ -1,19 +0,0 @@ -# -# zsh/hooks.zsh -# -# Credit: http://chneukirchen.org/dotfiles/.zshrc -# - -case "$TERM" in -xterm*|rxvt*) -    function precmd()  { -        [[ -t 1 ]] && print -Pn "\e]0;%m: %~\a" -    } -    function preexec() { -        [[ -t 1 ]] && print -n "\e]0;$HOST: ${(q)1//(#m)[$'\000-\037\177-']/${(q)MATCH}}\a" -    } -    ;; -esac - - -# vim: set ts=8 sw=4 tw=0 fenc=utf-8 ft=zsh: # diff --git a/_zsh/50-term.zsh b/_zsh/50-term.zsh deleted file mode 100644 index 7b60159..0000000 --- a/_zsh/50-term.zsh +++ /dev/null @@ -1,13 +0,0 @@ -# -# zsh/term.zsh -# -# 2018-02-02 -# - -# Disable sending of start (Ctrl-Q) and stop (Ctrl-S) characters -stty -ixoff - -# Disable XON/XOFF flow control -stty -ixon - -# vim: set ts=8 sw=4 tw=0 fenc=utf-8 ft=zsh: # diff --git a/_zsh/50-vi-mode.zsh b/_zsh/50-vi-mode.zsh deleted file mode 100644 index 49c1a26..0000000 --- a/_zsh/50-vi-mode.zsh +++ /dev/null @@ -1,62 +0,0 @@ -# -# zsh/vi-mode.zsh -# see zshzle(1) -# -# Credits: -# * https://github.com/robbyrussell/oh-my-zsh/blob/master/plugins/vi-mode/vi-mode.plugin.zsh -# * http://zshwiki.org/home/zle/bindkeys -# -# 2015-11-18 -# - -# Updates editor information when the keymap changes. -function zle-keymap-select() { -    zle reset-prompt -    zle -R -} - -# Ensure that the prompt is redrawn when the terminal size changes. -TRAPWINCH() { -    zle && { zle reset-prompt; zle -R } -} - -zle -N zle-keymap-select -zle -N edit-command-line - - -# NOTE: -# This will *reset* previous bindkey settings! -bindkey -v - -# allow v to edit the command line (standard behaviour) -autoload -Uz edit-command-line -bindkey -M vicmd 'v' edit-command-line - -# allow ctrl-p, ctrl-n for navigate history (standard behaviour) -bindkey '^P' up-history -bindkey '^N' down-history - -# allow ctrl-h, ctrl-w, ctrl-? for char and word deletion (standard behaviour) -bindkey '^?' backward-delete-char -bindkey '^h' backward-delete-char -bindkey '^w' backward-kill-word - -# allow ctrl-r for incremental history search -bindkey -M viins '^r' history-incremental-search-backward -bindkey -M vicmd '^r' history-incremental-search-backward - -# if mode indicator wasn't setup by theme, define default -if [[ "$MODE_INDICATOR" == "" ]]; then -    MODE_INDICATOR="%{$fg_bold[red]%}<%{$fg[red]%}<<%{$reset_color%}" -fi - -function vi_mode_prompt_info() { -    echo "${${KEYMAP/vicmd/$MODE_INDICATOR}/(main|viins)/}" -} - -# define right prompt, if it wasn't defined by a theme -if [[ "$RPS1" == "" && "$RPROMPT" == "" ]]; then -    RPS1='$(vi_mode_prompt_info)' -fi - -# vim: set ts=8 sw=4 tw=0 fenc=utf-8 ft=zsh: # diff --git a/_zsh/60-bindkeys.zsh b/_zsh/60-bindkeys.zsh deleted file mode 100644 index a57ab83..0000000 --- a/_zsh/60-bindkeys.zsh +++ /dev/null @@ -1,104 +0,0 @@ -# -# zsh/bindkeys.zsh -# see zshzle(1) -# -# To see the key combo you want to use just do: -# $ cat > /dev/null -# then press it. -# -# NOTE: -# Switching mode (e.g., `bindkey -v`) will *reset* the following settings! -# -# Credit: -# * oh-my-zsh: https://github.com/robbyrussell/oh-my-zsh -#   lib/key-bindings.zsh -# - -# Make sure that the terminal is in application mode when zle is active, -# since only then values from $terminfo are valid -if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then -    function zle-line-init() { -        echoti smkx -    } -    function zle-line-finish() { -        echoti rmkx -    } -    zle -N zle-line-init -    zle -N zle-line-finish -fi - -# [Ctrl-r] - Search backward incrementally for a specified string. -# The string may begin with ^ to anchor the search to the beginning of the line. -bindkey '^r' history-incremental-search-backward - -# [PageUp] - Up a line of history -if [[ "${terminfo[kpp]}" != "" ]]; then -    bindkey "${terminfo[kpp]}" up-line-or-history -fi -# [PageDown] - Down a line of history -if [[ "${terminfo[knp]}" != "" ]]; then -    bindkey "${terminfo[knp]}" down-line-or-history -fi - -# start typing + [Up-Arrow] - fuzzy find history forward -if [[ "${terminfo[kcuu1]}" != "" ]]; then -    autoload -U up-line-or-beginning-search -    zle -N up-line-or-beginning-search -    bindkey "${terminfo[kcuu1]}" up-line-or-beginning-search -fi -# start typing + [Down-Arrow] - fuzzy find history backward -if [[ "${terminfo[kcud1]}" != "" ]]; then -    autoload -U down-line-or-beginning-search -    zle -N down-line-or-beginning-search -    bindkey "${terminfo[kcud1]}" down-line-or-beginning-search -fi - -# [Home] - Go to beginning of line -if [[ "${terminfo[khome]}" != "" ]]; then -    bindkey "${terminfo[khome]}" beginning-of-line -fi -# [End] - Go to end of line -if [[ "${terminfo[kend]}" != "" ]]; then -    bindkey "${terminfo[kend]}"  end-of-line -fi - -# [Space] - do history expansion -bindkey ' ' magic-space -# [Ctrl-RightArrow] - move forward one word -bindkey '^[[1;5C' forward-word -# [Ctrl-LeftArrow] - move backward one word -bindkey '^[[1;5D' backward-word - -# [Shift-Tab] - move through the completion menu backwards -if [[ "${terminfo[kcbt]}" != "" ]]; then -    bindkey "${terminfo[kcbt]}" reverse-menu-complete -fi - -# [Backspace] - delete backward -bindkey '^?' backward-delete-char -# [Delete] - delete forward -if [[ "${terminfo[kdch1]}" != "" ]]; then -    bindkey "${terminfo[kdch1]}" delete-char -else -    bindkey "^[[3~" delete-char -    bindkey "^[3;5~" delete-char -    bindkey "\e[3~" delete-char -fi - -# Emacs style line editing -bindkey "^K"    kill-whole-line                      # ctrl-k -bindkey "^R"    history-incremental-search-backward  # ctrl-r -bindkey "^A"    beginning-of-line                    # ctrl-a -bindkey "^E"    end-of-line                          # ctrl-e -bindkey "[B"    history-search-forward               # down arrow -bindkey "[A"    history-search-backward              # up arrow -bindkey "^D"    delete-char                          # ctrl-d -bindkey "^F"    forward-char                         # ctrl-f -bindkey "^B"    backward-char                        # ctrl-b - -# see zshcontrib(1) -autoload -U select-word-style -# bash-style word killing: word characters are alphanumeric characters only -select-word-style bash - -# vim: set ts=8 sw=4 tw=0 fenc=utf-8 ft=zsh: # diff --git a/_zsh/60-zle.zsh b/_zsh/60-zle.zsh deleted file mode 100644 index 92c339d..0000000 --- a/_zsh/60-zle.zsh +++ /dev/null @@ -1,20 +0,0 @@ -# -# zsh/zle.zsh -# some generic ZLE settings -# see zshzle(1) -# -# 2016-05-29 -# - -# Turn off ZLE bracketed paste in dumb and cons25 (DFly default console) term, -# otherwise turn on ZLE bracketed-paste-magic -# Credit: http://zmwangx.github.io/blog/2015-09-21-zsh-51-and-bracketed-paste.html -# See also zshparam(1) -if [[ ${TERM} == dumb ]] || [[ ${TERM} == cons25 ]]; then -    unset zle_bracketed_paste -else -    autoload -Uz bracketed-paste-magic -    zle -N bracketed-paste bracketed-paste-magic -fi - -# vim: set ts=8 sw=4 tw=0 fenc=utf-8 ft=zsh: # diff --git a/_zsh/70-history.zsh b/_zsh/70-history.zsh deleted file mode 100644 index 1d294f6..0000000 --- a/_zsh/70-history.zsh +++ /dev/null @@ -1,34 +0,0 @@ -# -# zsh/history.zsh -# see zshparam(1) -# - -HISTFILE=~/.zsh_history -HISTSIZE=9000 -SAVEHIST=9000 -# ignore these commands without arguments -HISTIGNORE="cd:ls:ll" - - -# Combine history search with `percol` -# Credit: https://github.com/mooz/percol -if exists percol; then -    function percol_select_history() { -        local tac -        exists gtac && tac="gtac" || { -                exists tac && tac="tac" || { -                        tac="tail -r" } } -        BUFFER=$(fc -l -n 1 | eval ${tac} | percol --query "${LBUFFER}") -        CURSOR=${#BUFFER}  # move cursor -        zle -R -c  # refresh -    } - -    zle -N percol_select_history -    # Override the bindkey settings in `60-bindkeys.zsh` -    bindkey '^R' percol_select_history -    # Override the bindkey settings in `50-vi-mode.zsh` -    bindkey -M viins '^r' percol_select_history -    bindkey -M vicmd '^r' percol_select_history -fi - -# vim: set ts=8 sw=4 tw=0 fenc=utf-8 ft=zsh: # diff --git a/_zsh/80-emacs.zsh b/_zsh/80-emacs.zsh deleted file mode 100644 index 88a4b90..0000000 --- a/_zsh/80-emacs.zsh +++ /dev/null @@ -1,43 +0,0 @@ -# -# zsh/emacs.zsh -# -# Credits: -# https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/emacs -# -# 2016-02-21 -# - -if exists emacsclient; then -    function eserver() { -        # NOTE: -        # Force "LC_CTYPE=zh_CN.UTF-8", otherwise, the Chinese input methods -        # (e.g., Fcitx) cannot be activated within Emacs (GUI) in non-Chinese -        # locale (e.g., "LANG=en_US.UTF-8" while "LC_CTYPE" unset) -        command env LC_CTYPE=zh_CN.UTF-8 emacs --daemon -    } - -    function _emacsclient() { -        # Get list of available X windows. -        local X=$(emacsclient --alternate-editor '' \ -                              --eval '(x-display-list)' 2>/dev/null) - -        if [ -z "$X" ] || [ "$X" = "nil" ]; then -            # Create one if there is no X window yet. -            local create_frame="--create-frame" -        else -            local create_frame="" -        fi - -        command env LC_CTYPE=zh_CN.UTF-8 \ -            emacsclient --alternate-editor "" $create_frame "$@" -    } - -    alias emacs='_emacsclient -t' -    # Same as 'M-x eval' but outside of Emacs -    alias eeval='_emacsclient --eval' -    # Create a new X frame -    alias eframe='_emacsclient --create-frame --no-wait' -fi  # END: exists emacsclient - - -# vim: set ts=8 sw=4 tw=0 fenc=utf-8 ft=zsh: # diff --git a/_zsh/80-gpg.zsh b/_zsh/80-gpg.zsh deleted file mode 100644 index 2cbb70c..0000000 --- a/_zsh/80-gpg.zsh +++ /dev/null @@ -1,64 +0,0 @@ -# -# zsh/gpg.zsh -# - -# NOTE: -# Install both the `pinentry-gtk-2' and `pinentry-curses', and symlink -# `pinentry-gtk-2' to `pinentry' as the default pinentry program, which -# will fallback to the text mode when X11 is not avaiable (i.e., -# `$DISPLAY' is not set), e.g., through SSH logins. -# `pinentry-gnome3' seems to have problem that cannot fallback to the -# text mode ... (for reason unkown ...) - -# This `GPG_TTY' variable should be set to the correct TTY where the shell -# is running.  See `gpg-agent(1)' for more details. -export GPG_TTY=$(tty) - -# Make SSH to use `gpg-agent'. -unset SSH_AGENT_PID -if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then -    export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)" -fi - -# Use curses-based pinentry for SSH logins -# Credit: https://wiki.gentoo.org/wiki/GnuPG -if [ -n "${SSH_CONNECTION}" ] ;then -    export PINENTRY_USER_DATA="USE_CURSES=1" -fi - -# Let pinentry know which console to display in for `ssh-agent'. -# -# Since the 'ssh-agent' protocol does not contain a mechanism for telling -# the agent on which terminal/display it is running, gpg-agent's -# ssh-support can just use the TTY or X display when `gpg-agent' has been -# started, which may be before the X session startup.  Therefore, when the -# switched to the X session, or login remotely through SSH, the `pinentry' -# will get popped up on whatever display the `gpg-agent' has been started -# or may just fail.  In this case, a manual update is necessary. -# -# This will set startup TTY and X11 DISPLAY variables to the values of -# this session. -# -# Credits: -# * GnuPG: Commonly Seen Problems -#   https://www.gnupg.org/documentation/manuals/gnupg/Common-Problems.html -# * `gpg-agent(1)': option `--enable-ssh-support' -# * http://blog.mrloop.com/workflow/2017/02/09/pin-entry.html -# -update-gpg-tty() { -    gpg-connect-agent updatestartuptty /bye >/dev/null 2>&1 || true -} -autoload -U add-zsh-hook -add-zsh-hook preexec update-gpg-tty - -# Delete all identities from the `gpg-agent', which is similar to -# `ssh-add -D`. -# Credit: http://blog.mrloop.com/workflow/2017/02/09/pin-entry.html -ssh-delete() { -    grep -o '^[A-Z0-9]*' ${HOME}/.gnupg/sshcontrol | \ -        xargs -I'%' rm ${HOME}/.gnupg/private-keys-v1.d/'%'.key -    echo "" > ${HOME}/.gnupg/sshcontrol -} - - -# vim: set ts=8 sw=4 tw=0 fenc=utf-8 ft=zsh: # diff --git a/_zsh/80-tmux.zsh b/_zsh/80-tmux.zsh deleted file mode 100644 index 9a4ad9c..0000000 --- a/_zsh/80-tmux.zsh +++ /dev/null @@ -1,37 +0,0 @@ -# -# zsh/tmux.zsh -# - - -# Integrate `tmux` attach with `percol` -# Credit: https://github.com/mooz/percol -if exists percol; then -    function tmattach() { -        if [[ $1 == "" ]]; then -            PERCOL=percol -        else -            PERCOL="percol --query $1" -        fi - -        sessions=$(tmux list-sessions) -        [ $? -ne 0 ] && return - -        session=$(echo ${sessions} | eval ${PERCOL} | cut -d: -f1) -        if [[ -n "${session}" ]]; then -            tmux attach -t ${session} -        fi -    } -fi - - -# Handy aliases -if exists tmattach; then -    alias tma=tmattach -else -    alias tma='tmux attach -t' -fi -alias tml='tmux list-sessions' -alias tms='tmux new-session -s' - - -# vim: set ts=8 sw=4 tw=0 fenc=utf-8 ft=zsh: # diff --git a/_zsh/90-aliases.zsh b/_zsh/90-aliases.zsh deleted file mode 100644 index ac140b3..0000000 --- a/_zsh/90-aliases.zsh +++ /dev/null @@ -1,31 +0,0 @@ -# -# zsh/aliases.zsh -# - -alias zhelp='run-help' - -alias ..='cd ../' -alias ...='cd ../../' -alias ....='cd ../../../' -alias cd..='cd ..' -alias d='dirs -v | head -10' -alias po=popd -alias pu=pushd - -if [[ -n "${IS_LINUX}" ]]; then -    alias ls='ls --color=auto' -elif [[ -n "${IS_BSD}" ]] || [[ -n "${IS_MAC}" ]]; then -    alias ls='ls -G' -fi -alias l='ls -lah' -alias la='ls -lAh' -alias ll='ls -lh' -alias lsa='ls -lah' - -# Do not use `GREP_OPTIONS` -alias grep='grep --color=auto' - -exists "vi" || alias vi=vim -exists "safe-rm" && alias rm=safe-rm - -# vim: set ts=8 sw=4 tw=0 fenc=utf-8 ft=zsh: # diff --git a/_zsh/90-exports.zsh b/_zsh/90-exports.zsh deleted file mode 100644 index f368161..0000000 --- a/_zsh/90-exports.zsh +++ /dev/null @@ -1,23 +0,0 @@ -# -# zsh/exports.zsh -# - -# NOTE: -# Generic environment variables and those needing been set only once -# should go to `~/.profile'. - -# colors for BSD ls -if [[ -n "${IS_BSD}" ]]; then -    export CLICOLOR=1 -    export LSCOLORS=exfxcxdxbxegedabagacad -fi - -# Color setup for `ls': `LS_COLORS' -# NOTE: For unknown reason, the `LS_COLORS' variable get overridden when -#       it is set in `~/.profile'. -if exists dircolors; then -    eval $(dircolors -b) -fi - - -# vim: set ts=8 sw=4 tw=0 fenc=utf-8 ft=zsh: # | 
