zsh: Divide zshrc into zshrc.d
Move every file from plugins into zshrc.d as well as all bigger blobs in the zshrc into their own files there. Some stuff is still in there that I am not all too sure where it belongs. TODO: Move. Because all external plugins are now sourced over a symlink I had to create a fork of fzf-tab for now that supports that. See: https://github.com/Aloxaf/fzf-tab/pull/153
This commit is contained in:
@@ -60,5 +60,14 @@ fi
|
||||
FZF_DEFAULT_COMMAND="find . -name '.git' -prune -o \( -type f -a -print \)"
|
||||
export FZF_DEFAULT_COMMAND
|
||||
|
||||
# Setup LS_COLORS
|
||||
if command -v dircolors &>/dev/null; then
|
||||
if [[ -e "$XDG_CONFIG_HOME"/dircolors/dircolors ]]; then
|
||||
eval "$(dircolors -b "$XDG_CONFIG_HOME"/dircolors/dircolors)"
|
||||
else
|
||||
eval "$(dircolors -b)"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Automatically start X on login after boot.
|
||||
[[ -n $DISPLAY || $XDG_VTNR -ne 1 ]] || exec startx
|
||||
|
||||
@@ -25,98 +25,25 @@ comp-conf() {
|
||||
|
||||
# https://github.com/romkatv/dotfiles-public/blob/7e49fc4fb71d/.zshrc#L47
|
||||
comp-source() {
|
||||
emulate -L zsh
|
||||
[[ -e "$1" ]] && comp-conf "$1" && source -- "$1"
|
||||
}
|
||||
|
||||
## set zshoptions
|
||||
setopt AUTO_CONTINUE # Stopped jobs with 'disown' are automatically sent a CONT signal to make them running.
|
||||
setopt AUTO_LIST # Automatically list choices on an ambiguous completion.
|
||||
setopt AUTO_PARAM_SLASH # Add a trailing slash when completing directories
|
||||
setopt AUTO_PUSHD # Make cd push the old directory onto the directory stack.
|
||||
setopt NO_AUTO_REMOVE_SLASH # Keeps trailing slash for directories when auto completing.
|
||||
# (Beware: commands will act on the target directory not the symlink with the slash)
|
||||
setopt NO_BEEP # Do not beep on error in ZLE.
|
||||
setopt CDABLE_VARS # Expand named directories without leading '~'.
|
||||
setopt C_BASES # Output hexadecimal numbers in the standard C format ('16#FF' -> '0xFF').
|
||||
setopt CHASE_LINKS # Resolve symbolic links to their true values when changing directory.
|
||||
setopt NO_CLOBBER # '>!' or '>|' must be used to truncate a file, and '>>!' or '>>|' to create a file.
|
||||
setopt NO_COMPLETE_ALIASES # Substitute internally before completion.
|
||||
setopt COMPLETE_IN_WORD # Complete from the cursor rather than from the end of the word
|
||||
setopt CORRECT # Try to correct the spelling of a command
|
||||
setopt CORRECT_ALL # Try to correct the spelling of all arguments
|
||||
CORRECT_IGNORE_FILE=".*" # Do not offer hidden files as correction
|
||||
setopt EXTENDED_HISTORY # Save in format : <beginning time>:<elapsed seconds>;<command>
|
||||
setopt EXTENDED_GLOB # Treat the `#', `~' and `^' characters as part of patterns for filename generation, etc.
|
||||
setopt NO_FLOW_CONTROL # Disables output flow control in the shell's editor via start/stop characters (usually ^S/^Q).
|
||||
setopt GLOB_DOTS # Do not require a leading `.' in a filename to be matched explicitly.
|
||||
setopt HIST_IGNORE_DUPS # Do not enter command lines into the history list if they are duplicates of the previous event.
|
||||
setopt HIST_IGNORE_SPACE # History should ignore commands beginning with a space
|
||||
setopt HIST_VERIFY # perform history expansion and reload line in editing buffer instead of executing it directly
|
||||
setopt NO_INC_APPEND_HISTORY # Do not write lines as soon as they are entered (breaks exec time otherwise)
|
||||
setopt INC_APPEND_HISTORY_TIME # Write lines after they are finished
|
||||
setopt INTERACTIVE_COMMENTS # Allow comments even in interactive shells.
|
||||
setopt LIST_AMBIGUOUS # Insert unambiguous prefix without completion list (auto_list set)
|
||||
setopt LIST_PACKED # Make completion list smaller by printing matches in columns with different widths.
|
||||
setopt NO_MENU_COMPLETE # Do not autoselect the first entry when completing
|
||||
setopt PUSHD_IGNORE_DUPS # Don't push multiple copies of the same directory onto the directory stack.
|
||||
setopt NO_SHARE_HISTORY # Do not write + read history after every command (messes up exec time otherwise)
|
||||
setopt SH_WORD_SPLIT # Causes field splitting to be performed on unquoted parameter expansions
|
||||
folder-source() {
|
||||
[[ -d "$1" ]] || return 1
|
||||
|
||||
for f in "$1"/[^._]*(N); do
|
||||
if [[ -d "$f" ]]; then
|
||||
folder-source "$f"
|
||||
elif [[ -n "${f##*.zwc}" ]]; then
|
||||
comp-source "$f"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
folder-source "$ZDOTDIR"/zshrc.d
|
||||
|
||||
autoload -U select-word-style && select-word-style bash
|
||||
|
||||
## Setup the prompt
|
||||
# use bright version of colors when printing bold
|
||||
if command -v dircolors &>/dev/null; then
|
||||
if [[ -e "${XDG_CONFIG_HOME:-$HOME/.config}/dircolors/dircolors" ]]; then
|
||||
eval "$(dircolors -b "${XDG_CONFIG_HOME:-$HOME/.config}/dircolors/dircolors")"
|
||||
else
|
||||
eval "$(dircolors -b)"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -e "$ZSH_CONF/powerlevel10k/powerlevel10k.zsh-theme" ]]; then
|
||||
comp-source "$ZSH_CONF/powerlevel10k/powerlevel10k.zsh-theme"
|
||||
# To customize prompt, run `p10k configure` or edit $ZSH_CONF/p10k.zsh-theme.
|
||||
comp-source "$ZSH_CONF/p10k.zsh-theme"
|
||||
fi
|
||||
|
||||
## Setup zsh completion system
|
||||
[[ ! -d "$ZSH_CONF/completion" ]] || fpath=("$ZSH_CONF/completion" $fpath)
|
||||
|
||||
autoload -Uz compinit
|
||||
compinit -d "${XDG_CACHE_HOME:-$HOME/.cache}/zsh/zcompdump-$ZSH_VERSION"
|
||||
|
||||
zstyle ':completion:*' auto-description 'specify: %d'
|
||||
zstyle ':completion:*' completer _expand _complete _correct _approximate
|
||||
zstyle ':completion:*' format 'Completing %d'
|
||||
zstyle ':completion:*' group-name ''
|
||||
zstyle ':completion:*' menu select=2
|
||||
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
|
||||
zstyle ':completion:*' list-colors ''
|
||||
zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s
|
||||
zstyle ':completion:*' matcher-list '' 'm:{a-z}={A-Z}' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=* l:|=*'
|
||||
zstyle ':completion:*' menu select=long
|
||||
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s
|
||||
zstyle ':completion:*' use-compctl false
|
||||
zstyle ':completion:*' verbose true
|
||||
|
||||
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'
|
||||
zstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,cputime,cmd'
|
||||
|
||||
zstyle ':completion:*' menu select
|
||||
|
||||
zstyle -e ':completion:*:users' users 'local user; getent passwd | while IFS=: read -rA user; do (( user[3] >= 1000 || user[3] == 0 )) && reply+=($user[1]); done'
|
||||
|
||||
# Include hidden files in completion.
|
||||
_comp_options+=(globdots)
|
||||
|
||||
# Don't complete the same argument twice for these programs.
|
||||
# Taken from http://leahneukirchen.org/dotfiles/.zshrc
|
||||
zstyle ':completion:*:(diff|meld|trash):*' ignore-line yes
|
||||
|
||||
comp-source "$ZSH_CONF/fzf-tab/fzf-tab.plugin.zsh"
|
||||
|
||||
## Load external config files and modules
|
||||
autoload edit-command-line; zle -N edit-command-line
|
||||
(( ! $+aliases[run-help] )) || unalias run-help
|
||||
@@ -126,30 +53,8 @@ if [[ -d "$ZDOTDIR/autoload" ]]; then
|
||||
autoload -Uz -- "" "${fpath[1]}"/[^_.]*(.xN:t)
|
||||
fi
|
||||
! command -v direnv &>/dev/null || eval "$(direnv hook zsh)"
|
||||
# stderred
|
||||
if [[ -e "$ZSH_CONF/stderred/usr/share/stderred/stderred.sh" ]]; then
|
||||
comp-source "$ZSH_CONF/stderred/usr/share/stderred/stderred.sh"
|
||||
export STDERRED_ESC_CODE="$(tput bold && tput setaf 1)" # bold red
|
||||
export STDERRED_BLACKLIST="^(git|curl|wget|swipl)$"
|
||||
fi
|
||||
comp-source "$ZSH_CONF/alias.zsh"
|
||||
comp-source "$ZSH_CONF/functions.zsh"
|
||||
comp-source "$ZSH_CONF/zsh-autosuggestions/zsh-autosuggestions.zsh"
|
||||
### syntax-highlight > keys
|
||||
# syntax highlighting
|
||||
if [[ -e "$ZSH_CONF/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" ]]; then
|
||||
comp-source "$ZSH_CONF/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
|
||||
comp-source "$ZSH_CONF/zsh-syntax-highlighting.zsh-theme"
|
||||
fi
|
||||
comp-source "$ZSH_CONF/keys.zsh"
|
||||
# Reenable fzf-tab since `bindkey -v` seems to deactivate it
|
||||
enable-fzf-tab
|
||||
|
||||
## Setup zle
|
||||
zle_highlight=('paste:none')
|
||||
|
||||
## History
|
||||
HISTSIZE=1000000
|
||||
SAVEHIST=1000000
|
||||
[[ -d "${XDG_DATA_HOME:-$HOME/.local/share}/zsh" ]] || mkdir -p "${XDG_DATA_HOME:-$HOME/.local/share}/zsh"
|
||||
HISTFILE="${XDG_DATA_HOME:-$HOME/.local/share}/zsh/.zsh_history"
|
||||
|
||||
1
.config/zsh/plugins/fzf-tab-fork
Submodule
1
.config/zsh/plugins/fzf-tab-fork
Submodule
Submodule .config/zsh/plugins/fzf-tab-fork added at 239732e6d4
@@ -1,148 +0,0 @@
|
||||
--- p10k.zsh-theme 2020-08-25 04:58:57.523296332 +0200
|
||||
+++ p10k.zsh-theme 2020-08-25 04:56:22.351599739 +0200
|
||||
@@ -45,6 +45,9 @@
|
||||
# last prompt line gets hidden if it would overlap with left prompt.
|
||||
typeset -g POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(
|
||||
# =========================[ Line #1 ]=========================
|
||||
+ # time # current time
|
||||
+ # =========================[ Line #2 ]=========================
|
||||
+ newline
|
||||
status # exit code of the last command
|
||||
command_execution_time # duration of the last command
|
||||
background_jobs # presence of background jobs
|
||||
@@ -87,7 +90,7 @@
|
||||
vim_shell # vim shell indicator (:sh)
|
||||
midnight_commander # midnight commander shell (https://midnight-commander.org/)
|
||||
nix_shell # nix shell (https://nixos.org/nixos/nix-pills/developing-with-nix-shell.html)
|
||||
- # vpn_ip # virtual private network indicator
|
||||
+ vpn_ip # virtual private network indicator
|
||||
# load # CPU load
|
||||
# disk_usage # disk usage
|
||||
# ram # free RAM
|
||||
@@ -95,9 +98,6 @@
|
||||
todo # todo items (https://github.com/todotxt/todo.txt-cli)
|
||||
timewarrior # timewarrior tracking status (https://timewarrior.net/)
|
||||
taskwarrior # taskwarrior task count (https://taskwarrior.org/)
|
||||
- time # current time
|
||||
- # =========================[ Line #2 ]=========================
|
||||
- newline
|
||||
# ip # ip address and bandwidth usage for a specified network interface
|
||||
# public_ip # public IP address
|
||||
# proxy # system-wide http/https/ftp proxy
|
||||
@@ -188,9 +188,9 @@
|
||||
# Red prompt symbol if the last command failed.
|
||||
typeset -g POWERLEVEL9K_PROMPT_CHAR_ERROR_{VIINS,VICMD,VIVIS,VIOWR}_FOREGROUND=196
|
||||
# Default prompt symbol.
|
||||
- typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIINS_CONTENT_EXPANSION='❯'
|
||||
+ typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIINS_CONTENT_EXPANSION='>'
|
||||
# Prompt symbol in command vi mode.
|
||||
- typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VICMD_CONTENT_EXPANSION='❮'
|
||||
+ typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VICMD_CONTENT_EXPANSION='<'
|
||||
# Prompt symbol in visual vi mode.
|
||||
typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIVIS_CONTENT_EXPANSION='V'
|
||||
# Prompt symbol in overwrite vi mode.
|
||||
@@ -325,7 +325,7 @@
|
||||
|
||||
#####################################[ vcs: git status ]######################################
|
||||
# Branch icon. Set this parameter to '\uF126 ' for the popular Powerline branch icon.
|
||||
- typeset -g POWERLEVEL9K_VCS_BRANCH_ICON=
|
||||
+ typeset -g POWERLEVEL9K_VCS_BRANCH_ICON='| '
|
||||
|
||||
# Untracked files icon. It's really a question mark, your font isn't broken.
|
||||
# Change the value of this parameter to show a different icon.
|
||||
@@ -371,7 +371,7 @@
|
||||
res+="${clean}${(g::)POWERLEVEL9K_VCS_BRANCH_ICON}"
|
||||
where=${(V)VCS_STATUS_LOCAL_BRANCH}
|
||||
elif [[ -n $VCS_STATUS_TAG ]]; then
|
||||
- res+="${meta}#"
|
||||
+ res+="${meta}${(g::)POWERLEVEL9K_VCS_BRANCH_ICON}#"
|
||||
where=${(V)VCS_STATUS_TAG}
|
||||
fi
|
||||
|
||||
@@ -481,32 +481,32 @@
|
||||
# like this: 1|0.
|
||||
typeset -g POWERLEVEL9K_STATUS_OK_PIPE=true
|
||||
typeset -g POWERLEVEL9K_STATUS_OK_PIPE_FOREGROUND=70
|
||||
- typeset -g POWERLEVEL9K_STATUS_OK_PIPE_VISUAL_IDENTIFIER_EXPANSION='✔'
|
||||
+ typeset -g POWERLEVEL9K_STATUS_OK_PIPE_VISUAL_IDENTIFIER_EXPANSION=
|
||||
|
||||
# Status when it's just an error code (e.g., '1'). No need to show it if prompt_char is enabled as
|
||||
# it will signify error by turning red.
|
||||
- typeset -g POWERLEVEL9K_STATUS_ERROR=false
|
||||
+ typeset -g POWERLEVEL9K_STATUS_ERROR=true
|
||||
typeset -g POWERLEVEL9K_STATUS_ERROR_FOREGROUND=160
|
||||
- typeset -g POWERLEVEL9K_STATUS_ERROR_VISUAL_IDENTIFIER_EXPANSION='✘'
|
||||
+ typeset -g POWERLEVEL9K_STATUS_ERROR_VISUAL_IDENTIFIER_EXPANSION=
|
||||
|
||||
# Status when the last command was terminated by a signal.
|
||||
typeset -g POWERLEVEL9K_STATUS_ERROR_SIGNAL=true
|
||||
typeset -g POWERLEVEL9K_STATUS_ERROR_SIGNAL_FOREGROUND=160
|
||||
# Use terse signal names: "INT" instead of "SIGINT(2)".
|
||||
- typeset -g POWERLEVEL9K_STATUS_VERBOSE_SIGNAME=false
|
||||
- typeset -g POWERLEVEL9K_STATUS_ERROR_SIGNAL_VISUAL_IDENTIFIER_EXPANSION='✘'
|
||||
+ typeset -g POWERLEVEL9K_STATUS_VERBOSE_SIGNAME=true
|
||||
+ typeset -g POWERLEVEL9K_STATUS_ERROR_SIGNAL_VISUAL_IDENTIFIER_EXPANSION=
|
||||
|
||||
# Status when some part of a pipe command fails and the overall exit status is also non-zero.
|
||||
# It may look like this: 1|0.
|
||||
typeset -g POWERLEVEL9K_STATUS_ERROR_PIPE=true
|
||||
typeset -g POWERLEVEL9K_STATUS_ERROR_PIPE_FOREGROUND=160
|
||||
- typeset -g POWERLEVEL9K_STATUS_ERROR_PIPE_VISUAL_IDENTIFIER_EXPANSION='✘'
|
||||
+ typeset -g POWERLEVEL9K_STATUS_ERROR_PIPE_VISUAL_IDENTIFIER_EXPANSION=
|
||||
|
||||
###################[ command_execution_time: duration of the last command ]###################
|
||||
# Show duration of the last command if takes longer than this many seconds.
|
||||
- typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=3
|
||||
+ typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=1
|
||||
# Show this many fractional digits. Zero means round to seconds.
|
||||
- typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION=0
|
||||
+ typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION=2
|
||||
# Execution time color.
|
||||
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FOREGROUND=101
|
||||
# Duration format: 1d 2h 3m 4s.
|
||||
@@ -522,7 +522,7 @@
|
||||
# Background jobs color.
|
||||
typeset -g POWERLEVEL9K_BACKGROUND_JOBS_FOREGROUND=70
|
||||
# Custom icon.
|
||||
- # typeset -g POWERLEVEL9K_BACKGROUND_JOBS_VISUAL_IDENTIFIER_EXPANSION='⭐'
|
||||
+ typeset -g POWERLEVEL9K_BACKGROUND_JOBS_VISUAL_IDENTIFIER_EXPANSION='☰'
|
||||
|
||||
#######################[ direnv: direnv status (https://direnv.net/) ]########################
|
||||
# Direnv color.
|
||||
@@ -1382,16 +1382,16 @@
|
||||
typeset -g POWERLEVEL9K_VPN_IP_FOREGROUND=81
|
||||
# When on VPN, show just an icon without the IP address.
|
||||
# Tip: To display the private IP address when on VPN, remove the next line.
|
||||
- typeset -g POWERLEVEL9K_VPN_IP_CONTENT_EXPANSION=
|
||||
+ # typeset -g POWERLEVEL9K_VPN_IP_CONTENT_EXPANSION=
|
||||
# Regular expression for the VPN network interface. Run `ifconfig` or `ip -4 a show` while on VPN
|
||||
# to see the name of the interface.
|
||||
- typeset -g POWERLEVEL9K_VPN_IP_INTERFACE='(wg|(.*tun))[0-9]*'
|
||||
+ typeset -g POWERLEVEL9K_VPN_IP_INTERFACE='(wg|(.*tun)|vpn)[0-9]*'
|
||||
# If set to true, show one segment per matching network interface. If set to false, show only
|
||||
# one segment corresponding to the first matching network interface.
|
||||
# Tip: If you set it to true, you'll probably want to unset POWERLEVEL9K_VPN_IP_CONTENT_EXPANSION.
|
||||
- typeset -g POWERLEVEL9K_VPN_IP_SHOW_ALL=false
|
||||
+ typeset -g POWERLEVEL9K_VPN_IP_SHOW_ALL=true
|
||||
# Custom icon.
|
||||
- # typeset -g POWERLEVEL9K_VPN_IP_VISUAL_IDENTIFIER_EXPANSION='⭐'
|
||||
+ typeset -g POWERLEVEL9K_VPN_IP_VISUAL_IDENTIFIER_EXPANSION=
|
||||
|
||||
###########[ ip: ip address and bandwidth usage for a specified network interface ]###########
|
||||
# IP color.
|
||||
@@ -1464,13 +1464,13 @@
|
||||
|
||||
####################################[ time: current time ]####################################
|
||||
# Current time color.
|
||||
- typeset -g POWERLEVEL9K_TIME_FOREGROUND=66
|
||||
+ typeset -g POWERLEVEL9K_TIME_FOREGROUND=39
|
||||
# Format for the current time: 09:51:02. See `man 3 strftime`.
|
||||
typeset -g POWERLEVEL9K_TIME_FORMAT='%D{%H:%M:%S}'
|
||||
# If set to true, time will update when you hit enter. This way prompts for the past
|
||||
# commands will contain the start times of their commands as opposed to the default
|
||||
# behavior where they contain the end times of their preceding commands.
|
||||
- typeset -g POWERLEVEL9K_TIME_UPDATE_ON_COMMAND=false
|
||||
+ typeset -g POWERLEVEL9K_TIME_UPDATE_ON_COMMAND=true
|
||||
# Custom icon.
|
||||
typeset -g POWERLEVEL9K_TIME_VISUAL_IDENTIFIER_EXPANSION=
|
||||
# Custom prefix.
|
||||
@@ -1,93 +0,0 @@
|
||||
# Copyright 2019 Roman Perepelitsa
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# Measures how long it takes for your zsh prompt to render. Roughly speaking,
|
||||
# if you press and hold [ENTER], how many prompts will be printed per second?
|
||||
#
|
||||
# $1 -- Benchmark for this many seconds. Default is 5.
|
||||
# $2 -- Sleep for this many seconds before benchmarking to fill the keyboard input buffer.
|
||||
# This mitigates the problem caused by slow key repeat rate (see below). Default is 10.
|
||||
#
|
||||
# After calling this function in an interactive shell you need to press and hold [ENTER] until
|
||||
# you see benchmark results. It'll take 15 seconds with default arguments. The output also includes
|
||||
# your prompt with all non-ascii characters escaped. This is to enable you to easily share the
|
||||
# results with others (e.g., if you want to complain to your zsh theme provider about high prompt
|
||||
# latency). Not only will they see how fast (or how slow!) your prompt renders but also what it
|
||||
# actually looks like.
|
||||
#
|
||||
# Make sure your repeat key rate is high enough that your shell is unable to keep up. While not
|
||||
# benchmarking, press and hold [ENTER]. If you see empty lines between prompts or if prompts keep
|
||||
# being printed after you release [ENTER], your repeat key rate is sufficient. If it's not,
|
||||
# you can artificially boost it by buffering keyboard input buffer. Your effective key repeat
|
||||
# rate is multiplied by 1 + $2 / $1. With default settings this is 1 + 10 / 5 == 3.
|
||||
function zsh-prompt-benchmark() {
|
||||
typeset -gHF3 _BENCHMARK_PROMPT_DURATION=${1:-5}
|
||||
typeset -gHi _BENCHMARK_PROMPT_WARMUP_DURATION=${2:-10}
|
||||
typeset -gHi _BENCHMARK_PROMPT_SAMPLE_IDX=0
|
||||
typeset -gHF3 _BENCHMARK_PROMPT_START_TIME=0
|
||||
>&2 echo "Enabling prompt benchmarking for ${_BENCHMARK_PROMPT_DURATION}s" \
|
||||
"after buffering keyboard input for ${_BENCHMARK_PROMPT_WARMUP_DURATION}s."
|
||||
>&2 echo "Press and hold [ENTER] until you see benchmark results."
|
||||
add-zsh-hook precmd _zsh_prompt_benchmark_precmd
|
||||
|
||||
typeset -gHf _zsh_prompt_benchmark_precmd() {
|
||||
local -F now=$EPOCHREALTIME
|
||||
((++_BENCHMARK_PROMPT_SAMPLE_IDX))
|
||||
if ((now < _BENCHMARK_PROMPT_START_TIME + _BENCHMARK_PROMPT_DURATION)); then
|
||||
return
|
||||
fi
|
||||
if (( _BENCHMARK_PROMPT_START_TIME )); then
|
||||
local -i N=$((_BENCHMARK_PROMPT_SAMPLE_IDX - 1))
|
||||
local -F3 T=$((now - _BENCHMARK_PROMPT_START_TIME))
|
||||
local -F2 P=$((1000 * T / N))
|
||||
local LP=$(eval LC_ALL=C printf '%q' \"$PROMPT\")
|
||||
local RP=$(eval LC_ALL=C printf '%q' \"$RPROMPT\")
|
||||
>&2 echo -E "************************************************************"
|
||||
>&2 echo -E " Prompt Benchmark Results "
|
||||
>&2 echo -E "************************************************************"
|
||||
>&2 echo -E "Warmup duration ${_BENCHMARK_PROMPT_WARMUP_DURATION}s"
|
||||
>&2 echo -E "Benchmarked prompts $N"
|
||||
>&2 echo -E "Total time ${T}s"
|
||||
>&2 echo -E "Time per prompt ${P}ms"
|
||||
>&2 echo -E "************************************************************"
|
||||
>&2 echo -E ""
|
||||
>&2 echo -E "PROMPT=$LP"
|
||||
>&2 echo -E ""
|
||||
>&2 echo -E "RPROMPT=$RP"
|
||||
>&2 echo -E ""
|
||||
>&2 echo -E "Tip: To print one of the reported prompts, execute the"
|
||||
>&2 echo -E "following command with \${P} replaced by the prompt string."
|
||||
>&2 echo -E ""
|
||||
>&2 echo -E " print -lP BEGIN \${P} '' END"
|
||||
>&2 echo -E ""
|
||||
>&2 echo -E "For example, here's how you can print the same left prompt"
|
||||
>&2 echo -E "(PROMPT) that was benchmarked:"
|
||||
>&2 echo -E ""
|
||||
>&2 echo -E " print -lP BEGIN $LP END"
|
||||
>&2 echo -E "************************************************************"
|
||||
>&2 echo -E ""
|
||||
>&2 echo -E "Press 'q' to continue..."
|
||||
unset -m "_BENCHMARK_PROMPT_*"
|
||||
unset -f _zsh_prompt_benchmark_precmd
|
||||
add-zsh-hook -D precmd _zsh_prompt_benchmark_precmd
|
||||
local _ && IFS='' read -rsd q _
|
||||
else
|
||||
sleep $_BENCHMARK_PROMPT_WARMUP_DURATION
|
||||
typeset -gHF _BENCHMARK_PROMPT_START_TIME=$EPOCHREALTIME
|
||||
fi
|
||||
}
|
||||
}
|
||||
|
||||
zmodload zsh/datetime
|
||||
autoload -Uz add-zsh-hook
|
||||
31
.config/zsh/zshrc.d/10-options.zsh
Normal file
31
.config/zsh/zshrc.d/10-options.zsh
Normal file
@@ -0,0 +1,31 @@
|
||||
setopt AUTO_CONTINUE # Stopped jobs with 'disown' are automatically sent a CONT signal to make them running.
|
||||
setopt AUTO_LIST # Automatically list choices on an ambiguous completion.
|
||||
setopt AUTO_PARAM_SLASH # Add a trailing slash when completing directories
|
||||
setopt AUTO_PUSHD # Make cd push the old directory onto the directory stack.
|
||||
setopt NO_AUTO_REMOVE_SLASH # Keeps trailing slash for directories when auto completing.
|
||||
setopt NO_BEEP # Do not beep on error in ZLE.
|
||||
setopt CDABLE_VARS # Expand named directories without leading '~'.
|
||||
setopt C_BASES # Output hexadecimal numbers in the standard C format ('16#FF' -> '0xFF').
|
||||
setopt CHASE_LINKS # Resolve symbolic links to their true values when changing directory.
|
||||
setopt NO_CLOBBER # '>!' or '>|' must be used to truncate a file, and '>>!' or '>>|' to create a file.
|
||||
setopt NO_COMPLETE_ALIASES # Substitute internally before completion.
|
||||
setopt COMPLETE_IN_WORD # Complete from the cursor rather than from the end of the word
|
||||
setopt CORRECT # Try to correct the spelling of a command
|
||||
setopt CORRECT_ALL # Try to correct the spelling of all arguments
|
||||
CORRECT_IGNORE_FILE=".*" # Do not offer hidden files as correction
|
||||
setopt EXTENDED_HISTORY # Save in format : <beginning time>:<elapsed seconds>;<command>
|
||||
setopt EXTENDED_GLOB # Treat the `#', `~' and `^' characters as part of patterns for filename generation, etc.
|
||||
setopt NO_FLOW_CONTROL # Disables output flow control in the shell's editor via start/stop characters (usually ^S/^Q).
|
||||
setopt GLOB_DOTS # Do not require a leading `.' in a filename to be matched explicitly.
|
||||
setopt HIST_IGNORE_DUPS # Do not enter command lines into the history list if they are duplicates of the previous event.
|
||||
setopt HIST_IGNORE_SPACE # History should ignore commands beginning with a space
|
||||
setopt HIST_VERIFY # perform history expansion and reload line in editing buffer instead of executing it directly
|
||||
setopt NO_INC_APPEND_HISTORY # Do not write lines as soon as they are entered (breaks exec time otherwise)
|
||||
setopt INC_APPEND_HISTORY_TIME # Write lines after they are finished
|
||||
setopt INTERACTIVE_COMMENTS # Allow comments even in interactive shells.
|
||||
setopt LIST_AMBIGUOUS # Insert unambiguous prefix without completion list (auto_list set)
|
||||
setopt LIST_PACKED # Make completion list smaller by printing matches in columns with different widths.
|
||||
setopt NO_MENU_COMPLETE # Do not autoselect the first entry when completing
|
||||
setopt PUSHD_IGNORE_DUPS # Don't push multiple copies of the same directory onto the directory stack.
|
||||
setopt NO_SHARE_HISTORY # Do not write + read history after every command (messes up exec time otherwise)
|
||||
setopt SH_WORD_SPLIT # Causes field splitting to be performed on unquoted parameter expansions
|
||||
32
.config/zsh/zshrc.d/20-completion.zsh
Normal file
32
.config/zsh/zshrc.d/20-completion.zsh
Normal file
@@ -0,0 +1,32 @@
|
||||
[[ ! -d "$ZSH_CONF/completion" ]] || fpath=("$ZSH_CONF/completion" $fpath)
|
||||
|
||||
autoload -Uz compinit
|
||||
compinit -d "${XDG_CACHE_HOME:-$HOME/.cache}/zsh/zcompdump-$ZSH_VERSION"
|
||||
|
||||
zstyle ':completion:*' auto-description 'specify: %d'
|
||||
zstyle ':completion:*' completer _expand _complete _correct _approximate
|
||||
zstyle ':completion:*' format 'Completing %d'
|
||||
zstyle ':completion:*' group-name ''
|
||||
zstyle ':completion:*' menu select=2
|
||||
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
|
||||
zstyle ':completion:*' list-colors ''
|
||||
zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s
|
||||
zstyle ':completion:*' matcher-list '' 'm:{a-z}={A-Z}' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=* l:|=*'
|
||||
zstyle ':completion:*' menu select=long
|
||||
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s
|
||||
zstyle ':completion:*' use-compctl false
|
||||
zstyle ':completion:*' verbose true
|
||||
|
||||
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'
|
||||
zstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,cputime,cmd'
|
||||
|
||||
zstyle ':completion:*' menu select
|
||||
|
||||
zstyle -e ':completion:*:users' users 'local user; getent passwd | while IFS=: read -rA user; do (( user[3] >= 1000 || user[3] == 0 )) && reply+=($user[1]); done'
|
||||
|
||||
# Include hidden files in completion.
|
||||
_comp_options+=(globdots)
|
||||
|
||||
# Don't complete the same argument twice for these programs.
|
||||
# Taken from http://leahneukirchen.org/dotfiles/.zshrc
|
||||
zstyle ':completion:*:(diff|meld|trash):*' ignore-line yes
|
||||
1
.config/zsh/zshrc.d/50-external-plugins/10-powerlevel10k
Symbolic link
1
.config/zsh/zshrc.d/50-external-plugins/10-powerlevel10k
Symbolic link
@@ -0,0 +1 @@
|
||||
../../plugins/powerlevel10k/powerlevel10k.zsh-theme
|
||||
@@ -789,7 +789,7 @@
|
||||
##############[ taskwarrior: taskwarrior task count (https://taskwarrior.org/) ]##############
|
||||
# Taskwarrior color.
|
||||
typeset -g POWERLEVEL9K_TASKWARRIOR_FOREGROUND=74
|
||||
|
||||
|
||||
# Taskwarrior segment format. The following parameters are available within the expansion.
|
||||
#
|
||||
# - P9K_TASKWARRIOR_PENDING_COUNT The number of pending tasks: `task +PENDING count`.
|
||||
1
.config/zsh/zshrc.d/50-external-plugins/20-autosuggestions
Symbolic link
1
.config/zsh/zshrc.d/50-external-plugins/20-autosuggestions
Symbolic link
@@ -0,0 +1 @@
|
||||
../../plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
|
||||
1
.config/zsh/zshrc.d/50-external-plugins/30-syntax-highlighting
Symbolic link
1
.config/zsh/zshrc.d/50-external-plugins/30-syntax-highlighting
Symbolic link
@@ -0,0 +1 @@
|
||||
../../plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
|
||||
@@ -15,7 +15,7 @@ ZSH_HIGHLIGHT_STYLES[bracket-level-1]='fg=012,bold'
|
||||
ZSH_HIGHLIGHT_STYLES[double-quoted-argument]='fg=011'
|
||||
ZSH_HIGHLIGHT_STYLES[dollar-quoted-argument]='fg=011'
|
||||
ZSH_HIGHLIGHT_STYLES[bracket-level-4]='fg=011,bold'
|
||||
ZSH_HIGHLIGHT_STYLES[single-quoted-argument]='fg=011'
|
||||
ZSH_HIGHLIGHT_STYLES[single-quoted-argument]='fg=011'
|
||||
ZSH_HIGHLIGHT_STYLES[reserved-word]='fg=011'
|
||||
ZSH_HIGHLIGHT_STYLES[path_prefix]='fg=011,underline'
|
||||
## cyan
|
||||
1
.config/zsh/zshrc.d/50-external-plugins/40-fzf-tab
Symbolic link
1
.config/zsh/zshrc.d/50-external-plugins/40-fzf-tab
Symbolic link
@@ -0,0 +1 @@
|
||||
../../plugins/fzf-tab-fork/fzf-tab.zsh
|
||||
1
.config/zsh/zshrc.d/50-external-plugins/50-fzf-key-bindings
Symbolic link
1
.config/zsh/zshrc.d/50-external-plugins/50-fzf-key-bindings
Symbolic link
@@ -0,0 +1 @@
|
||||
../../plugins/fzf/shell/key-bindings.zsh
|
||||
1
.config/zsh/zshrc.d/50-external-plugins/60-stderred
Symbolic link
1
.config/zsh/zshrc.d/50-external-plugins/60-stderred
Symbolic link
@@ -0,0 +1 @@
|
||||
../../plugins/stderred/usr/share/stderred/stderred.sh
|
||||
@@ -0,0 +1,4 @@
|
||||
# Bold red
|
||||
export STDERRED_ESC_CODE="$(tput bold && tput setaf 1)"
|
||||
|
||||
export STDERRED_BLACKLIST="^(git|curl|wget|swipl)$"
|
||||
7
.config/zsh/zshrc.d/70-history.zsh
Normal file
7
.config/zsh/zshrc.d/70-history.zsh
Normal file
@@ -0,0 +1,7 @@
|
||||
HISTSIZE=1000000
|
||||
SAVEHIST=1000000
|
||||
|
||||
if [[ ! -d "${XDG_DATA_HOME:-$HOME/.local/share}"/zsh ]]; then
|
||||
mkdir -p "${XDG_DATA_HOME:-$HOME/.local/share}"/zsh
|
||||
fi
|
||||
HISTFILE="${XDG_DATA_HOME:-$HOME/.local/share}"/zsh/zsh_history
|
||||
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -40,6 +40,9 @@
|
||||
[submodule ".config/zsh/plugins/fzf-tab"]
|
||||
path = .config/zsh/plugins/fzf-tab
|
||||
url = https://github.com/Aloxaf/fzf-tab
|
||||
[submodule ".config/zsh/plugins/fzf-tab-fork"]
|
||||
path = .config/zsh/plugins/fzf-tab-fork
|
||||
url = git@github.com:druckdev/fzf-tab.git
|
||||
[submodule ".config/zsh/plugins/powerlevel10k"]
|
||||
path = .config/zsh/plugins/powerlevel10k
|
||||
url = https://github.com/romkatv/powerlevel10k.git
|
||||
|
||||
Reference in New Issue
Block a user