Refactor zsh and sh rcs
This commit is contained in:
parent
0e6e61c470
commit
52b054a2d2
5 changed files with 37 additions and 104 deletions
80
.gitignore
vendored
80
.gitignore
vendored
|
@ -1,80 +1,6 @@
|
||||||
*/.netrwhist
|
# no idea why gopass adds this image to config path
|
||||||
**/gopass-logo-small.png
|
gopass-logo-small.png
|
||||||
|
#
|
||||||
# Created by https://www.gitignore.io/api/vim,linux
|
|
||||||
# Edit at https://www.gitignore.io/?templates=vim,linux
|
|
||||||
|
|
||||||
### Linux ###
|
|
||||||
*~
|
|
||||||
|
|
||||||
# temporary files which can be created if a process still has a handle open of a deleted file
|
|
||||||
.fuse_hidden*
|
|
||||||
|
|
||||||
# KDE directory preferences
|
|
||||||
.directory
|
|
||||||
|
|
||||||
# Linux trash folder which might appear on any partition or disk
|
|
||||||
.Trash-*
|
|
||||||
|
|
||||||
# .nfs files are created when an open file is removed but is still being accessed
|
|
||||||
.nfs*
|
|
||||||
|
|
||||||
### Vim ###
|
|
||||||
# Swap
|
|
||||||
[._]*.s[a-v][a-z]
|
|
||||||
[._]*.sw[a-p]
|
|
||||||
[._]s[a-rt-v][a-z]
|
|
||||||
[._]ss[a-gi-z]
|
|
||||||
[._]sw[a-p]
|
|
||||||
|
|
||||||
# Session
|
|
||||||
Session.vim
|
|
||||||
Sessionx.vim
|
|
||||||
|
|
||||||
# Temporary
|
|
||||||
.netrwhist
|
|
||||||
|
|
||||||
# Auto-generated tag files
|
|
||||||
tags
|
|
||||||
|
|
||||||
# Persistent undo
|
|
||||||
[._]*.un~
|
|
||||||
|
|
||||||
# Coc configuration directory
|
|
||||||
.vim
|
|
||||||
|
|
||||||
### Zsh ###
|
|
||||||
# Zsh compiled script + zrecompile backup
|
|
||||||
*.zwc
|
|
||||||
*.zwc.old
|
|
||||||
|
|
||||||
# Zsh completion-optimization dumpfile
|
|
||||||
*zcompdump*
|
|
||||||
|
|
||||||
# Zsh zcalc history
|
|
||||||
.zcalc_history
|
|
||||||
|
|
||||||
# A popular plugin manager's files
|
|
||||||
._zplugin
|
|
||||||
.zplugin_lstupd
|
|
||||||
|
|
||||||
# zdharma/zshelldoc tool's files
|
|
||||||
zsdoc/data
|
|
||||||
|
|
||||||
# robbyrussell/oh-my-zsh/plugins/per-directory-history plugin's files
|
|
||||||
# (when set-up to store the history in the local directory)
|
|
||||||
.directory_history
|
|
||||||
|
|
||||||
# MichaelAquilina/zsh-autoswitch-virtualenv plugin's files
|
|
||||||
# (for Zsh plugins using Python)
|
|
||||||
.venv
|
|
||||||
|
|
||||||
# Zunit tests' output
|
|
||||||
/tests/_output/*
|
|
||||||
!/tests/_output/.gitkeep
|
|
||||||
|
|
||||||
# End of https://www.gitignore.io/api/vim,linux,zsh
|
|
||||||
|
|
||||||
# Ignore dynamic colorschemes set by styler
|
# Ignore dynamic colorschemes set by styler
|
||||||
colorscheme.vim
|
colorscheme.vim
|
||||||
colorscheme
|
colorscheme
|
||||||
|
|
|
@ -52,6 +52,8 @@ if exist git; then
|
||||||
alias gd='git diff'
|
alias gd='git diff'
|
||||||
alias gds='git diff --staged'
|
alias gds='git diff --staged'
|
||||||
|
|
||||||
|
alias gi='git ignore'
|
||||||
|
|
||||||
alias glog='git log --stat'
|
alias glog='git log --stat'
|
||||||
alias glg='git log --oneline --decorate --graph'
|
alias glg='git log --oneline --decorate --graph'
|
||||||
alias glga='git log --oneline --decorate --graph --remotes --all'
|
alias glga='git log --oneline --decorate --graph --remotes --all'
|
||||||
|
@ -66,7 +68,7 @@ if exist git; then
|
||||||
alias grv='git remote -v'
|
alias grv='git remote -v'
|
||||||
|
|
||||||
alias grs='git restore --staged'
|
alias grs='git restore --staged'
|
||||||
alias grss='git restore'
|
alias grs!='git restore'
|
||||||
|
|
||||||
alias grbi='git rebase -i'
|
alias grbi='git rebase -i'
|
||||||
alias grbc='git rebase --continue'
|
alias grbc='git rebase --continue'
|
||||||
|
@ -94,9 +96,11 @@ if exist fzf; then
|
||||||
# Display fuzzy-searchable history
|
# Display fuzzy-searchable history
|
||||||
alias fzf_history="history | fzf --tac --height 20"
|
alias fzf_history="history | fzf --tac --height 20"
|
||||||
# Fuzzy search packages to install
|
# Fuzzy search packages to install
|
||||||
alias fzf_yay="yay -Slq | fzf -m --preview 'yay -Si {1}' | xargs -ro yay -S"
|
if exist yay; then
|
||||||
# Fuzzy uninstall packages
|
alias fzf_yay="yay -Slq | fzf -m --preview 'yay -Si {1}' | xargs -ro yay -S"
|
||||||
alias fzf_yayrns="yay -Qeq | fzf -m --preview 'yay -Qi {1}' | xargs -ro yay -Rns"
|
# Fuzzy uninstall packages
|
||||||
|
alias fzf_yayrns="yay -Qeq | fzf -m --preview 'yay -Qi {1}' | xargs -ro yay -Rns"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# vifm
|
# vifm
|
||||||
|
@ -106,5 +110,3 @@ if exist vifm; then
|
||||||
# enable picture preview script
|
# enable picture preview script
|
||||||
exist vifmrun && alias vifm=vifmrun
|
exist vifmrun && alias vifm=vifmrun
|
||||||
fi
|
fi
|
||||||
|
|
||||||
unset -f exist
|
|
||||||
|
|
|
@ -40,5 +40,5 @@ export GOPATH="$HOME/projects/gopath/"
|
||||||
export PATH="$PATH:$GOPATH/bin"
|
export PATH="$PATH:$GOPATH/bin"
|
||||||
|
|
||||||
## LANG LOCALE UTF-8
|
## LANG LOCALE UTF-8
|
||||||
export LC_ALL="en_US.utf-8"
|
export LC_ALL="en_US.UTF-8"
|
||||||
export LANG="en_US.utf-8"
|
export LANG="en_US.UTF-8"
|
||||||
|
|
|
@ -348,7 +348,7 @@
|
||||||
|
|
||||||
# Untracked files icon. It's really a question mark, your font isn't broken.
|
# 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.
|
# Change the value of this parameter to show a different icon.
|
||||||
typeset -g POWERLEVEL9K_VCS_UNTRACKED_ICON='?'
|
typeset -g POWERLEVEL9K_VCS_UNTRACKED_ICON='…'
|
||||||
POWERLEVEL9K_VCS_UNTRACKED_ICON=${(g::)POWERLEVEL9K_VCS_UNTRACKED_ICON}
|
POWERLEVEL9K_VCS_UNTRACKED_ICON=${(g::)POWERLEVEL9K_VCS_UNTRACKED_ICON}
|
||||||
|
|
||||||
# Formatter for Git status.
|
# Formatter for Git status.
|
||||||
|
@ -409,19 +409,19 @@
|
||||||
res+="${meta}:${clean}${(V)VCS_STATUS_REMOTE_BRANCH//\%/%%}" # escape %
|
res+="${meta}:${clean}${(V)VCS_STATUS_REMOTE_BRANCH//\%/%%}" # escape %
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# ⇣42 if behind the remote.
|
# ⇣42 if behind the remote. customized to ↓
|
||||||
(( VCS_STATUS_COMMITS_BEHIND )) && res+=" ${clean}⇣${VCS_STATUS_COMMITS_BEHIND}"
|
(( VCS_STATUS_COMMITS_BEHIND )) && res+=" ${clean}↓${VCS_STATUS_COMMITS_BEHIND}"
|
||||||
# ⇡42 if ahead of the remote; no leading space if also behind the remote: ⇣42⇡42.
|
# ⇡42 if ahead of the remote; no leading space if also behind the remote: ⇣42⇡42. ch to ↑
|
||||||
(( VCS_STATUS_COMMITS_AHEAD && !VCS_STATUS_COMMITS_BEHIND )) && res+=" "
|
(( VCS_STATUS_COMMITS_AHEAD && !VCS_STATUS_COMMITS_BEHIND )) && res+=" "
|
||||||
(( VCS_STATUS_COMMITS_AHEAD )) && res+="${clean}⇡${VCS_STATUS_COMMITS_AHEAD}"
|
(( VCS_STATUS_COMMITS_AHEAD )) && res+="${clean}↑${VCS_STATUS_COMMITS_AHEAD}"
|
||||||
# *42 if have stashes.
|
# *42 if have stashes.
|
||||||
(( VCS_STATUS_STASHES )) && res+=" ${clean}*${VCS_STATUS_STASHES}"
|
(( VCS_STATUS_STASHES )) && res+=" ${clean}⚑${VCS_STATUS_STASHES}"
|
||||||
# 'merge' if the repo is in an unusual state.
|
# 'merge' if the repo is in an unusual state.
|
||||||
[[ -n $VCS_STATUS_ACTION ]] && res+=" ${conflicted}${VCS_STATUS_ACTION}"
|
[[ -n $VCS_STATUS_ACTION ]] && res+=" ${conflicted}${VCS_STATUS_ACTION}"
|
||||||
# ~42 if have merge conflicts.
|
# ~42 if have merge conflicts.
|
||||||
(( VCS_STATUS_NUM_CONFLICTED )) && res+=" ${conflicted}~${VCS_STATUS_NUM_CONFLICTED}"
|
(( VCS_STATUS_NUM_CONFLICTED )) && res+=" ${conflicted}✖${VCS_STATUS_NUM_CONFLICTED}"
|
||||||
# +42 if have staged changes.
|
# +42 if have staged changes.
|
||||||
(( VCS_STATUS_NUM_STAGED )) && res+=" ${modified}+${VCS_STATUS_NUM_STAGED}"
|
(( VCS_STATUS_NUM_STAGED )) && res+=" ${modified}●${VCS_STATUS_NUM_STAGED}"
|
||||||
# !42 if have unstaged changes.
|
# !42 if have unstaged changes.
|
||||||
(( VCS_STATUS_NUM_UNSTAGED )) && res+=" ${modified}!${VCS_STATUS_NUM_UNSTAGED}"
|
(( VCS_STATUS_NUM_UNSTAGED )) && res+=" ${modified}!${VCS_STATUS_NUM_UNSTAGED}"
|
||||||
# ?42 if have untracked files. It's really a question mark, your font isn't broken.
|
# ?42 if have untracked files. It's really a question mark, your font isn't broken.
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
#!/usr/bin/env zsh
|
#!/usr/bin/env zsh
|
||||||
#
|
#
|
||||||
|
|
||||||
|
CONFDIR="${XDG_CONFIG_HOME:-$HOME/.config}"
|
||||||
|
ZSHCONFDIR="$CONFDIR/zsh"
|
||||||
|
|
||||||
# Set completion style
|
# Set completion style
|
||||||
# The following lines were added by compinstall
|
# The following lines were added by compinstall
|
||||||
zstyle ':completion:*' completer _complete _ignored _approximate
|
zstyle ':completion:*' completer _complete _ignored _approximate
|
||||||
|
@ -8,7 +11,7 @@ zstyle ':completion:*' list-colors ''
|
||||||
zstyle ':completion:*' matcher-list '' '+m:{[:lower:]}={[:upper:]} r:|[._-]=** r:|=**'
|
zstyle ':completion:*' matcher-list '' '+m:{[:lower:]}={[:upper:]} r:|[._-]=** r:|=**'
|
||||||
zstyle ':completion:*' menu select=1
|
zstyle ':completion:*' menu select=1
|
||||||
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s
|
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s
|
||||||
zstyle :compinstall filename '/home/marty/.config/zsh/.zshrc'
|
zstyle :compinstall filename "$ZSHCONFDIR/.zshrc"
|
||||||
# End of lines added by compinstall
|
# End of lines added by compinstall
|
||||||
autoload -Uz compinit zmv
|
autoload -Uz compinit zmv
|
||||||
compinit
|
compinit
|
||||||
|
@ -22,13 +25,13 @@ fi
|
||||||
|
|
||||||
|
|
||||||
# load all plugins
|
# load all plugins
|
||||||
[ -f "$XDG_CONFIG_HOME/zsh/plugins.zsh" ] && source "$XDG_CONFIG_HOME/zsh/plugins.zsh"
|
[ -f "$ZSHCONFDIR/plugins.zsh" ] && source "$ZSHCONFDIR/plugins.zsh"
|
||||||
|
|
||||||
# shellcheck source=alias
|
# shellcheck source=alias
|
||||||
[ -f "$XDG_CONFIG_HOME/sh/alias" ] && source "$XDG_CONFIG_HOME/sh/alias"
|
[ -f "$CONFDIR/sh/alias" ] && source "$CONFDIR/sh/alias"
|
||||||
# load additional aliases
|
# load additional aliases
|
||||||
if [ -d "$XDG_CONFIG_HOME/sh/alias.d" ]; then
|
if [ -d "$CONFDIR/sh/alias.d" ]; then
|
||||||
for _alias in "$XDG_CONFIG_HOME/sh/alias.d"/*.sh; do
|
for _alias in "$CONFDIR/sh/alias.d"/*.sh; do
|
||||||
. "$_alias"
|
. "$_alias"
|
||||||
done
|
done
|
||||||
unset _alias
|
unset _alias
|
||||||
|
@ -44,7 +47,7 @@ ENABLE_CORRECTION="true"
|
||||||
# Speed up autocomplete, force prefix mapping
|
# Speed up autocomplete, force prefix mapping
|
||||||
zstyle ':completion:*' accept-exact '*(N)'
|
zstyle ':completion:*' accept-exact '*(N)'
|
||||||
zstyle ':completion:*' use-cache on
|
zstyle ':completion:*' use-cache on
|
||||||
zstyle ':completion:*' cache-path ~/.zsh/cache
|
zstyle ':completion:*' cache-path "${XDG_CACHE_HOME:-$HOME/.cache}/zshcompcache"
|
||||||
# shellcheck disable=SC2016
|
# shellcheck disable=SC2016
|
||||||
zstyle -e ':completion:*:default' list-colors 'reply=("${PREFIX:+=(#bi)($PREFIX:t)*==34=34}:${(s.:.)LS_COLORS}")'
|
zstyle -e ':completion:*:default' list-colors 'reply=("${PREFIX:+=(#bi)($PREFIX:t)*==34=34}:${(s.:.)LS_COLORS}")'
|
||||||
|
|
||||||
|
@ -67,6 +70,7 @@ export HISTSIZE=100000
|
||||||
export SAVEHIST=100000
|
export SAVEHIST=100000
|
||||||
export HISTFILE="$XDG_DATA_HOME/zsh_history"
|
export HISTFILE="$XDG_DATA_HOME/zsh_history"
|
||||||
export HISTIGNORE="ls:cd:cd -:pwd:exit:date:* --help"
|
export HISTIGNORE="ls:cd:cd -:pwd:exit:date:* --help"
|
||||||
|
|
||||||
## Set ZSH History aliases
|
## Set ZSH History aliases
|
||||||
# Show the top 5 commands used in recent history
|
# Show the top 5 commands used in recent history
|
||||||
history_top() {
|
history_top() {
|
||||||
|
@ -89,11 +93,7 @@ bindkey " " globalias
|
||||||
bindkey "^ " magic-space # control-space to bypass completion
|
bindkey "^ " magic-space # control-space to bypass completion
|
||||||
bindkey -M isearch " " magic-space # normal space during searches
|
bindkey -M isearch " " magic-space # normal space during searches
|
||||||
|
|
||||||
# To customize prompt, run `p10k configure` or edit ~/.config/zsh/.p10k.zsh.
|
# Deduplicate PATH - remove any duplicate entries from PATH
|
||||||
[[ ! -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
|
# from: https://unix.stackexchange.com/questions/40749/remove-duplicate-path-entries-with-awk-command
|
||||||
get_var() {
|
get_var() {
|
||||||
eval 'printf "%s\n" "${'"$1"'}"'
|
eval 'printf "%s\n" "${'"$1"'}"'
|
||||||
|
@ -110,3 +110,8 @@ dedup_pathvar() {
|
||||||
dedup_pathvar PATH
|
dedup_pathvar PATH
|
||||||
dedup_pathvar MANPATH
|
dedup_pathvar MANPATH
|
||||||
|
|
||||||
|
# To customize prompt, run `p10k configure` or edit ~/.config/zsh/.p10k.zsh.
|
||||||
|
[[ ! -f "$ZSHCONFDIR/.p10k.zsh" ]] || source "$ZSHCONFDIR/.p10k.zsh"
|
||||||
|
|
||||||
|
unset CONFDIR
|
||||||
|
unset ZSHCONFDIR
|
||||||
|
|
Loading…
Reference in a new issue