Mega Commit

This commit is a sin.
But necessary
This commit is contained in:
Robert Morrison 2022-12-05 21:03:45 +00:00
parent 9ff7659ada
commit a029d2f348
Signed by: robert
GPG Key ID: 73E012EB3F4EC696
12 changed files with 147 additions and 37 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
.zkbd/ .zkbd/
.zcompdump .zcompdump
.zcalc_history

@ -1 +1 @@
Subproject commit 89c2d21b8d75048d29ea1528d33d3ee1ddbd86a1 Subproject commit a60119faff4083cf633930fd2afb20c3f5d9b894

View File

@ -64,6 +64,12 @@ alias ip='ip --color=auto'
## Open Vimwiki ## Open Vimwiki
alias vw='nvim -c VimwikiIndex' alias vw='nvim -c VimwikiIndex'
## Change Wineprefix quick and EZ
alias ws='source wineselect'
## zero a terminal session
alias zero='dirs -c && clear'
######################### #########################
# FileType Associations # # FileType Associations #
# extension=program # # extension=program #

6
chpwd Normal file
View File

@ -0,0 +1,6 @@
HAS_GLOW="$(command -v glow)"
chpwd() {
[ -z $HAS_GLOW ] && return 0
find $PWD -maxdepth 1 -iname 'readme.md' -exec glow {} \;
}

67
completion Normal file
View File

@ -0,0 +1,67 @@
echo $fpath
############
# Completion Config
############
## Disable beeping on completions.
setopt NO_BEEP
## Automatically list ambiguous completions.
setopt AUTO_LIST
## Automatically use menu completion after the second request for completion.
setopt AUTO_MENU
## Always fully insert completions.
setopt MENU_COMPLETE
## Automatically put subscripts directly after parameter expressions.
setopt AUTO_PARAM_KEYS
## Allow completion within words (i.e. always complete at the cursor position).
setopt COMPLETE_IN_WORD
## Always move the cursor to the end of a completion after inserting it.
setopt ALWAYS_TO_END
## Automatically list compleptions when given an unambigous prefix.
setopt LIST_AMBIGUOUS
## Display markers to indicate what type of file a completion item is.
setopt LIST_TYPES
## Print an error when provided patterns that are badly formed.
setopt BAD_PATTERN
zstyle ':completion:*' verbose yes
zstyle ':completion:*' group-name '' ## Simply makes the group-name appear with the group
zstyle ':completion:*' menu select ## use menu to select where possible
zstyle ':completion:*' completer _complete _match _approximate ## fuzzy match
zstyle ':completion:*' squeeze-slashes true ## remove trailing slashes
zstyle ':completion:*:descriptions' format '%B%F{green}┨%d┣%f%b' ## better descriptions format
zstyle ':completion:*:warnings' format '%BSorry, no matches for: %F{yellow}%d%b%f' ## show when no matches
zstyle ':completion:*:corrections' format '%B%F{yellow}┨%d┤├ errors %e┣%f%b'
zstyle ':completion:*:match:*' original only
zstyle -e ':completion:*:approximate:*' \
max-errors 'reply=($((($#PREFIX+$#SUFFIX)/3))numeric)' ## more errors in longer lines
zstyle ':completion:*:functions' ignored-patterns '_*' ## ignore completions for commands I dont have
zstyle ':completion:*:cd:*' ignore-parents parent pwd ## don't complete parent dir
autoload -Uz +X compinit
zmodload zsh/complist
compinit
# vim: ft=zsh

View File

@ -7,3 +7,4 @@ hash -d dl="$HOME/Downloads"
hash -d cn="${XDG_CONFIG_HOME:-$HOME/.config}" hash -d cn="${XDG_CONFIG_HOME:-$HOME/.config}"
hash -d px="$HOME/Pictures" hash -d px="$HOME/Pictures"
hash -d pr="$HOME/Projects" hash -d pr="$HOME/Projects"
# vim: ft=zsh

15
functions/_dotnet Normal file
View File

@ -0,0 +1,15 @@
#compdef dotnet
_dotnet()
{
local completions=("$(dotnet complete "$words")")
# If the completion list is empty, just continue with filename selection
if [ -z "$completions" ]
then
_arguments '*::arguments: _normal'
return
fi
# This is not a variable assigment, don't remove spaces!
_values = "${(ps:\n:)completions}"
}

2
greet
View File

@ -7,7 +7,7 @@ echo '╰───────────╯'
date date
if [ -d "$HOME/tmp" ]; then if [ -d "$HOME/tmp" ]; then
if [ -f "$HOME/tmp/KEEPTMP" ] || [ -f "$HOME/.cleanupResult" ]; then if [ -f "$HOME/tmp/KEEPTMP" ] || [ -f "$HOME/.cleanupResult" ]; then
printf "\033[31m\e[1m\e[5mYou have files in your tmp directory\e[0m" printf "\033[31m\e[1m\e[5mYou have files in your tmp directory\e[0m\n"
exa -alhT ~/tmp || tree ~/tmp exa -alhT ~/tmp || tree ~/tmp
if [ -f "$HOME/.cleanupResult" ]; then if [ -f "$HOME/.cleanupResult" ]; then
echo "ISSUE WAS:" echo "ISSUE WAS:"

26
history Normal file
View File

@ -0,0 +1,26 @@
## History Configuration
## Options relating to saving history
export HISTSIZE=10000
export SAVEHIST=6000
export HISTFILE=$XDG_STATE_HOME/zsh/history
set hist_ignore_dups ## Don't log the same thing twice
set hist_ignore_space ## Don't log things that start with space
set hist_reduce_blanks ## Compact unnecessary white-space
set hist_expire_dups_first ## Remove duplicates first (if any exist) when compacting history
set hist_save_no_dups ## Remove duplicates from history when writing
## Options relating to history use
set hist_find_no_dups ## Don't show duplicates when searching history
set hist_verify ## Dont' immediately execute expanded history `eg: sudo !!`
## This stops certain commands saving into the history file
export HISTORY_IGNORE='(cd(| *)|ls(| *)|pushd(| *)|popd(| *))'
## This hook goes even further and stops anything in the $HISTORY_IGNORE list from being
## added to the session local history (it still stays around in the up buffer until you run a new command afterwards)
zshaddhistory() {
emulate -L zsh
[[ ${1%%$'\n'} != ${~HISTORY_IGNORE} ]]
}

View File

@ -25,4 +25,4 @@ zle -N history-beginning-search-forward-end \
[[ -n "${key[Down]}" ]] && bindkey "${key[Down]}" down-line-or-search [[ -n "${key[Down]}" ]] && bindkey "${key[Down]}" down-line-or-search
[[ -n "${key[Left]}" ]] && bindkey "${key[Left]}" backward-char [[ -n "${key[Left]}" ]] && bindkey "${key[Left]}" backward-char
[[ -n "${key[Right]}" ]] && bindkey "${key[Right]}" forward-char [[ -n "${key[Right]}" ]] && bindkey "${key[Right]}" forward-char
# vim: set ft=zsh ts=8 sw=4 tw=0 noet : ## vim: ft=zsh

13
prompt
View File

@ -11,15 +11,16 @@ autoload -Uz vcs_info
zstyle ':vcs_info:*' enable git zstyle ':vcs_info:*' enable git
## Set icons for Staged and Unstaged Changes ## Set icons for Staged and Unstaged Changes
zstyle ':vcs_info:git*' stagedstr "" zstyle ':vcs_info:git*' stagedstr "%{%F{green%}%} %{%f%}"
zstyle ':vcs_info:git*' unstagedstr "" zstyle ':vcs_info:git*' unstagedstr "%{%F{red%}%} %{%f%}"
## Enable check for changes (CPU-intensive) ## Enable check for changes (CPU-intensive)
## DISABLE THIS ON LOW POWER SYSTEMS ## DISABLE THIS ON LOW POWER SYSTEMS
zstyle ':vcs_info:git*' check-for-changes true zstyle ':vcs_info:git*' check-for-changes true
## Set format for Repo Information ## Set format for Repo Information
zstyle ':vcs_info:git*' formats "-(%s:שׂ %b %u%c)" zstyle ':vcs_info:git*' formats "-(%{%F{203}%} %{%f%}%s:%{%F{2}%}שׂ %{%f%}%b %u%c)"
zstyle ':vcs_info:git*' actionformats "-(%{%F{203}%} %{%f%}%s:%{%F{2}%}שׂ %{%f%}%b %u%c)(%a)"
## set precmd to get vcs_info ## set precmd to get vcs_info
## precmd runs before every prompt ## precmd runs before every prompt
@ -27,7 +28,7 @@ precmd() {
vcs_info vcs_info
} }
PROMPT="$(setTermTitle "(%n@%m %~)")╭╼(%{%F{81}%}%n%{%F{245}%}@%{%F{206}%}%m %{%F{245}%}%~%{%F{259}%})─(%(?.😎.😞 %?))"$'\n'"╰┤" PROMPT="$(setTermTitle "(%n@%m %2~)")╭╼(%{%F{81}%}%n%{%F{245}%}@%{%F{206}%}%m %{%F{245}%}%2~%{%F{259}%})─(%(?.😎.😞 %?))"$'\n'"╰┤"
RPROMPT='${vcs_info_msg_0_}' export RPROMPT='${vcs_info_msg_0_}'
# vim: set ft=zsh ts=2 sw=2 tw=0 noet : # vim: set ft=zsh:

43
zshrc
View File

@ -10,54 +10,36 @@ unalias run-help
## autoload Modules ## autoload Modules
autoload -U +X colors && colors autoload -U +X colors && colors
autoload -U calendar autoload -U calendar
autoload -U run-help autoload -U run-help
autoload -U +X compinit autoload -U +X compinit
autoload -U edit-command-line autoload -U edit-command-line
## zmodload Modules ## zmodload Modules
zmodload zsh/complist zmodload zsh/complist
## Loca my function ## Load my functions
fpath=( $ZDOTDIR/functions $fpath ) fpath=( $ZDOTDIR/functions $fpath )
autoload CleanTmp autoload CleanTmp
autoload setTermTitle autoload setTermTitle
autoload tempPersist autoload tempPersist
## Source Other files ## Source Other files
source $HOME/.profile
source ${ZDOTDIR}/aliases source ${ZDOTDIR}/aliases
source ${ZDOTDIR}/dir_aliases source ${ZDOTDIR}/dir_aliases
source ${ZDOTDIR}/prompt source ${ZDOTDIR}/prompt
source ${ZDOTDIR}/keyboard source ${ZDOTDIR}/keyboard
source ${ZDOTDIR}/history
source ${ZDOTDIR}/chpwd
## Set option ## Set option
setopt emacs ## Emacs style keybinds #setopt emacs ## Emacs style keybinds
setopt vi
setopt autocd ## Change to directory if given as command setopt autocd ## Change to directory if given as command
setopt autopushd ## Automatically use pushd and stack setopt autopushd ## Automatically use pushd and stack
setopt correct ## Pick up on Spelling errors setopt correct ## Pick up on Spelling errors
setopt SHARE_HISTORY ## Share history across sessions
setopt hist_verify ## Edit Commands after expansion
## Configure History File source ${ZDOTDIR}/completion
export HISTSIZE=10000
export SAVEHIST=$HISTSIZE
export HISTFILE=$HOME/.zhistory
## Configure Completions
zstyle ':completion:*' menu select ## use menu to select where possible
zstyle ':completion:*:descriptions' format '%U%B%d%b%u' ## better descriptions format
zstyle ':completion:*:warnings' format '%BSorry, no matches for: %d%b' ## show when no matches
zstyle ':completion:*' completer _complete _match _approximate ## fuzzy match
zstyle ':completion:*:match:*' original only
zstyle -e ':completion:*:approximate:*' \
max-errors 'reply=($((($#PREFIX+$#SUFFIX)/3))numeric)' ## more errors in longer lines
zstyle ':completion:*:functions' ignored-patterns '_*' ## ignore completions for commands I dont have
zstyle ':completion:*' squeeze-slashes true ## remove trailing slashes
zstyle ':completion:*:cd:*' ignore-parents parent pwd ## don't complete parent dir
compinit
_comp_options+=(globdots)
## Configure command line editor ## Configure command line editor
zle -N edit-command-line zle -N edit-command-line
@ -71,17 +53,22 @@ export GPG_TTY=$(tty)
## Load external stuff ## Load external stuff
## support for opam ##Configure for homebrew
test -r $HOME/.opam/opam-init/init.zsh && . $HOME/.opam/opam-init/init.zsh > /dev/null 2> /dev/null || eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
## Configure Plugins ## Configure Plugins
export ZSH_AUTOSUGGEST_STRATEGY=(completion history) # suggest from completion then history export ZSH_AUTOSUGGEST_STRATEGY=(completion history) # suggest from completion then history
export ZSH_AUTOSUGGEST_USE_ASYNC=1 # make async for SPEED export ZSH_AUTOSUGGEST_USE_ASYNC=1 # make async for SPEED
export ZSH_AUTOSUGGEST_HISTORY_IGNORE='(cd|cp|tar|mv|ls|nvim|rm|rmdir|git) *' export ZSH_AUTOSUGGEST_HISTORY_IGNORE='(cd|cp|tar|mv|ls|nvim|rm|rmdir|git) *'
## Load Plugins with ZshPlug ## Load Plugins with ZshPlug
export ZSH_PLUG_plugins=( "zsh-users/zsh-autosuggestions" "zdharma-continuum/fast-syntax-highlighting" "MichaelAquilina/zsh-you-should-use" ) export ZSH_PLUG_plugins=( "zsh-users/zsh-autosuggestions" \
"zdharma-continuum/fast-syntax-highlighting" \
"jeffreytse/zsh-vi-mode" \
"MichaelAquilina/zsh-you-should-use"\
)
source $ZDOTDIR/ZshPlug/ZshPlug.zsh source $ZDOTDIR/ZshPlug/ZshPlug.zsh
[[ -n "${key[Home]}" ]] && bindkey "${key[Home]}" beginning-of-line [[ -n "${key[Home]}" ]] && bindkey "${key[Home]}" beginning-of-line