From daf61275db5807c4de3248ac21983c5028d12cda Mon Sep 17 00:00:00 2001 From: Uko Kokņevičs Date: Sat, 2 Aug 2025 07:03:12 +0300 Subject: Remove prezto, rewrite stuff myself --- zsh/.config/zsh/.zlogin | 1 - zsh/.config/zsh/.zlogout | 1 - zsh/.config/zsh/.zprezto | 1 - zsh/.config/zsh/.zpreztorc | 253 -------------------------------- zsh/.config/zsh/.zprofile | 1 - zsh/.config/zsh/.zshenv | 8 +- zsh/.config/zsh/.zshrc | 31 +++- zsh/.config/zsh/aliases.zsh | 28 ++++ zsh/.config/zsh/bracketed-paste.zsh | 12 ++ zsh/.config/zsh/colors.zsh | 48 ++++++ zsh/.config/zsh/completions.zsh | 112 ++++++++++++++ zsh/.config/zsh/help.zsh | 6 + zsh/.config/zsh/history.zsh | 3 + zsh/.config/zsh/keybinds.zsh | 42 ++++++ zsh/.config/zsh/opts.zsh | 146 ++++++++++++++++++ zsh/.config/zsh/p10k | 1 + zsh/.config/zsh/ssh-agent.zsh | 29 ++++ zsh/.config/zsh/termtitle.zsh | 12 ++ zsh/.config/zsh/zsh-autosuggestions | 1 + zsh/.config/zsh/zsh-syntax-highlighting | 1 + zsh/.zshenv | 8 +- 21 files changed, 477 insertions(+), 268 deletions(-) delete mode 120000 zsh/.config/zsh/.zlogin delete mode 120000 zsh/.config/zsh/.zlogout delete mode 160000 zsh/.config/zsh/.zprezto delete mode 100644 zsh/.config/zsh/.zpreztorc delete mode 120000 zsh/.config/zsh/.zprofile mode change 120000 => 100644 zsh/.config/zsh/.zshenv create mode 100644 zsh/.config/zsh/aliases.zsh create mode 100644 zsh/.config/zsh/bracketed-paste.zsh create mode 100644 zsh/.config/zsh/colors.zsh create mode 100644 zsh/.config/zsh/completions.zsh create mode 100644 zsh/.config/zsh/help.zsh create mode 100644 zsh/.config/zsh/history.zsh create mode 100644 zsh/.config/zsh/keybinds.zsh create mode 100644 zsh/.config/zsh/opts.zsh create mode 160000 zsh/.config/zsh/p10k create mode 100644 zsh/.config/zsh/ssh-agent.zsh create mode 100644 zsh/.config/zsh/termtitle.zsh create mode 160000 zsh/.config/zsh/zsh-autosuggestions create mode 160000 zsh/.config/zsh/zsh-syntax-highlighting mode change 100644 => 120000 zsh/.zshenv (limited to 'zsh') diff --git a/zsh/.config/zsh/.zlogin b/zsh/.config/zsh/.zlogin deleted file mode 120000 index 5765ab0..0000000 --- a/zsh/.config/zsh/.zlogin +++ /dev/null @@ -1 +0,0 @@ -.zprezto/runcoms/zlogin \ No newline at end of file diff --git a/zsh/.config/zsh/.zlogout b/zsh/.config/zsh/.zlogout deleted file mode 120000 index 8f76c74..0000000 --- a/zsh/.config/zsh/.zlogout +++ /dev/null @@ -1 +0,0 @@ -.zprezto/runcoms/zlogout \ No newline at end of file diff --git a/zsh/.config/zsh/.zprezto b/zsh/.config/zsh/.zprezto deleted file mode 160000 index 6e56450..0000000 --- a/zsh/.config/zsh/.zprezto +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 6e564503f1c5e6ddba2bcf5d9065e5872ca207d2 diff --git a/zsh/.config/zsh/.zpreztorc b/zsh/.config/zsh/.zpreztorc deleted file mode 100644 index 294a989..0000000 --- a/zsh/.config/zsh/.zpreztorc +++ /dev/null @@ -1,253 +0,0 @@ -# -*- sh -*- - -# Set case-sensitivity for completion, history lookup, etc. -zstyle ':prezto:*:*' case-sensitive 'no' - -# Color output (auto set to 'no' on dumb terminals). -zstyle ':prezto:*:*' color 'yes' - -# Add additional directories to load prezto modules from -# zstyle ':prezto:load' pmodule-dirs $HOME/.zprezto-contrib - -# Allow module overrides when pmodule-dirs causes module name collisions -# zstyle ':prezto:load' pmodule-allow-overrides 'yes' - -# Set the Zsh modules to load (man zshmodules). -# zstyle ':prezto:load' zmodule 'attr' 'stat' - -# Set the Zsh functions to load (man zshcontrib). -# zstyle ':prezto:load' zfunction 'zargs' 'zmv' - -# Set the Prezto modules to load (browse modules). -# The order matters. -zstyle ':prezto:load' pmodule \ - 'environment' \ - 'terminal' \ - 'editor' \ - 'history' \ - 'spectrum' \ - 'utility' \ - 'prompt' \ - \ - 'syntax-highlighting' \ - 'autosuggestions' \ - \ - 'git' \ - 'rsync' \ - 'ssh' \ - \ - 'completion' - -# -# Autosuggestions -# - -# Set the query found color. -# zstyle ':prezto:module:autosuggestions:color' found '' - -# -# Completions -# - -# Set the entries to ignore in static '/etc/hosts' for host completion. -# zstyle ':prezto:module:completion:*:hosts' etc-host-ignores \ -# '0.0.0.0' '127.0.0.1' - -# -# Editor -# - -# Set the characters that are considered to be part of a word. -# zstyle ':prezto:module:editor' wordchars '*?_-.[]~&;!#$%^(){}<>' - -# Set the key mapping style to 'emacs' or 'vi'. -zstyle ':prezto:module:editor' key-bindings 'emacs' - -# Auto convert .... to ../.. -zstyle ':prezto:module:editor' dot-expansion 'yes' - -# Allow the zsh prompt context to be shown. -#zstyle ':prezto:module:editor' ps-context 'yes' - -# -# Git -# - -# Ignore submodules when they are 'dirty', 'untracked', 'all', or 'none'. -zstyle ':prezto:module:git:status:ignore' submodules 'none' - -# -# GNU Utility -# - -# Set the command prefix on non-GNU systems. -# zstyle ':prezto:module:gnu-utility' prefix 'g' - -# -# History -# - -# Set the file to save the history in when an interactive shell exits. -zstyle ':prezto:module:history' histfile "${ZDOTDIR:-$HOME}/.zsh_history" - -# Set the maximum number of events stored in the internal history list. -zstyle ':prezto:module:history' histsize 10000 - -# Set the maximum number of history events to save in the history file. -zstyle ':prezto:module:history' savehist 10000 - -# -# History Substring Search -# - -# Set the query found color. -# zstyle ':prezto:module:history-substring-search:color' found '' - -# Set the query not found color. -# zstyle ':prezto:module:history-substring-search:color' not-found '' - -# Set the search globbing flags. -# zstyle ':prezto:module:history-substring-search' globbing-flags '' - -# Enable search case-sensitivity. -zstyle ':prezto:module:history-substring-search' case-sensitive 'no' - -# Enable search for fuzzy matches. -zstyle ':prezto:module:history-substring-search' fuzzy 'yes' - -# Enable search uniqueness. -# zstyle ':prezto:module:history-substring-search' unique 'yes' - -# Enable prefixed search. -# zstyle ':prezto:module:history-substring-search' prefixed 'yes' - -# -# macOS -# - -# Set the keyword used by `mand` to open man pages in Dash.app -# zstyle ':prezto:module:osx:man' dash-keyword 'manpages' - -# -# Pacman -# - -# Set the Pacman frontend. -# zstyle ':prezto:module:pacman' frontend 'yaourt' - -# -# Prompt -# - -# Set the prompt theme to load. -# Setting it to 'random' loads a random theme. -# Auto set to 'off' on dumb terminals. -zstyle ':prezto:module:prompt' theme 'powerlevel10k' - -# Set the working directory prompt display length. -# By default, it is set to 'short'. Set it to 'long' (without '~' expansion) -# for longer or 'full' (with '~' expansion) for even longer prompt display. -zstyle ':prezto:module:prompt' pwd-length 'short' - -# Set the prompt to display the return code along with an indicator for non-zero -# return codes. This is not supported by all prompts. -zstyle ':prezto:module:prompt' show-return-val 'yes' - -# -# Python -# - -# Auto switch the Python virtualenv on directory change. -zstyle ':prezto:module:python:virtualenv' auto-switch 'yes' - -# Automatically initialize virtualenvwrapper if pre-requisites are met. -zstyle ':prezto:module:python:virtualenv' initialize 'yes' - -# -# Ruby -# - -# Auto switch the Ruby version on directory change. -zstyle ':prezto:module:ruby:chruby' auto-switch 'yes' - -# -# Screen -# - -# Auto start a session when Zsh is launched in a local terminal. -# zstyle ':prezto:module:screen:auto-start' local 'yes' - -# Auto start a session when Zsh is launched in a SSH connection. -# zstyle ':prezto:module:screen:auto-start' remote 'yes' - -# -# SSH -# - -# Set the SSH identities to load into the agent. -# zstyle ':prezto:module:ssh:load' identities 'id_rsa' 'id_rsa2' 'id_github' - -# -# Syntax Highlighting -# - -# Set syntax highlighters. -# By default, only the main highlighter is enabled. -zstyle ':prezto:module:syntax-highlighting' highlighters \ - 'main' \ - 'brackets' \ - 'pattern' \ - 'line' \ - 'cursor' \ - 'root' - -# Set syntax highlighting styles. -# zstyle ':prezto:module:syntax-highlighting' styles \ -# 'builtin' 'bg=blue' \ -# 'command' 'bg=blue' \ -# 'function' 'bg=blue' -# -# Set syntax pattern styles. -# zstyle ':prezto:module:syntax-highlighting' pattern \ -# 'rm*-rf*' 'fg=white,bold,bg=red' - -# -# Terminal -# - -# Auto set the tab and window titles. -zstyle ':prezto:module:terminal' auto-title 'yes' - -# Set the window title format. -# zstyle ':prezto:module:terminal:window-title' format '%n@%m: %s' - -# Set the tab title format. -# zstyle ':prezto:module:terminal:tab-title' format '%m: %s' - -# Set the terminal multiplexer title format. -# zstyle ':prezto:module:terminal:multiplexer-title' format '%s' - -# -# Tmux -# - -# Auto start a session when Zsh is launched in a local terminal. -# zstyle ':prezto:module:tmux:auto-start' local 'yes' - -# Auto start a session when Zsh is launched in a SSH connection. -# zstyle ':prezto:module:tmux:auto-start' remote 'yes' - -# Integrate with iTerm2. -# zstyle ':prezto:module:tmux:iterm' integrate 'yes' - -# Set the default session name: -# zstyle ':prezto:module:tmux:session' name 'YOUR DEFAULT SESSION NAME' - -# -# Utility -# - -# Enabled safe options. This aliases cp, ln, mv and rm so that they prompt -# before deleting or overwriting files. Set to 'no' to disable this safer -# behavior. -zstyle ':prezto:module:utility' safe-ops 'yes' diff --git a/zsh/.config/zsh/.zprofile b/zsh/.config/zsh/.zprofile deleted file mode 120000 index b085555..0000000 --- a/zsh/.config/zsh/.zprofile +++ /dev/null @@ -1 +0,0 @@ -.zprezto/runcoms/zprofile \ No newline at end of file diff --git a/zsh/.config/zsh/.zshenv b/zsh/.config/zsh/.zshenv deleted file mode 120000 index 2ffffef..0000000 --- a/zsh/.config/zsh/.zshenv +++ /dev/null @@ -1 +0,0 @@ -.zprezto/runcoms/zshenv \ No newline at end of file diff --git a/zsh/.config/zsh/.zshenv b/zsh/.config/zsh/.zshenv new file mode 100644 index 0000000..0a89f85 --- /dev/null +++ b/zsh/.config/zsh/.zshenv @@ -0,0 +1,7 @@ +__CONF_DIR="${XDG_CONFIG_HOME:-$HOME/.config}" + +setopt ALL_EXPORT +for f in $(echo "$__CONF_DIR"/environment.d/*.conf | sort); do + source "$f" +done +unsetopt ALL_EXPORT diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc index 81e9c2e..7845b6f 100644 --- a/zsh/.config/zsh/.zshrc +++ b/zsh/.config/zsh/.zshrc @@ -5,7 +5,32 @@ if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]] source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" fi -# Source Prezto -source ~/.config/zsh/.zprezto/runcoms/zshrc +if [ -x "/home/linuxbrew/.linuxbrew/bin/brew" ]; then + eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv zsh)" +elif [ -x "/opt/homebrew/bin/brew" ]; then + eval "$(/opt/homebrew/bin/brew shellenv zsh)" +fi + +source ~/.config/zsh/opts.zsh + +source ~/.config/zsh/aliases.zsh +source ~/.config/zsh/bracketed-paste.zsh +source ~/.config/zsh/colors.zsh +source ~/.config/zsh/help.zsh +source ~/.config/zsh/history.zsh +source ~/.config/zsh/keybinds.zsh +source ~/.config/zsh/ssh-agent.zsh +source ~/.config/zsh/termtitle.zsh + +source ~/.config/zsh/completions.zsh # Depends on colors.zsh + +# External stuffs :) + +source ~/.config/zsh/p10k/powerlevel10k.zsh-theme +source ~/.config/zsh/.p10k.zsh # Local configuration + +source ~/.config/zsh/zsh-autosuggestions/zsh-autosuggestions.zsh -source ~/.config/zsh/.p10k.zsh +# This should be the last thing sourced in the file: +source ~/.config/zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh +ZSH_HIGHLIGHT_HIGHLIGHTERS+=(main brackets) diff --git a/zsh/.config/zsh/aliases.zsh b/zsh/.config/zsh/aliases.zsh new file mode 100644 index 0000000..c0c7f79 --- /dev/null +++ b/zsh/.config/zsh/aliases.zsh @@ -0,0 +1,28 @@ +# Disable correction. +alias ack='nocorrect ack' +alias cd='nocorrect cd' +alias ebuild='nocorrect ebuild' +alias gcc='nocorrect gcc' +alias gist='nocorrect gist' +alias heroku='nocorrect heroku' +alias man='nocorrect man' +alias mkdir='nocorrect mkdir' +alias mysql='nocorrect mysql' + +# Disable globbing. +alias bower='noglob bower' +alias fc='noglob fc' +alias find='noglob find' +alias ftp='noglob ftp' +alias history='noglob history' +alias locate='noglob locate' +alias rake='noglob rake' +alias rsync='noglob rsync' +alias scp='noglob scp' +alias sftp='noglob sftp' + +# Safe ops +alias cp="nocorrect cp -i" +alias ln="nocorrect ln -i" +alias mv="nocorrect mv -i" +alias rm="nocorrect rm -i" diff --git a/zsh/.config/zsh/bracketed-paste.zsh b/zsh/.config/zsh/bracketed-paste.zsh new file mode 100644 index 0000000..a6bcdd3 --- /dev/null +++ b/zsh/.config/zsh/bracketed-paste.zsh @@ -0,0 +1,12 @@ +autoload -Uz is-at-least +if [[ "$ZSH_VERSION" != 5.1.1 && "$TERM" != dumb ]]; then + if is-at-least 5.2; then + autoload -Uz bracketed-paste-url-magic + zle -N bracketed-paste bracketed-paste-url-magic + elif is-at-least 5.1; then + autoload -Uz bracketed-paste-magic + zle -N bracketed-paste bracketed-paste-magic + fi + autoload -Uz url-quote-magic + zle -N self-insert url-quote-magic +fi diff --git a/zsh/.config/zsh/colors.zsh b/zsh/.config/zsh/colors.zsh new file mode 100644 index 0000000..05645c8 --- /dev/null +++ b/zsh/.config/zsh/colors.zsh @@ -0,0 +1,48 @@ +# +## grep +# + +if (( ! $+GREP_COLOR )); then + export GREP_COLOR="37;45" +fi +if (( ! $+GREP_COLORS )); then + export GREP_COLORS="mt=$GREP_COLOR" +fi + +alias grep="nocorrect ${aliases[grep]:-grep} --color=auto" + +# +## less +# + +export LESS_TERMCAP_mb="$terminfo[blink]" +export LESS_TERMCAP_md="$terminfo[bold]" +export LESS_TERMCAP_me="$terminfo[sgr0]" + +export LESS_TERMCAP_so="$terminfo[smso]" +export LESS_TERMCAP_se="$terminfo[rmso]" + +export LESS_TERMCAP_us="$terminfo[smul]" +export LESS_TERMCAP_ue="$terminfo[rmul]" + +# +## ls +# + +if (( ! $+LS_COLORS )); then + if is-callable "dircolors"; then + eval "$(dircolors --sh)" + else + export LS_COLORS='rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=00:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.7z=01;31:*.ace=01;31:*.alz=01;31:*.apk=01;31:*.arc=01;31:*.arj=01;31:*.bz=01;31:*.bz2=01;31:*.cab=01;31:*.cpio=01;31:*.crate=01;31:*.deb=01;31:*.drpm=01;31:*.dwm=01;31:*.dz=01;31:*.ear=01;31:*.egg=01;31:*.esd=01;31:*.gz=01;31:*.jar=01;31:*.lha=01;31:*.lrz=01;31:*.lz=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.lzo=01;31:*.pyz=01;31:*.rar=01;31:*.rpm=01;31:*.rz=01;31:*.sar=01;31:*.swm=01;31:*.t7z=01;31:*.tar=01;31:*.taz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tgz=01;31:*.tlz=01;31:*.txz=01;31:*.tz=01;31:*.tzo=01;31:*.tzst=01;31:*.udeb=01;31:*.war=01;31:*.whl=01;31:*.wim=01;31:*.xz=01;31:*.z=01;31:*.zip=01;31:*.zoo=01;31:*.zst=01;31:*.avif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:*~=00;90:*#=00;90:*.bak=00;90:*.crdownload=00;90:*.dpkg-dist=00;90:*.dpkg-new=00;90:*.dpkg-old=00;90:*.dpkg-tmp=00;90:*.old=00;90:*.orig=00;90:*.part=00;90:*.rej=00;90:*.rpmnew=00;90:*.rpmorig=00;90:*.rpmsave=00;90:*.swp=00;90:*.tmp=00;90:*.ucf-dist=00;90:*.ucf-new=00;90:*.ucf-old=00;90:' + fi +fi + +if (( ! $+LSCOLORS )); then + export LSCOLORS="exfxcxdxbxGxDxabagacad" +fi + +if [[ ${(@M)${(f)"$(ls --version 2>&1)"}:#*(GNU|lsd) *} ]]; then + alias ls="${aliases[ls]:-ls} --group-directories-first --color=auto" +else + alias ls="${aliases[ls]:-ls} -G" +fi diff --git a/zsh/.config/zsh/completions.zsh b/zsh/.config/zsh/completions.zsh new file mode 100644 index 0000000..c9d7993 --- /dev/null +++ b/zsh/.config/zsh/completions.zsh @@ -0,0 +1,112 @@ + +autoload -Uz compinit +_comp_path="${XDG_CACHE_HOME:-$HOME/.cache}/zsh/zcompdump" +if [[ $_comp_path(#qNmh-20) ]]; then + compinit -C -d "$_comp_path" +else + mkdir -p "$_comp_path:h" + compinit -i -d "$_comp_path" +fi +unset _comp_path + +# Defaults. +zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS} +zstyle ':completion:*:default' list-prompt '%S%M matches%s' + +# Use caching to make completion for commands such as dpkg and apt usable. +zstyle ':completion::complete:*' use-cache on +zstyle ':completion::complete:*' cache-path "${XDG_CACHE_HOME:-$HOME/.cache}/zsh/zcompcache" + +# Case insensitivity +zstyle ':completion:*' matcher-list 'm:{[:lower:]}={[:upper:]}' 'm:{[:upper:]}={[:lower:]}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*' + +# Group matches and describe +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:*' format ' %F{yellow}-- %d --%f' +zstyle ':completion:*' group-name '' +zstyle ':completion:*' verbose yes + +# Fuzzy match mistyped completions +zstyle ':completion:*' completer _complete _match _approximate +zstyle ':completion:*:match:*' original only +zstyle ':completion:*:approximate:*' max-errors 2 numeric + +# Don't complete unavailable commands +zstyle ':completion:*:functions' ignored-patterns '(_*|pre(cmd|exec))' + +# Array completion element sorting +zstyle ':completion:*:*:-subscript-:*' tag-order indexes parameters + +# Directories +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:*' squeeze-slashes true + +# History +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 + +# Environment Variables +zstyle ':completion::*:(-command-|export):*' fake-parameters ${${${_comps[(I)-value-*]#*,}%%,*}:#-*-} + +# Populate hostname completion. But allow ignoring custom entries from static +# */etc/hosts* which might be uninteresting. +zstyle -a ':prezto:module:completion:*:hosts' etc-host-ignores '_etc_host_ignores' + +zstyle -e ':completion:*:hosts' hosts 'reply=( + ${=${=${=${${(f)"$(cat {/etc/ssh/ssh_,~/.ssh/}known_hosts(|2)(N) 2> /dev/null)"}%%[#| ]*}//\]:[0-9]*/ }//,/ }//\[/ } + ${=${(f)"$(cat /etc/hosts(|)(N) <<(ypcat hosts 2> /dev/null))"}%%(\#${_etc_host_ignores:+|${(j:|:)~_etc_host_ignores}})*} + ${=${${${${(@M)${(f)"$(cat ~/.ssh/config 2> /dev/null)"}:#Host *}#Host }:#*\**}:#*\?*}} +)' + +# Don't complete uninteresting users... +zstyle ':completion:*:*:*:users' ignored-patterns \ + adm amanda apache avahi beaglidx bin cacti canna clamav daemon \ + dbus distcache dovecot fax ftp games gdm gkrellmd gopher \ + hacluster haldaemon halt hsqldb ident junkbust ldap lp mail \ + mailman mailnull mldonkey mysql nagios \ + named netdump news nfsnobody nobody nscd ntp nut nx openvpn \ + operator pcap postfix postgres privoxy pulse pvm quagga radvd \ + rpc rpcuser rpm shutdown squid sshd sync uucp vcsa xfs '_*' + +# ... unless we really want to. +zstyle '*' single-ignored show + +# Ignore multiple entries. +zstyle ':completion:*:(rm|kill|diff):*' ignore-line other +zstyle ':completion:*:rm:*' file-patterns '*:all-files' + +# Kill +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 + +# Man +zstyle ':completion:*:manuals' separate-sections true +zstyle ':completion:*:manuals.(^1*)' insert-sections true + +# Media Players +zstyle ':completion:*:*:mpg123:*' file-patterns '*.(mp3|MP3):mp3\ files *(-/):directories' +zstyle ':completion:*:*:mpg321:*' file-patterns '*.(mp3|MP3):mp3\ files *(-/):directories' +zstyle ':completion:*:*:ogg123:*' file-patterns '*.(ogg|OGG|flac):ogg\ files *(-/):directories' +zstyle ':completion:*:*:mocp:*' file-patterns '*.(wav|WAV|mp3|MP3|ogg|OGG|flac):ogg\ files *(-/):directories' + +# SSH/SCP/RSYNC +zstyle ':completion:*:(ssh|scp|rsync):*' tag-order 'hosts:-host:host hosts:-domain:domain hosts:-ipaddr:ip\ address *' +zstyle ':completion:*:(scp|rsync):*' group-order users files all-files hosts-domain hosts-host hosts-ipaddr +zstyle ':completion:*:ssh:*' group-order users hosts-domain hosts-host users hosts-ipaddr +zstyle ':completion:*:(ssh|scp|rsync):*:hosts-host' ignored-patterns '*(.|:)*' loopback ip6-loopback localhost ip6-localhost broadcasthost +zstyle ':completion:*:(ssh|scp|rsync):*:hosts-domain' ignored-patterns '<->.<->.<->.<->' '^[-[:alnum:]]##(.[-[:alnum:]]##)##' '*@*' +zstyle ':completion:*:(ssh|scp|rsync):*:hosts-ipaddr' ignored-patterns '^(<->.<->.<->.<->|(|::)([[:xdigit:].]##:(#c,2))##(|%*))' '127.0.0.<->' '255.255.255.255' '::1' 'fe80::*' diff --git a/zsh/.config/zsh/help.zsh b/zsh/.config/zsh/help.zsh new file mode 100644 index 0000000..9ad4aa6 --- /dev/null +++ b/zsh/.config/zsh/help.zsh @@ -0,0 +1,6 @@ +# Type in a command and press M-h :) + +if (( $+aliases[run-help] )); then + unalias run-help +fi +autoload -Uz run-help run-help-{btrfs,git,ip,openssl,p4,sudo,svk,svn} diff --git a/zsh/.config/zsh/history.zsh b/zsh/.config/zsh/history.zsh new file mode 100644 index 0000000..79e2159 --- /dev/null +++ b/zsh/.config/zsh/history.zsh @@ -0,0 +1,3 @@ +HISTFILE="${HISTFILE:-$HOME/.config/zsh/.zsh_history}" +HISTSIZE=20000 +SAVEHIST=10000 diff --git a/zsh/.config/zsh/keybinds.zsh b/zsh/.config/zsh/keybinds.zsh new file mode 100644 index 0000000..d9b64f5 --- /dev/null +++ b/zsh/.config/zsh/keybinds.zsh @@ -0,0 +1,42 @@ +bindkey -e + +K_UP="$terminfo[kcuu1]" +K_LEFT="$terminfo[kcub1]" +K_C_LEFT=('\e[1;5D' '\e[5D' '\eOd') +K_M_LEFT=('\e[1;3D' '\e[3D' '\e\e[D') +K_DOWN="$terminfo[kcud1]" +K_RIGHT="$terminfo[kcuf1]" +K_C_RIGHT=('\e[1;5C' '\e[5C' '\eOc') +K_M_RIGHT=('\e[1;3C' '\e[3C' '\e\e[C') + +K_BACKSPACE="$terminfo[kbs]" +K_HOME="$terminfo[khome]" +K_END="$terminfo[kend]" +K_INSERT="$terminfo[kich1]" +K_DELETE="$terminfo[kdch1]" +K_PAGEUP="$terminfo[kpp]" +K_PAGEDN="$terminfo[knp]" + +for key in '\M-b' '\M-B' "${(@)K_C_LEFT}" "${(@)K_M_LEFT}" '\e'"$K_LEFT"; do + bindkey "$key" emacs-backward-word +done + +for key in '\M-f' '\M-F' "${(@)K_C_RIGHT}" "${(@)K_M_RIGHT}" '\e'"$K_RIGHT"; do + bindkey "$key" emacs-forward-word +done + +if (( $+widgets[history-incremental-pattern-search-backward] )); then + bindkey '\C-r' history-incremental-pattern-search-backward + bindkey '\C-s' history-incremental-pattern-search-forward +fi + +bindkey '\e;' pound-insert + +bindkey "$K_HOME" beginning-of-line +bindkey "$K_END" end-of-line + +bindkey "$K_INSERT" overwrite-mode +bindkey "$K_DELETE" delete-char +bindkey "$K_BACKSPACE" backward-delete-char + +bindkey " " magic-space diff --git a/zsh/.config/zsh/opts.zsh b/zsh/.config/zsh/opts.zsh new file mode 100644 index 0000000..71f67c3 --- /dev/null +++ b/zsh/.config/zsh/opts.zsh @@ -0,0 +1,146 @@ +# +## Changing Directories +# + +# If a command is issued that can't be executed as a normal command, and the command is the name of a directory, perform +# the cd command to that directory. +setopt AUTO_CD + +# Have pushd with no arguments act like `pushd $HOME'. +setopt PUSHD_TO_HOME + +# +## Completion +# + +# If a completion is performed with the cursor within a word, and a full completion is inserted, the cursor is moved to +# the end of the word. +setopt ALWAYS_TO_END + +# Prevents aliases on the command line from being internally substituted before completion is attempted. +setopt COMPLETE_ALIASES + +# Completion is done from both sides of the word. +setopt COMPLETE_IN_WORD + +# Try to make the completion list smaller (occupying less lines) by printing the matches in columns with different +# widths. +setopt LIST_PACKED + +# +## Expansion and Globbing +# + +# Make globbing insensitive to case. +unsetopt CASE_GLOB + +# Disable =expansion. +unsetopt EQUALS + +# Treat #, ~, and ^ characters as part of patterns in globbing. +setopt EXTENDED_GLOB + +# No need for a leading . in a filename to match +setopt GLOB_DOTS + +# Allow abbreviating **/* to ** and ***/* to ***. +setopt GLOB_STAR_SHORT + +# Any characters resulting from parameter expansion are eligible for filename expansion and generation. +setopt GLOB_SUBST + +# History substitutions use pattern matching instead of string matching. +setopt HIST_SUBST_PATTERN + +# Expand filenames in places like wow=filename after the command. +setopt MAGIC_EQUAL_SUBST + +# Sort numeric filenames numerically. +setopt NUMERIC_GLOB_SORT + +# Expand foo${arr}bar where arr=(1 2 3) as foo1bar foo2bar foo3bar instead of foo1 2 3bar. +setopt RC_EXPAND_PARAM + +# +## History +# + +# Using INC_APPEND_HISTORY_TIME instead. +unsetopt APPEND_HISTORY + +# Print more stuff to the history file. +setopt EXTENDED_HISTORY + +# When running out of space, delete oldest duplicates before unique entries. +setopt HIST_EXPIRE_DUPS_FIRST + +# Use fcntl syscall to lock the history file. +setopt HIST_FCNTL_LOCK + +# When searching history, ignore duplicates already seen. +setopt HIST_FIND_NO_DUPS + +# Do not save duplicates that are right next to each other. +setopt HIST_IGNORE_DUPS + +# Remove superfluous blanks before adding to history. +setopt HIST_REDUCE_BLANKS + +# When using history expansion, don't just immediately execute it, instead expand it inline. +setopt HIST_VERIFY + +# Write to history file like immediately. +setopt INC_APPEND_HISTORY_TIME + +# +## Input/Output +# + +# Attempt to correct command spelling. +setopt CORRECT + +# No C-s or C-q. +unsetopt FLOW_CONTROL + +# Allow comments in interactive mode. +setopt INTERACTIVE_COMMENTS + +# Print a warning if the mail file has been accessed. +setopt MAIL_WARNING + +# Allow '' within single-quote strings to mean a single quote. +setopt RC_QUOTES + +# When running `rm *` or `rm whatever/*` and prompting for confirmation, wait for 10 seconds so that brain starts +# working before entering "yes". +setopt RM_STAR_WAIT + +# +## Job Control +# + +# Auto-send CONT signal to disowned jobs. +setopt AUTO_CONTINUE + +# Allow something like `ed` to resume a `ed` job in the background. +setopt AUTO_RESUME + +# More verbose job notifications. +setopt LONG_LIST_JOBS + +# Notify about updates in jobs only when printing a prompt. +unsetopt NOTIFY + +# +## Shell Emulation +# + +# If trying to append to a non-existing file, just create it. +setopt APPEND_CREATE + +# +## Zle +# + +# Assume that terminal deals with combining chars correctly. +setopt COMBINING_CHARS diff --git a/zsh/.config/zsh/p10k b/zsh/.config/zsh/p10k new file mode 160000 index 0000000..36f3045 --- /dev/null +++ b/zsh/.config/zsh/p10k @@ -0,0 +1 @@ +Subproject commit 36f3045d69d1ba402db09d09eb12b42eebe0fa3b diff --git a/zsh/.config/zsh/ssh-agent.zsh b/zsh/.config/zsh/ssh-agent.zsh new file mode 100644 index 0000000..69410be --- /dev/null +++ b/zsh/.config/zsh/ssh-agent.zsh @@ -0,0 +1,29 @@ +if (( ! $+commands[ssh-agent] )); then + return +fi + +_ssh_agent_env="${_ssh_agent_env:-${XDG_CACHE_HOME:-$HOME/.cache}/ssh/ssh-agent.env}" + +_ssh_agent_load() { + [ -f "$_ssh_agent_env" ] && source "$_ssh_agent_env" >/dev/null +} + +_ssh_agent_start() { + ( + umask 077 + mkdir -p "${_ssh_agent_env:h}" + ssh-agent >"$_ssh_agent_env" + ) + source "$_ssh_agent_env" >/dev/null +} + +_ssh_agent_load + +_ssh_agent_state=$(ssh-add -l >/dev/null 2>&1; echo $?) + +if [ ! "$SSH_AUTH_SOCK" ] || [ $_ssh_agent_state = 2 ]; then + _ssh_agent_start + ssh-add +elif [ "$SSH_AUTH_SOCK" ] && [ $_ssh_agent_state = 1 ]; then + ssh-add +fi diff --git a/zsh/.config/zsh/termtitle.zsh b/zsh/.config/zsh/termtitle.zsh new file mode 100644 index 0000000..93ee9a3 --- /dev/null +++ b/zsh/.config/zsh/termtitle.zsh @@ -0,0 +1,12 @@ +# set-titles tab-title window-title +function set-titles { + printf '\e]1;%s\a\e]2;%s\a' "$1" "$2" +} + +function _precmd-title-fn { + local abspath="${${1:a}:-$PWD}" + local abbrev="${abspath/#$HOME/~}" + set-titles "$abbrev" "$abbrev" +} + +autoload -Uz add-zsh-hook && add-zsh-hook precmd _precmd-title-fn diff --git a/zsh/.config/zsh/zsh-autosuggestions b/zsh/.config/zsh/zsh-autosuggestions new file mode 160000 index 0000000..85919cd --- /dev/null +++ b/zsh/.config/zsh/zsh-autosuggestions @@ -0,0 +1 @@ +Subproject commit 85919cd1ffa7d2d5412f6d3fe437ebdbeeec4fc5 diff --git a/zsh/.config/zsh/zsh-syntax-highlighting b/zsh/.config/zsh/zsh-syntax-highlighting new file mode 160000 index 0000000..5eb677b --- /dev/null +++ b/zsh/.config/zsh/zsh-syntax-highlighting @@ -0,0 +1 @@ +Subproject commit 5eb677bb0fa9a3e60f0eff031dc13926e093df92 diff --git a/zsh/.zshenv b/zsh/.zshenv deleted file mode 100644 index 508f665..0000000 --- a/zsh/.zshenv +++ /dev/null @@ -1,7 +0,0 @@ -__CONF_DIR="${XDG_CONFIG_HOME:-$HOME/.config}" - -for f in $(echo "$__CONF_DIR"/environment.d/*.conf | sort); do - source "$f" -done - -source "$ZDOTDIR/.zshenv" diff --git a/zsh/.zshenv b/zsh/.zshenv new file mode 120000 index 0000000..9fbf4d2 --- /dev/null +++ b/zsh/.zshenv @@ -0,0 +1 @@ +.config/zsh/.zshenv \ No newline at end of file -- cgit v1.2.3