about summary refs log tree commit diff
path: root/zsh/.zsh.d
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--zsh/.zsh.d/00_terminfo.zsh16
-rw-r--r--zsh/.zsh.d/10_options.zsh17
-rw-r--r--zsh/.zsh.d/20_history.zsh20
-rw-r--r--zsh/.zsh.d/30_completion.zsh77
-rw-r--r--zsh/.zsh.d/40_keybindings.zsh3
-rw-r--r--zsh/.zsh.d/50_colors.zsh3
-rw-r--r--zsh/.zsh.d/60_prompt.zsh6
-rw-r--r--zsh/.zsh.d/80_plugins.zsh32
-rw-r--r--zsh/.zsh.d/90_external.zsh6
9 files changed, 180 insertions, 0 deletions
diff --git a/zsh/.zsh.d/00_terminfo.zsh b/zsh/.zsh.d/00_terminfo.zsh
new file mode 100644
index 0000000..5f15f4a
--- /dev/null
+++ b/zsh/.zsh.d/00_terminfo.zsh
@@ -0,0 +1,16 @@
+#!/usr/bin/env zsh
+
+if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} ))
+then
+    function zle-line-init ()
+    {
+        echoti smkx
+    }
+    zle -N zle-line-init
+
+    function zle-line-finish ()
+    {
+        echoti rmkx
+    }
+    zle -N zle-line-finish
+fi
diff --git a/zsh/.zsh.d/10_options.zsh b/zsh/.zsh.d/10_options.zsh
new file mode 100644
index 0000000..785ccb8
--- /dev/null
+++ b/zsh/.zsh.d/10_options.zsh
@@ -0,0 +1,17 @@
+#!/usr/bin/env zsh
+
+setopt CLOBBER
+setopt GLOB_DOTS
+setopt INTERACTIVE_COMMENTS
+setopt LONG_LIST_JOBS
+setopt MAGIC_EQUAL_SUBST
+setopt NOTIFY
+setopt PROMPT_SUBST
+setopt PUSHD_IGNORE_DUPS
+setopt PUSHD_SILENT
+setopt PUSHD_TO_HOME
+setopt RC_QUOTES
+unsetopt BEEP
+unsetopt BG_NICE
+unsetopt CHECK_JOBS
+unsetopt CORRECT_ALL
diff --git a/zsh/.zsh.d/20_history.zsh b/zsh/.zsh.d/20_history.zsh
new file mode 100644
index 0000000..d1931f3
--- /dev/null
+++ b/zsh/.zsh.d/20_history.zsh
@@ -0,0 +1,20 @@
+#!/usr/bin/env zsh
+
+[ "${HISTFILE: -4}" != "_zsh" ] && export HISTFILE="${HISTFILE}_zsh"
+export SAVEHIST="${HISTSIZE}"
+
+setopt APPEND_HISTORY
+setopt BANG_HIST
+setopt EXTENDED_HISTORY
+setopt HIST_EXPIRE_DUPS_FIRST
+setopt HIST_IGNORE_ALL_DUPS
+setopt HIST_IGNORE_DUPS
+setopt HIST_IGNORE_SPACE
+setopt HIST_REDUCE_BLANKS
+setopt HIST_SAVE_NO_DUPS
+setopt HIST_VERIFY
+setopt INC_APPEND_HISTORY
+setopt SHARE_HISTORY
+unsetopt HIST_BEEP
+
+export HISTIGNORE="ls:cd:cd -:pwd:exit:date:cal:* --help"
diff --git a/zsh/.zsh.d/30_completion.zsh b/zsh/.zsh.d/30_completion.zsh
new file mode 100644
index 0000000..bd720d1
--- /dev/null
+++ b/zsh/.zsh.d/30_completion.zsh
@@ -0,0 +1,77 @@
+#!/usr/bin/env zsh
+
+autoload -Uz compinit
+if [[ -s ${ZCOMPDUMP}(#qN.mh+12) && ( ! -s "${ZCOMPDUMP}.zwc" || "${ZCOMPDUMP}" -nt "${ZCOMPDUMP}.zwc" ) ]]
+then
+    compinit -d "${ZCOMPDUMP}"
+    zrecompile -pq "${ZCOMPDUMP}"
+else
+    compinit -d "${ZCOMPDUMP}" -C
+fi
+
+setopt AUTO_LIST
+setopt AUTO_MENU
+setopt AUTO_PARAM_KEYS
+setopt AUTO_PARAM_SLASH
+setopt COMPLETE_IN_WORD
+setopt EXTENDED_GLOB
+setopt HASH_LIST_ALL
+setopt LIST_PACKED
+setopt PATH_DIRS
+unsetopt CASE_GLOB
+unsetopt FLOW_CONTROL
+unsetopt MENU_COMPLETE
+
+zstyle ':completion:*' use-cache                on
+zstyle ':completion:*' cache-path               "${XDG_CACHE_HOME:-$HOME}/.zcompcache"
+
+zstyle ':completion:*'                          format '%F{blue}%d%f'
+zstyle ':completion:*:corrections'              format '%F{yellow}%d (errors: %e)%f'
+zstyle ':completion:*:descriptions'             format '%F{green}%d%f'
+zstyle ':completion:*:messages'                 format '%F{purple}%d%f'
+zstyle ':completion:*:warnings'                 format '%F{red}no matches found%f'
+
+zstyle ':completion:*:*:*:*:*'                  menu select
+zstyle ':completion:*:matches'                  group 'yes'
+zstyle ':completion:*:options'                  description 'yes'
+zstyle ':completion:*:options'                  auto-description '%d'
+zstyle ':completion:*:corrections'              format ' %F{green}-- %d (errors: %e) --%f'
+zstyle ':completion:*:descriptions'             format ' %F{yellow}-- %d --%f'
+zstyle ':completion:*:messages'                 format ' %F{purple} -- %d --%f'
+zstyle ':completion:*:warnings'                 format ' %F{red}-- no matches found --%f'
+zstyle ':completion:*:default'                  list-prompt '%S%M matches%s'
+zstyle ':completion:*'                          format ' %F{yellow}-- %d --%f'
+zstyle ':completion:*'                          group-name ''
+zstyle ':completion:*'                          verbose yes
+zstyle ':completion:*'                          matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|=*' 'l:|=* r:|=*'
+
+zstyle ':completion:*'                          squeeze-slashes true
+zstyle ':completion:*:default'                  list-colors ${(s.:.)LS_COLORS}
+zstyle ':completion:*:*:cd:*'                   tag-order local-directories directory-stack path-directories
+zstyle ':completion:*:*:cd:*:directory-stack'   menu yes select
+zstyle ':completion:*:-tilde-:*'                group-order 'named-directories' 'path-directories' 'users' 'expand'
+
+zstyle ':completion:*'                          completer _complete _match _approximate
+zstyle ':completion:*:match:*'                  original only
+zstyle ':completion:*:approximate:*'            max-errors 1 numeric
+
+zstyle ':completion:*:functions'                ignored-patterns '(_*|pre(cmd|exec))'
+
+zstyle ':completion:*:history-words'            stop yes
+zstyle ':completion:*:history-words'            remove-all-dups yes
+zstyle ':completion:*:history-words'            list false
+zstyle ':completion:*:history-words'            menu yes
+
+zstyle ':completion::*:(-command-|export):*'    fake-parameters ${${${_comps[(I)-value-*]#*,}%%,*}:#-*-}
+
+zstyle ':completion:*:(rm|kill|diff):*'         ignore-line other
+zstyle ':completion:*:rm:*'                     file-patterns '*:all-files'
+
+zstyle ':completion:*:*:*:*:processes'          command 'ps -u ${LOGNAME} -o pid,user,command -w'
+zstyle ':completion:*:*:kill:*:processes'       list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;36=0=01'
+zstyle ':completion:*:*:kill:*'                 menu yes select
+zstyle ':completion:*:*:kill:*'                 force-list always
+zstyle ':completion:*:*:kill:*'                 insert-ids single
+
+zstyle ':completion:*:manuals'                  separate-sections true
+zstyle ':completion:*:manuals.(^1*)'            insert-sections true
diff --git a/zsh/.zsh.d/40_keybindings.zsh b/zsh/.zsh.d/40_keybindings.zsh
new file mode 100644
index 0000000..1be223d
--- /dev/null
+++ b/zsh/.zsh.d/40_keybindings.zsh
@@ -0,0 +1,3 @@
+#!/usr/bin/env zsh
+
+bindkey '^[[Z'  reverse-menu-complete   # M-TAB
diff --git a/zsh/.zsh.d/50_colors.zsh b/zsh/.zsh.d/50_colors.zsh
new file mode 100644
index 0000000..bc122a6
--- /dev/null
+++ b/zsh/.zsh.d/50_colors.zsh
@@ -0,0 +1,3 @@
+#!/usr/bin/env zsh
+
+autoload -U colors && colors
diff --git a/zsh/.zsh.d/60_prompt.zsh b/zsh/.zsh.d/60_prompt.zsh
new file mode 100644
index 0000000..4b07a2c
--- /dev/null
+++ b/zsh/.zsh.d/60_prompt.zsh
@@ -0,0 +1,6 @@
+#!/usr/bin/env zsh
+
+precmd ()
+{
+    PROMPT="%{$fg[green]%}%~%{$reset_color%} %{$fg_bold[green]%}λ%{$reset_color%} "
+}
diff --git a/zsh/.zsh.d/80_plugins.zsh b/zsh/.zsh.d/80_plugins.zsh
new file mode 100644
index 0000000..dbabba3
--- /dev/null
+++ b/zsh/.zsh.d/80_plugins.zsh
@@ -0,0 +1,32 @@
+#!/usr/bin/env zsh
+
+if [ "${TERM}" != "linux" ]
+then
+    ZGENOM_DIR="${HOME}/.zsh.d/zgenom"
+
+    if [ ! -d "${ZGENOM_DIR}" ]
+    then
+        git clone "https://github.com/jandamm/zgenom.git" "${ZGENOM_DIR}"
+    fi
+
+    source "${ZGENOM_DIR}/zgenom.zsh"
+    if ! zgen saved
+    then
+        zgenom load hlissner/zsh-autopair
+
+        zgenom load zsh-users/zsh-autosuggestions
+
+        zgenom load zsh-users/zsh-history-substring-search
+
+        zgenom load zsh-users/zsh-syntax-highlighting
+
+        zgenom load zsh-users/zsh-completions
+
+        zgenom load jeffreytse/zsh-vi-mode
+
+        zgenom save
+    fi
+
+    # zsh-users/zsh-autosuggestions
+    bindkey '^ ' autosuggest-accept
+fi
diff --git a/zsh/.zsh.d/90_external.zsh b/zsh/.zsh.d/90_external.zsh
new file mode 100644
index 0000000..bc79027
--- /dev/null
+++ b/zsh/.zsh.d/90_external.zsh
@@ -0,0 +1,6 @@
+#!/usr/bin/env zsh
+
+# https://github.com/garabik/grc {{{
+[[ -s "/usr/share/grc/grc.zsh" ]] && \
+    source /usr/share/grc/grc.zsh
+# }}}

Consider giving Nix/NixOS a try! <3