Add old functionality back again
This commit is contained in:
parent
c9f0ca46e3
commit
b40b6d8c74
7 changed files with 1641 additions and 6 deletions
1198
zsh/.config/zsh/.p10k.zsh
Normal file
1198
zsh/.config/zsh/.p10k.zsh
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -1,9 +1,31 @@
|
|||
#!/usr/bin/env zsh
|
||||
#
|
||||
#
|
||||
|
||||
# Set completion style
|
||||
# The following lines were added by compinstall
|
||||
zstyle ':completion:*' completer _complete _ignored _approximate
|
||||
zstyle ':completion:*' list-colors ''
|
||||
zstyle ':completion:*' matcher-list '' '+m:{[:lower:]}={[:upper:]} r:|[._-]=** r:|=**'
|
||||
zstyle ':completion:*' menu select=1
|
||||
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s
|
||||
zstyle :compinstall filename '/home/marty/.config/zsh/.zshrc'
|
||||
# End of lines added by compinstall
|
||||
autoload -Uz compinit zmv
|
||||
compinit
|
||||
|
||||
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.config/zsh/.zshrc.
|
||||
# Initialization code that may require console input (password prompts, [y/n]
|
||||
# confirmations, etc.) must go above this block, everything else may go below.
|
||||
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
|
||||
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
|
||||
fi
|
||||
|
||||
|
||||
# load all plugins
|
||||
[ -f "$XDG_CONFIG_HOME/zsh/plugins.zsh" ] && source "$XDG_CONFIG_HOME/zsh/plugins.zsh"
|
||||
|
||||
# shellcheck source=alias
|
||||
[ -f "$XDG_CONFIG_HOME/sh/alias" ] && . "$XDG_CONFIG_HOME/sh/alias"
|
||||
[ -f "$XDG_CONFIG_HOME/sh/alias" ] && source "$XDG_CONFIG_HOME/sh/alias"
|
||||
# load additional aliases
|
||||
if [ -d "$XDG_CONFIG_HOME/sh/alias.d" ]; then
|
||||
for _alias in "$XDG_CONFIG_HOME/sh/alias.d"/*.sh; do
|
||||
|
|
@ -12,11 +34,79 @@ if [ -d "$XDG_CONFIG_HOME/sh/alias.d" ]; then
|
|||
unset _alias
|
||||
fi
|
||||
|
||||
# history
|
||||
#
|
||||
# Correct spelling for commands
|
||||
setopt correct
|
||||
# turn off the infernal correctall for filenames
|
||||
unsetopt correctall
|
||||
# Enable command auto-correction.
|
||||
ENABLE_CORRECTION="true"
|
||||
|
||||
# Speed up autocomplete, force prefix mapping
|
||||
zstyle ':completion:*' accept-exact '*(N)'
|
||||
zstyle ':completion:*' use-cache on
|
||||
zstyle ':completion:*' cache-path ~/.zsh/cache
|
||||
# shellcheck disable=SC2016
|
||||
zstyle -e ':completion:*:default' list-colors 'reply=("${PREFIX:+=(#bi)($PREFIX:t)*==34=34}:${(s.:.)LS_COLORS}")'
|
||||
|
||||
### history
|
||||
## Set ZSH History defaults
|
||||
setopt append_history
|
||||
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
|
||||
# Share your history across all your terminal windows
|
||||
setopt share_history
|
||||
setopt pushd_ignore_dups
|
||||
#setopt pushd_silent
|
||||
export HISTSIZE=100000
|
||||
export SAVEHIST=100000
|
||||
export HISTFILE="$XDG_DATA_HOME/zsh_history"
|
||||
export HISTIGNORE="ls:cd:cd -:pwd:exit:date:* --help"
|
||||
## Set ZSH History aliases
|
||||
# Show the top 5 commands used in recent history
|
||||
history_top() {
|
||||
history | awk "{a[\$2]++} END{for(i in a){printf \"%5d\t%s\n\",a[i],i}}" | sort -rn | head
|
||||
}
|
||||
# Display timestamped recent command history
|
||||
alias history="fc -l -d -D"
|
||||
|
||||
### Glob Alias expansion
|
||||
# Expand aliases inline - see http://blog.patshead.com/2012/11/automatically-expaning-zsh-global-aliases---simplified.html
|
||||
globalias() {
|
||||
if [[ $LBUFFER =~ [A-Z0-9]+$ ]]; then
|
||||
zle _expand_alias
|
||||
zle expand-word
|
||||
fi
|
||||
zle self-insert
|
||||
}
|
||||
zle -N globalias
|
||||
bindkey " " globalias
|
||||
bindkey "^ " magic-space # control-space to bypass completion
|
||||
bindkey -M isearch " " magic-space # normal space during searches
|
||||
|
||||
# To customize prompt, run `p10k configure` or edit ~/.config/zsh/.p10k.zsh.
|
||||
[[ ! -f "$XDG_CONFIG_HOME"/zsh/.p10k.zsh ]] || source "$XDG_CONFIG_HOME"/zsh/.p10k.zsh
|
||||
|
||||
# In case a plugin adds a redundant path entry, remove duplicate entries
|
||||
# from PATH
|
||||
# from: https://unix.stackexchange.com/questions/40749/remove-duplicate-path-entries-with-awk-command
|
||||
get_var() {
|
||||
eval 'printf "%s\n" "${'"$1"'}"'
|
||||
}
|
||||
set_var() {
|
||||
eval "$1=\"\$2\""
|
||||
}
|
||||
dedup_pathvar() {
|
||||
pathvar_name="$1"
|
||||
pathvar_value="$(get_var "$pathvar_name")"
|
||||
deduped_path="$(perl -e 'print join(":",grep { not $seen{$_}++ } split(/:/, $ARGV[0]))' "$pathvar_value")"
|
||||
set_var "$pathvar_name" "$deduped_path"
|
||||
}
|
||||
dedup_pathvar PATH
|
||||
dedup_pathvar MANPATH
|
||||
|
||||
|
|
|
|||
73
zsh/.config/zsh/plugins.zsh
Normal file
73
zsh/.config/zsh/plugins.zsh
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
#!/bin/zsh
|
||||
# Clone zgen if you haven't already
|
||||
check_zgen_installation() {
|
||||
if [[ -z "$ZGEN_PARENT_DIR" ]]; then
|
||||
ZGEN_PARENT_DIR=${XDG_DATA_HOME:="$HOME/.local/share"}
|
||||
ZGEN_DIR="$ZGEN_PARENT_DIR/zgen"
|
||||
fi
|
||||
if [[ ! -f $ZGEN_DIR/zgen.zsh ]]; then
|
||||
if [[ ! -d "$ZGEN_PARENT_DIR" ]]; then
|
||||
mkdir -p "$ZGEN_PARENT_DIR"
|
||||
fi
|
||||
cd "$ZGEN_PARENT_DIR" || return
|
||||
git clone https://github.com/tarjoilija/zgen.git "$ZGEN_DIR"
|
||||
fi
|
||||
# shellcheck source=/home/marty/.config/zgen/zgen.zsh
|
||||
# shellcheck disable=SC1091
|
||||
source "$ZGEN_DIR"/zgen.zsh
|
||||
unset ZGEN_PARENT_DIR
|
||||
}
|
||||
|
||||
load_plugins() {
|
||||
ZGEN_LOADED=()
|
||||
ZGEN_COMPLETIONS=()
|
||||
|
||||
zgen oh-my-zsh
|
||||
|
||||
# If you want to customize your plugin list, create a file named
|
||||
# .zgen-local-plugins in your home directory. That file will be sourced
|
||||
# during startup *instead* of running this load-starter-plugin-list function,
|
||||
# so make sure to include everything from this function that you want to keep.
|
||||
|
||||
# If zsh-syntax-highlighting is bundled after zsh-history-substring-search,
|
||||
# they break, so get the order right.
|
||||
zgen load zdharma/fast-syntax-highlighting
|
||||
# zgen load zsh-users/zsh-history-substring-search
|
||||
|
||||
# # Set keystrokes for substring searching
|
||||
# zmodload zsh/terminfo
|
||||
# bindkey "${terminfo[kcuu1]:?}" history-substring-search-up
|
||||
# bindkey "${terminfo[kcud1]:?}" history-substring-search-down
|
||||
|
||||
# Automatically run zgen update and zgen selfupdate every 7 days.
|
||||
zgen load unixorn/autoupdate-zgen
|
||||
|
||||
# Warn you when you run a command that you've set an alias for without
|
||||
# using the alias.
|
||||
zgen load djui/alias-tips
|
||||
|
||||
# Add Fish-like autosuggestions to your ZSH.
|
||||
zgen load zsh-users/zsh-autosuggestions
|
||||
|
||||
zgen load romkatv/powerlevel10k powerlevel10k
|
||||
# radically enhanced cd command, all sorts of options
|
||||
# zgen load b4b4r07/enhancd
|
||||
|
||||
# set up nvm, the npm version manager
|
||||
zgen load lukechilds/zsh-nvm
|
||||
|
||||
# Add git helper scripts.
|
||||
zgen oh-my-zsh plugins/git
|
||||
|
||||
zgen oh-my-zsh plugins/colored-man-pages
|
||||
|
||||
# Load me last
|
||||
GENCOMPL_FPATH=${XDG_CONFIG_HOME:-"$HOME/.config/zsh"}/complete
|
||||
|
||||
zgen save
|
||||
}
|
||||
|
||||
check_zgen_installation
|
||||
if ! zgen saved; then
|
||||
load_plugins
|
||||
fi
|
||||
Loading…
Add table
Add a link
Reference in a new issue