added stuff
This commit is contained in:
parent
e8d9044d2b
commit
9d0ebdfbd0
907 changed files with 70990 additions and 0 deletions
11
nyx/homes/notashelf/programs/terminal/shell/zsh/rc/binds.zsh
Normal file
11
nyx/homes/notashelf/programs/terminal/shell/zsh/rc/binds.zsh
Normal file
|
@ -0,0 +1,11 @@
|
|||
# Enable Vi mode
|
||||
bindkey -v
|
||||
|
||||
# Use vim keys in the tab complete menu
|
||||
bindkey -M menuselect 'h' vi-backward-char
|
||||
bindkey -M menuselect 'k' vi-up-line-or-history
|
||||
bindkey -M menuselect 'l' vi-forward-char
|
||||
bindkey -M menuselect 'j' vi-down-line-or-history
|
||||
|
||||
bindkey "^A" vi-beginning-of-line
|
||||
bindkey "^E" vi-end-of-line
|
95
nyx/homes/notashelf/programs/terminal/shell/zsh/rc/comp.zsh
Normal file
95
nyx/homes/notashelf/programs/terminal/shell/zsh/rc/comp.zsh
Normal file
|
@ -0,0 +1,95 @@
|
|||
# Completion
|
||||
# autoload -U compinit
|
||||
zstyle ':completion:*' menu select
|
||||
zmodload zsh/complist
|
||||
compinit -d "$XDG_CACHE_HOME"/zsh/zcompdump-"$ZSH_VERSION"
|
||||
_comp_options+=(globdots)
|
||||
|
||||
# Group matches and describe.
|
||||
zstyle ':completion:*' sort false
|
||||
zstyle ':completion:complete:*:options' sort false
|
||||
zstyle ':completion:*' matcher-list 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]} l:|=* r:|=*' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]} l:|=* r:|=*' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]} l:|=* r:|=*'
|
||||
zstyle ':completion:*' special-dirs true
|
||||
zstyle ':completion:*' rehash true
|
||||
|
||||
# Sort completions
|
||||
# disable sort when completing `git checkout`
|
||||
zstyle ':completion:*:git-checkout:*' sort false
|
||||
# set descriptions format to enable group support
|
||||
zstyle ':completion:*:descriptions' format '[%d]'
|
||||
# set list-colors to enable filename colorizing
|
||||
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
|
||||
# preview directory's content when completing cd
|
||||
zstyle ':fzf-tab:complete:cd:*' fzf-preview 'ls -lAhF --group-directories-first --show-control-chars --quoting-style=escape --color=always $realpath'
|
||||
zstyle ':fzf-tab:complete:cd:*' popup-pad 20 0
|
||||
zstyle ':completion:*' file-sort modification
|
||||
zstyle ':completion:*:eza' sort false
|
||||
zstyle ':completion:files' sort false
|
||||
|
||||
# Job IDs
|
||||
zstyle ':completion:*:jobs' numbers true
|
||||
zstyle ':completion:*:jobs' verbose true
|
||||
|
||||
# Array completion element sorting.
|
||||
zstyle ':completion:*:*:-subscript-:*' tag-order indexes parameters
|
||||
|
||||
# Don't complete unavailable commands.
|
||||
zstyle ':completion:*:functions' ignored-patterns '(_*|pre(cmd|exec))'
|
||||
|
||||
# No correction
|
||||
zstyle ':completion:*' completer _oldlist _expand _complete _files _ignored
|
||||
|
||||
# Don't insert tabs when there is no completion (e.g. beginning of line)
|
||||
zstyle ':completion:*' insert-tab false
|
||||
|
||||
# allow one error for every three characters typed in approximate completer
|
||||
zstyle ':completion:*:approximate:' max-errors 'reply=( $((($#PREFIX+$#SUFFIX)/3 )) numeric )'
|
||||
|
||||
# start menu completion only if it could find no unambiguous initial string
|
||||
zstyle ':completion:*:correct:*' insert-unambiguous true
|
||||
zstyle ':completion:*:corrections' format $'%{\e[0;31m%}%d (errors: %e)%{\e[0m%}'
|
||||
zstyle ':completion:*:correct:*' original true
|
||||
|
||||
# List directory completions first
|
||||
zstyle ':completion:*' list-dirs-first true
|
||||
# Offer the original completion when using expanding / approximate completions
|
||||
zstyle ':completion:*' original true
|
||||
# Treat multiple slashes as a single / like UNIX does (instead of as /*/)
|
||||
zstyle ':completion:*' squeeze-slashes true
|
||||
|
||||
# insert all expansions for expand completer
|
||||
# # ???????????????ßß
|
||||
zstyle ':completion:*:expand:*' tag-order all-expansions
|
||||
|
||||
# match uppercase from lowercase
|
||||
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
|
||||
|
||||
# separate matches into groups
|
||||
zstyle ':completion:*:matches' group 'yes'
|
||||
zstyle ':completion:*' group-name ''
|
||||
|
||||
zstyle ':completion:*:messages' format '%d'
|
||||
zstyle ':completion:*:options' auto-description '%d'
|
||||
|
||||
# describe options in full
|
||||
zstyle ':completion:*:options' description 'yes'
|
||||
|
||||
# on processes completion complete all user processes
|
||||
zstyle ':completion:*:processes' command 'ps -au$USER'
|
||||
|
||||
# provide verbose completion information
|
||||
zstyle ':completion:*' verbose true
|
||||
|
||||
# Ignore completion functions for commands you don't have:
|
||||
zstyle ':completion::(^approximate*):*:functions' ignored-patterns '_*'
|
||||
|
||||
# Provide more processes in completion of programs like killall:
|
||||
zstyle ':completion:*:processes-names' command 'ps c -u ${USER} -o command | uniq'
|
||||
|
||||
# complete manual by their section
|
||||
zstyle ':completion:*:manuals' separate-sections true
|
||||
zstyle ':completion:*:manuals.*' insert-sections true
|
||||
zstyle ':completion:*:man:*' menu yes select
|
||||
|
||||
# provide .. as a completion
|
||||
zstyle ':completion:*' special-dirs ..
|
73
nyx/homes/notashelf/programs/terminal/shell/zsh/rc/fzf.zsh
Normal file
73
nyx/homes/notashelf/programs/terminal/shell/zsh/rc/fzf.zsh
Normal file
|
@ -0,0 +1,73 @@
|
|||
autoload -U add-zle-hook-widget
|
||||
|
||||
# autosuggests otherwise breaks these widgets.
|
||||
# <https://github.com/zsh-users/zsh-autosuggestions/issues/619>
|
||||
ZSH_AUTOSUGGEST_CLEAR_WIDGETS+=(history-beginning-search-backward-end history-beginning-search-forward-end)
|
||||
|
||||
# FZF widgets
|
||||
function __fzf() {
|
||||
if [[ -n "$TMUX_PANE" && ( "${FZF_TMUX:-0}" != 0 || -n "$FZF_TMUX_OPTS" ) ]]; then
|
||||
fzf-tmux -d"${FZF_TMUX_HEIGHT:-40%}" -- "$@"
|
||||
else
|
||||
fzf "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
function __fzf_select() {
|
||||
setopt localoptions pipefail no_aliases 2>/dev/null
|
||||
local item
|
||||
FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} --reverse --bind=ctrl-z:ignore,tab:down,btab:up,change:top,ctrl-space:toggle $FZF_DEFAULT_OPTS" __fzf "$@" | while read item; do
|
||||
echo -n "${(q)item} "
|
||||
done
|
||||
local ret=$?
|
||||
echo
|
||||
return $ret
|
||||
}
|
||||
|
||||
function __fzf_find_files() {
|
||||
local include_hidden=${1:-0}
|
||||
local types=${2:-fdl}
|
||||
shift 2
|
||||
local type_selectors=()
|
||||
local i
|
||||
for (( i=0; i<${#types}; i++ )); do
|
||||
[[ "$i" -gt 0 ]] && type_selectors+=('-o')
|
||||
type_selectors+=('-type' "${types:$i:1}")
|
||||
done
|
||||
local hide_hidden_files=()
|
||||
if [[ $include_hidden == "0" ]]; then
|
||||
hide_hidden_files=('-path' '*/\.*' '-o')
|
||||
fi
|
||||
setopt localoptions pipefail no_aliases 2>/dev/null
|
||||
command find -L . -mindepth 1 \
|
||||
\( "${hide_hidden_files[@]}" -fstype 'sysfs' -o -fstype 'devfs' -o -fstype 'devtmpfs' -o -fstype 'proc' \) -prune \
|
||||
-o \( "${type_selectors[@]}" \) -print \
|
||||
| __fzf_select "$@"
|
||||
}
|
||||
|
||||
function __fzf_find_files_widget_helper() {
|
||||
LBUFFER="${LBUFFER}$(__fzf_find_files "$@")"
|
||||
local ret=$?
|
||||
zle reset-prompt
|
||||
return $ret
|
||||
}
|
||||
|
||||
function fzf-select-file-or-dir() { __fzf_find_files_widget_helper 0 fdl -m; }; zle -N fzf-select-file-or-dir
|
||||
function fzf-select-file-or-dir-hidden() { __fzf_find_files_widget_helper 1 fdl -m; }; zle -N fzf-select-file-or-dir-hidden
|
||||
function fzf-select-dir() { __fzf_find_files_widget_helper 0 d -m; }; zle -N fzf-select-dir
|
||||
function fzf-select-dir-hidden() { __fzf_find_files_widget_helper 1 d -m; }; zle -N fzf-select-dir-hidden
|
||||
function fzf-cd() {
|
||||
local dir="$(__fzf_find_files 0 d +m)"
|
||||
if [[ -z "$dir" ]]; then
|
||||
zle redisplay
|
||||
return 0
|
||||
fi
|
||||
zle push-line # Clear buffer. Auto-restored on next prompt.
|
||||
BUFFER="cd -- $dir"
|
||||
zle accept-line
|
||||
local ret=$?
|
||||
unset dir # ensure this doesn't end up appearing in prompt expansion
|
||||
zle reset-prompt
|
||||
return $ret
|
||||
}
|
||||
zle -N fzf-cd
|
22
nyx/homes/notashelf/programs/terminal/shell/zsh/rc/misc.zsh
Normal file
22
nyx/homes/notashelf/programs/terminal/shell/zsh/rc/misc.zsh
Normal file
|
@ -0,0 +1,22 @@
|
|||
# If this is an xterm set the title to user@host:dir
|
||||
case "$TERM" in
|
||||
xterm*|rxvt*|Eterm|aterm|kterm|gnome*|alacritty|kitty*)
|
||||
TERM_TITLE=$'\e]0;%n@%m: %1~\a'
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
# enable keyword-style arguments in shell functions
|
||||
set -k
|
||||
|
||||
# Colors
|
||||
autoload -Uz colors && colors
|
||||
|
||||
# Autosuggest
|
||||
ZSH_AUTOSUGGEST_USE_ASYNC="true"
|
||||
|
||||
# open commands in $EDITOR
|
||||
autoload -z edit-command-line
|
||||
zle -N edit-command-line
|
||||
bindkey "^e" edit-command-line
|
|
@ -0,0 +1,8 @@
|
|||
# zsh Line Editor (ZLE) module
|
||||
zmodload zsh/zle
|
||||
|
||||
# zsh pseudo-terminal (PTY) module
|
||||
zmodload zsh/zpty
|
||||
|
||||
# zsh completion list (complist) module
|
||||
zmodload zsh/complist
|
31
nyx/homes/notashelf/programs/terminal/shell/zsh/rc/set.zsh
Normal file
31
nyx/homes/notashelf/programs/terminal/shell/zsh/rc/set.zsh
Normal file
|
@ -0,0 +1,31 @@
|
|||
# Define a function to set Zsh options
|
||||
function set_zsh_options() {
|
||||
local options=(
|
||||
"AUTO_CD" # if not command, then directory
|
||||
"AUTO_LIST" # list choices on ambiguous completion
|
||||
"AUTO_MENU" # use menu completion after the second consecutive request for completion
|
||||
"AUTO_PARAM_SLASH" # if parameter is completed whose content is the name of a directory, then add trailing slash instead of space
|
||||
"AUTO_PUSHD" # make cd push the old directory onto the directory stack
|
||||
"APPEND_HISTORY" # append history list to the history file, rather than replace it
|
||||
"ALWAYS_TO_END" # cursor is moved to the end of the word after completion
|
||||
"CORRECT" # try to correct the spelling of commands
|
||||
"EXTENDED_HISTORY" # save each command’s beginning timestamp and the duration to the history file
|
||||
"HIST_FCNTL_LOCK" # use system’s fcntl call to lock the history file
|
||||
"HIST_REDUCE_BLANKS" # remove superfluous blanks
|
||||
"HIST_SAVE_NO_DUPS" # older commands that duplicate newer ones are omitted
|
||||
"HIST_VERIFY" # don’t execute the line directly; instead perform history expansion and reload the line into the editing buffer
|
||||
"INC_APPEND_HISTORY" # new history lines are added to the $HISTFILE incrementally (as soon as they are entered)
|
||||
"INTERACTIVE_COMMENTS" # allow comments even in interactive shells
|
||||
"MENU_COMPLETE" # insert the first match immediately on ambiguous completion
|
||||
"NO_NOMATCH" # not explained, probably disables NOMATCH lmao
|
||||
"PUSHD_IGNORE_DUPS" # don’t push multiple copies of the same directory
|
||||
"PUSHD_TO_HOME" # have pushd with no arguments act like `pushd $HOME`
|
||||
"PUSHD_SILENT" # do not print the directory stack
|
||||
)
|
||||
|
||||
for option in "${options[@]}"; do
|
||||
setopt $option
|
||||
done
|
||||
}
|
||||
|
||||
set_zsh_options
|
14
nyx/homes/notashelf/programs/terminal/shell/zsh/rc/unset.zsh
Normal file
14
nyx/homes/notashelf/programs/terminal/shell/zsh/rc/unset.zsh
Normal file
|
@ -0,0 +1,14 @@
|
|||
# Define a function to unset Zsh options
|
||||
function unset_zsh_options() {
|
||||
local options=(
|
||||
"CORRECT_ALL" # try to correct the spelling of all arguments in a line.
|
||||
"HIST_BEEP" # beep in ZLE when a widget attempts to access a history entry which isn’t there
|
||||
"SHARE_HISTORY" # read the documentation for more details
|
||||
)
|
||||
|
||||
for option in "${options[@]}"; do
|
||||
unsetopt $option
|
||||
done
|
||||
}
|
||||
|
||||
unset_zsh_options
|
Loading…
Add table
Add a link
Reference in a new issue