refactor: Move some zsh configs to include/
directory
Create symbolic for compatibility
This commit is contained in:
parent
cf67663fed
commit
45435ee15e
12 changed files with 337 additions and 329 deletions
|
@ -12,7 +12,7 @@ setopt auto_cd # auto cd if directory
|
|||
__CONFIG_DIR=${XDG_CONFIG_HOME:-$HOME/.config}
|
||||
|
||||
# highlight on tab (completion)
|
||||
[ -f $__CONFIG_DIR/zsh/completion ] && source $__CONFIG_DIR/zsh/completion
|
||||
[ -f $__CONFIG_DIR/zsh/include/completion ] && source $__CONFIG_DIR/zsh/include/completion
|
||||
# zstyle ':completion:*:*:git:*' script /usr/local/etc/bash_completion.d/git-completion.bash
|
||||
# fpath=(/usr/local/share/zsh-completions $fpath)
|
||||
# autoload -U compinit && compinit -u
|
||||
|
@ -20,10 +20,10 @@ __CONFIG_DIR=${XDG_CONFIG_HOME:-$HOME/.config}
|
|||
# zstyle ':completion:*' menu select
|
||||
|
||||
# Alias
|
||||
[ -f $__CONFIG_DIR/zsh/aliases ] && source $__CONFIG_DIR/zsh/aliases
|
||||
[ -f $__CONFIG_DIR/zsh/include/aliases ] && source $__CONFIG_DIR/zsh/include/aliases
|
||||
|
||||
# Theme
|
||||
[ -f $__CONFIG_DIR/zsh/theme ] && source $__CONFIG_DIR/zsh/theme
|
||||
[ -f $__CONFIG_DIR/zsh/include/theme ] && source $__CONFIG_DIR/zsh/include/theme
|
||||
|
||||
# opam
|
||||
test -r /home/ziro/.opam/opam-init/init.zsh && . /home/ziro/.opam/opam-init/init.zsh > /dev/null 2> /dev/null || true
|
||||
|
@ -39,7 +39,7 @@ bindkey -v
|
|||
export KEYTIMEOUT=1
|
||||
|
||||
# Keybindings
|
||||
[ -f $__CONFIG_DIR/zsh/keybinds ] && source $__CONFIG_DIR/zsh/keybinds
|
||||
[ -f $__CONFIG_DIR/zsh/include/keybinds ] && source $__CONFIG_DIR/zsh/include/keybinds
|
||||
|
||||
# [[ Plugins
|
||||
ZSH_PLUGINS="$XDG_DATA_HOME/zsh/plugins"
|
||||
|
|
|
@ -1,136 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
# i need sudo to launch emulator
|
||||
alias pixelemu="sudo $HOME/Library/Android/sdk/emulator/emulator @Pixel_2_API_28"
|
||||
alias mbrew="sudo -H -u maintenance -g staff brew"
|
||||
fi
|
||||
|
||||
alias punten='doas'
|
||||
#sudo + vim without sacrificing config
|
||||
alias sudovim='sudoedit'
|
||||
alias doasvim='doasedit'
|
||||
|
||||
#switch to pgsql user
|
||||
alias pg='doas -u postgres'
|
||||
|
||||
#mysql with color
|
||||
# alias mysql=$(echo -e 'mysql --prompt="\x1B[34m\\d\x1B[32m \n>\x1B[0m "')
|
||||
|
||||
#vim
|
||||
alias nano=nvim
|
||||
alias vim=nvim
|
||||
alias vimsudo='sudoedit /etc/sudoers'
|
||||
alias vimdoas='doasedit /etc/sudoers'
|
||||
alias vi=nvim
|
||||
alias v=nvim
|
||||
|
||||
#emacs
|
||||
alias emacs="emacs -nw"
|
||||
|
||||
#mutt
|
||||
alias mutt="neomutt"
|
||||
|
||||
#curl
|
||||
alias weather='curl wttr.in'
|
||||
|
||||
#install
|
||||
alias p='doas pacman'
|
||||
alias a='paru'
|
||||
|
||||
#ripper
|
||||
alias yt='yt-dlp --add-metadata'
|
||||
alias yta='yt-dlp --add-metadata -x --audio-format'
|
||||
alias xreload='xrdb $HOME/.config/Xresources'
|
||||
|
||||
#clean up
|
||||
alias wget='wget --hsts-file="$XDG_CACHE_HOME/wget-hsts"'
|
||||
|
||||
#shortcuts
|
||||
alias ytv='youtube-viewer'
|
||||
alias gravit="$HOME/my\ Files/Gravit/GravitDesigner.AppImage"
|
||||
alias redoom="$HOME/doom refresh"
|
||||
alias rvim='doas vim'
|
||||
alias py='python'
|
||||
alias cls='clear'
|
||||
alias classprop='xprop WM_CLASS'
|
||||
alias storagelist='lsblk -f'
|
||||
alias ..='cd ..'
|
||||
alias ...='cd ../..'
|
||||
alias ....='cd ../../..'
|
||||
alias .....='cd ../../../..'
|
||||
alias q='exit'
|
||||
|
||||
#ls stuff
|
||||
alias l='exa --color=always --group-directories-first' # my preferred listing
|
||||
alias ls='exa --color=always --group-directories-first' # my preferred listing
|
||||
alias la='exa -a --color=always --group-directories-first' # all files and dirs
|
||||
alias ll='exa -l --color=always --group-directories-first' # long format
|
||||
alias lla='exa -al --color=always --group-directories-first' # long format
|
||||
alias lt='exa -aT --color=always --group-directories-first' # tree listing
|
||||
|
||||
alias md='mkdir -p'
|
||||
alias rd='rmdir'
|
||||
|
||||
alias reUSD='rm -rf /tmp/rate.html /tmp/rateUSD.txt'
|
||||
#alias mpv='mpv --geometry=1280x720'
|
||||
|
||||
#config shortcuts
|
||||
alias config='cd ${DOTFILES:-$HOME/Build/GIT/dotfiles}'
|
||||
alias cfg='config'
|
||||
alias cfvim='vim $XDG_CONFIG_HOME/nvim/init.lua'
|
||||
alias cfvimplug='vim $XDG_CONFIG_HOME/nvim/lua/null/plugins/'
|
||||
alias cfvimnix='vim $XDG_CONFIG_HOME/nvim/lua/null/nix.lua'
|
||||
alias cfvimuni='vim $XDG_CONFIG_HOME/nvim/lua/null/config.lua'
|
||||
alias cfbash='vim $HOME/.bashrc'
|
||||
alias cfzsh='vim $XDG_CONFIG_HOME/zsh/.zshrc'
|
||||
alias cfxres='vim $XDG_CONFIG_HOME/Xresources'
|
||||
alias cfbsp='vim $XDG_CONFIG_HOME/bspwm/bspwmrc'
|
||||
alias cfqtile='vim $XDG_CONFIG_HOME/qtile/config.py'
|
||||
alias cfpoly='vim $XDG_CONFIG_HOME/polybar/config'
|
||||
alias cfkeys='vim $XDG_CONFIG_HOME/sxhkd/sxhkdrc'
|
||||
alias cfalias='vim $XDG_CONFIG_HOME/zsh/aliases'
|
||||
alias cfbind='vim $XDG_CONFIG_HOME/zsh/keybinds'
|
||||
alias cfprofile='vim $XDG_CONFIG_HOME/zsh/.zprofile'
|
||||
alias cfxprofile='vim $XDG_CONFIG_HOME/xprofile'
|
||||
alias cfcompt='vim $XDG_CONFIG_HOME/picom/picom.conf'
|
||||
alias cfenv='vim $XDG_CONFIG_HOME/zsh/.zshenv'
|
||||
alias cfmutt='vim $XDG_CONFIG_HOME/mutt/muttrc'
|
||||
alias cfnews='vim $XDG_CONFIG_HOME/newsboat/urls'
|
||||
|
||||
#more shortcuts
|
||||
alias htop='htop -t'
|
||||
alias rm='rm -i'
|
||||
alias mv='mv -i'
|
||||
alias cp='cp -i'
|
||||
alias mntfd='doas mount -o gid=users,fmask=113,dmask=002'
|
||||
alias umntfd='doas umount'
|
||||
alias cmatrix='unimatrix -n -s 96 -l "o"'
|
||||
alias s='cd $HOME/.local/bin/scripts;ls'
|
||||
|
||||
#folder shortcut
|
||||
alias cdclg='cd "$HOME/my Files/Kuliah/"'
|
||||
alias cdwine='cd "$HOME/.local/share/wineprefixes/"'
|
||||
|
||||
#Git Aliases
|
||||
alias cdgit='cd $HOME/Build/GIT'
|
||||
alias gaa='git add -A'
|
||||
alias gci='git commit'
|
||||
alias gca='git commit --all'
|
||||
alias gr='git rm'
|
||||
alias gR='git restore'
|
||||
alias gs='git status'
|
||||
alias gp='git push'
|
||||
alias gP='git pull'
|
||||
alias gcl='git clone'
|
||||
#alias config='/usr/bin/git --git-dir=$HOME/dotfiles/ --work-tree=$HOME'
|
||||
|
||||
alias qn='vim $HOME/Documents/QuickNote'
|
||||
|
||||
alias docx2pdf='lowriter --convert-to pdf'
|
||||
|
||||
alias mirror-update='curl -s "https://archlinux.org/mirrorlist/?country=ID&country=SG&country=US&protocol=https&use_mirror_status=on" | sed -e 's/^#Server/Server/' -e '/^#/d' | rankmirrors -n 5 -'
|
||||
alias center-pfetch="printf '\n'; pfetch | sed '\$d' | center -l"
|
||||
[ "$TERM" = "xterm-kitty" ] && alias ssh="kitty +kitten ssh"
|
||||
|
||||
alias neofetch='fastfetch'
|
1
.config/zsh/aliases
Symbolic link
1
.config/zsh/aliases
Symbolic link
|
@ -0,0 +1 @@
|
|||
include/aliases
|
|
@ -1,76 +0,0 @@
|
|||
# vim: filetype=zsh
|
||||
zstyle ':completion:*:*:git:*' script /usr/local/etc/bash_completion.d/git-completion.bash
|
||||
fpath=(/usr/local/share/zsh-completions $fpath)
|
||||
|
||||
autoload -Uz compinit
|
||||
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
FPATH="$(brew --prefix)/share/zsh/site-functions:${FPATH}"
|
||||
compinit -u # homebrew moment, not recommended but whatever
|
||||
else
|
||||
compinit
|
||||
fi
|
||||
|
||||
zmodload -i zsh/complist
|
||||
zstyle ':completion:*' menu select
|
||||
|
||||
# case insensitive (all), partial-word and substring completion
|
||||
if [[ "$CASE_SENSITIVE" = true ]]; then
|
||||
zstyle ':completion:*' matcher-list 'r:|=*' 'l:|=* r:|=*'
|
||||
else
|
||||
if [[ "$HYPHEN_INSENSITIVE" = true ]]; then
|
||||
zstyle ':completion:*' matcher-list 'm:{a-zA-Z-_}={A-Za-z_-}' 'r:|=*' 'l:|=* r:|=*'
|
||||
else
|
||||
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|=*' 'l:|=* r:|=*'
|
||||
fi
|
||||
fi
|
||||
unset CASE_SENSITIVE HYPHEN_INSENSITIVE
|
||||
|
||||
# Complete . and .. special directories
|
||||
zstyle ':completion:*' special-dirs true
|
||||
|
||||
zstyle ':completion:*' list-colors ''
|
||||
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01'
|
||||
|
||||
if [[ "$OSTYPE" = solaris* ]]; then
|
||||
zstyle ':completion:*:*:*:*:processes' command "ps -u $USER -o pid,user,comm"
|
||||
else
|
||||
zstyle ':completion:*:*:*:*:processes' command "ps -u $USER -o pid,user,comm -w -w"
|
||||
fi
|
||||
|
||||
# disable named-directories autocompletion
|
||||
zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-directories
|
||||
|
||||
# Use caching so that commands like apt and dpkg complete are useable
|
||||
zstyle ':completion:*' use-cache yes
|
||||
zstyle ':completion:*' cache-path $ZSH_CACHE_DIR
|
||||
|
||||
# Don't complete uninteresting users
|
||||
zstyle ':completion:*:*:*:users' ignored-patterns \
|
||||
adm amanda apache at avahi avahi-autoipd beaglidx bin cacti canna \
|
||||
clamav daemon dbus distcache dnsmasq dovecot fax ftp games gdm \
|
||||
gkrellmd gopher hacluster haldaemon halt hsqldb ident junkbust kdm \
|
||||
ldap lp mail mailman mailnull man messagebus mldonkey mysql nagios \
|
||||
named netdump news nfsnobody nobody nscd ntp nut nx obsrun openvpn \
|
||||
operator pcap polkitd postfix postgres privoxy pulse pvm quagga radvd \
|
||||
rpc rpcuser rpm rtkit scard shutdown squid sshd statd svn sync tftp \
|
||||
usbmux uucp vcsa wwwrun xfs '_*'
|
||||
|
||||
# ... unless we really want to.
|
||||
zstyle '*' single-ignored show
|
||||
|
||||
if [[ $COMPLETION_WAITING_DOTS = true ]]; then
|
||||
expand-or-complete-with-dots() {
|
||||
# toggle line-wrapping off and back on again
|
||||
[[ -n "$terminfo[rmam]" && -n "$terminfo[smam]" ]] && echoti rmam
|
||||
print -Pn "%{%F{red}......%f%}"
|
||||
[[ -n "$terminfo[rmam]" && -n "$terminfo[smam]" ]] && echoti smam
|
||||
|
||||
zle expand-or-complete
|
||||
zle redisplay
|
||||
}
|
||||
zle -N expand-or-complete-with-dots
|
||||
bindkey "^I" expand-or-complete-with-dots
|
||||
fi
|
||||
|
||||
[ -s "/usr/share/zsh/site-functions/_pass" ] && zstyle ':completion:*' "/usr/share/zsh/site-functions/_pass"
|
1
.config/zsh/completion
Symbolic link
1
.config/zsh/completion
Symbolic link
|
@ -0,0 +1 @@
|
|||
include/completion
|
|
@ -1,5 +0,0 @@
|
|||
#!/bin/zsh
|
||||
|
||||
export DOTFILES=""
|
||||
|
||||
[ ! $DOTFILES ] && unset DOTFILES
|
1
.config/zsh/dotfiles
Symbolic link
1
.config/zsh/dotfiles
Symbolic link
|
@ -0,0 +1 @@
|
|||
include/dotfiles
|
136
.config/zsh/include/aliases
Normal file
136
.config/zsh/include/aliases
Normal file
|
@ -0,0 +1,136 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
# i need sudo to launch emulator
|
||||
alias pixelemu="sudo $HOME/Library/Android/sdk/emulator/emulator @Pixel_2_API_28"
|
||||
alias mbrew="sudo -H -u maintenance -g staff brew"
|
||||
fi
|
||||
|
||||
alias punten='doas'
|
||||
#sudo + vim without sacrificing config
|
||||
alias sudovim='sudoedit'
|
||||
alias doasvim='doasedit'
|
||||
|
||||
#switch to pgsql user
|
||||
alias pg='doas -u postgres'
|
||||
|
||||
#mysql with color
|
||||
# alias mysql=$(echo -e 'mysql --prompt="\x1B[34m\\d\x1B[32m \n>\x1B[0m "')
|
||||
|
||||
#vim
|
||||
alias nano=nvim
|
||||
alias vim=nvim
|
||||
alias vimsudo='sudoedit /etc/sudoers'
|
||||
alias vimdoas='doasedit /etc/sudoers'
|
||||
alias vi=nvim
|
||||
alias v=nvim
|
||||
|
||||
#emacs
|
||||
alias emacs="emacs -nw"
|
||||
|
||||
#mutt
|
||||
alias mutt="neomutt"
|
||||
|
||||
#curl
|
||||
alias weather='curl wttr.in'
|
||||
|
||||
#install
|
||||
alias p='doas pacman'
|
||||
alias a='paru'
|
||||
|
||||
#ripper
|
||||
alias yt='yt-dlp --add-metadata'
|
||||
alias yta='yt-dlp --add-metadata -x --audio-format'
|
||||
alias xreload='xrdb $HOME/.config/Xresources'
|
||||
|
||||
#clean up
|
||||
alias wget='wget --hsts-file="$XDG_CACHE_HOME/wget-hsts"'
|
||||
|
||||
#shortcuts
|
||||
alias ytv='youtube-viewer'
|
||||
alias gravit="$HOME/my\ Files/Gravit/GravitDesigner.AppImage"
|
||||
alias redoom="$HOME/doom refresh"
|
||||
alias rvim='doas vim'
|
||||
alias py='python'
|
||||
alias cls='clear'
|
||||
alias classprop='xprop WM_CLASS'
|
||||
alias storagelist='lsblk -f'
|
||||
alias ..='cd ..'
|
||||
alias ...='cd ../..'
|
||||
alias ....='cd ../../..'
|
||||
alias .....='cd ../../../..'
|
||||
alias q='exit'
|
||||
|
||||
#ls stuff
|
||||
alias l='exa --color=always --group-directories-first' # my preferred listing
|
||||
alias ls='exa --color=always --group-directories-first' # my preferred listing
|
||||
alias la='exa -a --color=always --group-directories-first' # all files and dirs
|
||||
alias ll='exa -l --color=always --group-directories-first' # long format
|
||||
alias lla='exa -al --color=always --group-directories-first' # long format
|
||||
alias lt='exa -aT --color=always --group-directories-first' # tree listing
|
||||
|
||||
alias md='mkdir -p'
|
||||
alias rd='rmdir'
|
||||
|
||||
alias reUSD='rm -rf /tmp/rate.html /tmp/rateUSD.txt'
|
||||
#alias mpv='mpv --geometry=1280x720'
|
||||
|
||||
#config shortcuts
|
||||
alias config='cd ${DOTFILES:-$HOME/Build/GIT/dotfiles}'
|
||||
alias cfg='config'
|
||||
alias cfvim='vim $XDG_CONFIG_HOME/nvim/init.lua'
|
||||
alias cfvimplug='vim $XDG_CONFIG_HOME/nvim/lua/null/plugins/'
|
||||
alias cfvimnix='vim $XDG_CONFIG_HOME/nvim/lua/null/nix.lua'
|
||||
alias cfvimuni='vim $XDG_CONFIG_HOME/nvim/lua/null/config.lua'
|
||||
alias cfbash='vim $HOME/.bashrc'
|
||||
alias cfzsh='vim $XDG_CONFIG_HOME/zsh/.zshrc'
|
||||
alias cfxres='vim $XDG_CONFIG_HOME/Xresources'
|
||||
alias cfbsp='vim $XDG_CONFIG_HOME/bspwm/bspwmrc'
|
||||
alias cfqtile='vim $XDG_CONFIG_HOME/qtile/config.py'
|
||||
alias cfpoly='vim $XDG_CONFIG_HOME/polybar/config'
|
||||
alias cfkeys='vim $XDG_CONFIG_HOME/sxhkd/sxhkdrc'
|
||||
alias cfalias='vim $XDG_CONFIG_HOME/zsh/aliases'
|
||||
alias cfbind='vim $XDG_CONFIG_HOME/zsh/keybinds'
|
||||
alias cfprofile='vim $XDG_CONFIG_HOME/zsh/.zprofile'
|
||||
alias cfxprofile='vim $XDG_CONFIG_HOME/xprofile'
|
||||
alias cfcompt='vim $XDG_CONFIG_HOME/picom/picom.conf'
|
||||
alias cfenv='vim $XDG_CONFIG_HOME/zsh/.zshenv'
|
||||
alias cfmutt='vim $XDG_CONFIG_HOME/mutt/muttrc'
|
||||
alias cfnews='vim $XDG_CONFIG_HOME/newsboat/urls'
|
||||
|
||||
#more shortcuts
|
||||
alias htop='htop -t'
|
||||
alias rm='rm -i'
|
||||
alias mv='mv -i'
|
||||
alias cp='cp -i'
|
||||
alias mntfd='doas mount -o gid=users,fmask=113,dmask=002'
|
||||
alias umntfd='doas umount'
|
||||
alias cmatrix='unimatrix -n -s 96 -l "o"'
|
||||
alias s='cd $HOME/.local/bin/scripts;ls'
|
||||
|
||||
#folder shortcut
|
||||
alias cdclg='cd "$HOME/my Files/Kuliah/"'
|
||||
alias cdwine='cd "$HOME/.local/share/wineprefixes/"'
|
||||
|
||||
#Git Aliases
|
||||
alias cdgit='cd $HOME/Build/GIT'
|
||||
alias gaa='git add -A'
|
||||
alias gci='git commit'
|
||||
alias gca='git commit --all'
|
||||
alias gr='git rm'
|
||||
alias gR='git restore'
|
||||
alias gs='git status'
|
||||
alias gp='git push'
|
||||
alias gP='git pull'
|
||||
alias gcl='git clone'
|
||||
#alias config='/usr/bin/git --git-dir=$HOME/dotfiles/ --work-tree=$HOME'
|
||||
|
||||
alias qn='vim $HOME/Documents/QuickNote'
|
||||
|
||||
alias docx2pdf='lowriter --convert-to pdf'
|
||||
|
||||
alias mirror-update='curl -s "https://archlinux.org/mirrorlist/?country=ID&country=SG&country=US&protocol=https&use_mirror_status=on" | sed -e 's/^#Server/Server/' -e '/^#/d' | rankmirrors -n 5 -'
|
||||
alias center-pfetch="printf '\n'; pfetch | sed '\$d' | center -l"
|
||||
[ "$TERM" = "xterm-kitty" ] && alias ssh="kitty +kitten ssh"
|
||||
|
||||
alias neofetch='fastfetch'
|
76
.config/zsh/include/completion
Normal file
76
.config/zsh/include/completion
Normal file
|
@ -0,0 +1,76 @@
|
|||
# vim: filetype=zsh
|
||||
zstyle ':completion:*:*:git:*' script /usr/local/etc/bash_completion.d/git-completion.bash
|
||||
fpath=(/usr/local/share/zsh-completions $fpath)
|
||||
|
||||
autoload -Uz compinit
|
||||
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
FPATH="$(brew --prefix)/share/zsh/site-functions:${FPATH}"
|
||||
compinit -u # homebrew moment, not recommended but whatever
|
||||
else
|
||||
compinit
|
||||
fi
|
||||
|
||||
zmodload -i zsh/complist
|
||||
zstyle ':completion:*' menu select
|
||||
|
||||
# case insensitive (all), partial-word and substring completion
|
||||
if [[ "$CASE_SENSITIVE" = true ]]; then
|
||||
zstyle ':completion:*' matcher-list 'r:|=*' 'l:|=* r:|=*'
|
||||
else
|
||||
if [[ "$HYPHEN_INSENSITIVE" = true ]]; then
|
||||
zstyle ':completion:*' matcher-list 'm:{a-zA-Z-_}={A-Za-z_-}' 'r:|=*' 'l:|=* r:|=*'
|
||||
else
|
||||
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|=*' 'l:|=* r:|=*'
|
||||
fi
|
||||
fi
|
||||
unset CASE_SENSITIVE HYPHEN_INSENSITIVE
|
||||
|
||||
# Complete . and .. special directories
|
||||
zstyle ':completion:*' special-dirs true
|
||||
|
||||
zstyle ':completion:*' list-colors ''
|
||||
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01'
|
||||
|
||||
if [[ "$OSTYPE" = solaris* ]]; then
|
||||
zstyle ':completion:*:*:*:*:processes' command "ps -u $USER -o pid,user,comm"
|
||||
else
|
||||
zstyle ':completion:*:*:*:*:processes' command "ps -u $USER -o pid,user,comm -w -w"
|
||||
fi
|
||||
|
||||
# disable named-directories autocompletion
|
||||
zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-directories
|
||||
|
||||
# Use caching so that commands like apt and dpkg complete are useable
|
||||
zstyle ':completion:*' use-cache yes
|
||||
zstyle ':completion:*' cache-path $ZSH_CACHE_DIR
|
||||
|
||||
# Don't complete uninteresting users
|
||||
zstyle ':completion:*:*:*:users' ignored-patterns \
|
||||
adm amanda apache at avahi avahi-autoipd beaglidx bin cacti canna \
|
||||
clamav daemon dbus distcache dnsmasq dovecot fax ftp games gdm \
|
||||
gkrellmd gopher hacluster haldaemon halt hsqldb ident junkbust kdm \
|
||||
ldap lp mail mailman mailnull man messagebus mldonkey mysql nagios \
|
||||
named netdump news nfsnobody nobody nscd ntp nut nx obsrun openvpn \
|
||||
operator pcap polkitd postfix postgres privoxy pulse pvm quagga radvd \
|
||||
rpc rpcuser rpm rtkit scard shutdown squid sshd statd svn sync tftp \
|
||||
usbmux uucp vcsa wwwrun xfs '_*'
|
||||
|
||||
# ... unless we really want to.
|
||||
zstyle '*' single-ignored show
|
||||
|
||||
if [[ $COMPLETION_WAITING_DOTS = true ]]; then
|
||||
expand-or-complete-with-dots() {
|
||||
# toggle line-wrapping off and back on again
|
||||
[[ -n "$terminfo[rmam]" && -n "$terminfo[smam]" ]] && echoti rmam
|
||||
print -Pn "%{%F{red}......%f%}"
|
||||
[[ -n "$terminfo[rmam]" && -n "$terminfo[smam]" ]] && echoti smam
|
||||
|
||||
zle expand-or-complete
|
||||
zle redisplay
|
||||
}
|
||||
zle -N expand-or-complete-with-dots
|
||||
bindkey "^I" expand-or-complete-with-dots
|
||||
fi
|
||||
|
||||
[ -s "/usr/share/zsh/site-functions/_pass" ] && zstyle ':completion:*' "/usr/share/zsh/site-functions/_pass"
|
5
.config/zsh/include/dotfiles
Normal file
5
.config/zsh/include/dotfiles
Normal file
|
@ -0,0 +1,5 @@
|
|||
#!/bin/zsh
|
||||
|
||||
export DOTFILES=""
|
||||
|
||||
[ ! $DOTFILES ] && unset DOTFILES
|
45
.config/zsh/include/keybinds
Normal file
45
.config/zsh/include/keybinds
Normal file
|
@ -0,0 +1,45 @@
|
|||
#!/bin/env zsh
|
||||
# create a zkbd compatible hash;
|
||||
# to add other keys to this hash, see: man 5 terminfo
|
||||
typeset -g -A key
|
||||
|
||||
key[Home]="${terminfo[khome]}"
|
||||
key[End]="${terminfo[kend]}"
|
||||
key[Insert]="${terminfo[kich1]}"
|
||||
key[Backspace]="${terminfo[kbs]}"
|
||||
key[Delete]="${terminfo[kdch1]}"
|
||||
key[Up]="${terminfo[kcuu1]}"
|
||||
key[Down]="${terminfo[kcud1]}"
|
||||
key[Left]="${terminfo[kcub1]}"
|
||||
key[Right]="${terminfo[kcuf1]}"
|
||||
key[PageUp]="${terminfo[kpp]}"
|
||||
key[PageDown]="${terminfo[knp]}"
|
||||
key[Shift-Tab]="${terminfo[kcbt]}"
|
||||
|
||||
# setup key accordingly
|
||||
[[ -n "${key[Home]}" ]] && bindkey -- "${key[Home]}" beginning-of-line
|
||||
[[ -n "${key[End]}" ]] && bindkey -- "${key[End]}" end-of-line
|
||||
[[ -n "${key[Insert]}" ]] && bindkey -- "${key[Insert]}" overwrite-mode
|
||||
[[ -n "${key[Backspace]}" ]] && bindkey -- "${key[Backspace]}" backward-delete-char
|
||||
[[ -n "${key[Delete]}" ]] && bindkey -- "${key[Delete]}" delete-char
|
||||
[[ -n "${key[Up]}" ]] && bindkey -- "${key[Up]}" up-line-or-history
|
||||
[[ -n "${key[Down]}" ]] && bindkey -- "${key[Down]}" down-line-or-history
|
||||
[[ -n "${key[Left]}" ]] && bindkey -- "${key[Left]}" backward-char
|
||||
[[ -n "${key[Right]}" ]] && bindkey -- "${key[Right]}" forward-char
|
||||
[[ -n "${key[PageUp]}" ]] && bindkey -- "${key[PageUp]}" beginning-of-buffer-or-history
|
||||
[[ -n "${key[PageDown]}" ]] && bindkey -- "${key[PageDown]}" end-of-buffer-or-history
|
||||
[[ -n "${key[Shift-Tab]}" ]] && bindkey -- "${key[Shift-Tab]}" reverse-menu-complete
|
||||
|
||||
# Finally, make sure the terminal is in application mode, when zle is
|
||||
# active. Only then are the values from $terminfo valid.
|
||||
if (( ${+terminfo[smkx]} && ${+terminfo[rmkx]} )); then
|
||||
autoload -Uz add-zle-hook-widget
|
||||
function zle_application_mode_start { echoti smkx }
|
||||
function zle_application_mode_stop { echoti rmkx }
|
||||
add-zle-hook-widget -Uz zle-line-init zle_application_mode_start
|
||||
add-zle-hook-widget -Uz zle-line-finish zle_application_mode_stop
|
||||
fi
|
||||
|
||||
bindkey -v '^[[3~' delete-char
|
||||
bindkey '^ ' autosuggest-accept
|
||||
|
61
.config/zsh/include/theme
Normal file
61
.config/zsh/include/theme
Normal file
|
@ -0,0 +1,61 @@
|
|||
#!/bin/env zsh
|
||||
autoload -Uz vcs_info
|
||||
precmd_vcs_info() { vcs_info }
|
||||
precmd_functions+=( precmd_vcs_info )
|
||||
setopt prompt_subst
|
||||
zstyle ':vcs_info:*' stagedstr 'M'
|
||||
zstyle ':vcs_info:*' unstagedstr '!'
|
||||
zstyle ':vcs_info:*' check-for-changes true
|
||||
zstyle ':vcs_info:git:*' formats '%F{5} %b %F{1}%c%u %f'
|
||||
zstyle ':vcs_info:git*+set-message:*' hooks git-untracked
|
||||
zstyle ':vcs_info:*' enable git
|
||||
+vi-git-untracked() {
|
||||
|
||||
# git status ahead
|
||||
if [[ $(git status --porcelain -b | grep '^## [^ ]\+ .*ahead') ]]; then
|
||||
hook_com[unstaged]+='%F{1}⇡%f'
|
||||
fi
|
||||
|
||||
# git untracked
|
||||
if [ $(git rev-parse --is-inside-work-tree 2> /dev/null) = 'true' ] && \
|
||||
[ $(git ls-files --other --directory --exclude-standard | sed q | wc -l | tr -d ' ') = 1 ] ; then
|
||||
hook_com[unstaged]+='%F{1}?%f'
|
||||
fi
|
||||
}
|
||||
|
||||
function zle-line-init zle-keymap-select {
|
||||
PS1="
|
||||
%B%F{blue}%~ \$vcs_info_msg_0_
|
||||
%F{green}${${KEYMAP/vicmd/N }/(main|viins)/}$>%f%b "
|
||||
PS2="%B%F{blue}?>%f%b "
|
||||
# RPS1="${${KEYMAP/vicmd/-- NORMAL --}/(main|viins)/-- INSERT --}"
|
||||
# RPS2=$RPS1
|
||||
|
||||
if [[ ${KEYMAP} == vicmd ]] ||
|
||||
[[ $1 = 'block' ]]; then
|
||||
echo -ne '\e[1 q'
|
||||
|
||||
elif [[ ${KEYMAP} == main ]] ||
|
||||
[[ ${KEYMAP} == viins ]] ||
|
||||
[[ ${KEYMAP} = '' ]] ||
|
||||
[[ $1 = 'beam' ]]; then
|
||||
echo -ne '\e[5 q'
|
||||
fi
|
||||
|
||||
zle reset-prompt
|
||||
}
|
||||
zle -N zle-line-init
|
||||
zle -N zle-keymap-select
|
||||
|
||||
_fix_cursor() {
|
||||
echo -ne '\e[5 q'
|
||||
}
|
||||
|
||||
precmd () {
|
||||
RPROMPT="" # for some reason path added to RPROMPT in macOS, I have no idea where it's coming from
|
||||
vcs_info
|
||||
_fix_cursor
|
||||
}
|
||||
#RPROMPT=\$vcs_info_msg_0_
|
||||
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#60C0FF,bold,underline"
|
||||
ZSH_AUTOSUGGEST_HISTORY_IGNORE="ls *,cd *"
|
|
@ -1,45 +0,0 @@
|
|||
#!/bin/env zsh
|
||||
# create a zkbd compatible hash;
|
||||
# to add other keys to this hash, see: man 5 terminfo
|
||||
typeset -g -A key
|
||||
|
||||
key[Home]="${terminfo[khome]}"
|
||||
key[End]="${terminfo[kend]}"
|
||||
key[Insert]="${terminfo[kich1]}"
|
||||
key[Backspace]="${terminfo[kbs]}"
|
||||
key[Delete]="${terminfo[kdch1]}"
|
||||
key[Up]="${terminfo[kcuu1]}"
|
||||
key[Down]="${terminfo[kcud1]}"
|
||||
key[Left]="${terminfo[kcub1]}"
|
||||
key[Right]="${terminfo[kcuf1]}"
|
||||
key[PageUp]="${terminfo[kpp]}"
|
||||
key[PageDown]="${terminfo[knp]}"
|
||||
key[Shift-Tab]="${terminfo[kcbt]}"
|
||||
|
||||
# setup key accordingly
|
||||
[[ -n "${key[Home]}" ]] && bindkey -- "${key[Home]}" beginning-of-line
|
||||
[[ -n "${key[End]}" ]] && bindkey -- "${key[End]}" end-of-line
|
||||
[[ -n "${key[Insert]}" ]] && bindkey -- "${key[Insert]}" overwrite-mode
|
||||
[[ -n "${key[Backspace]}" ]] && bindkey -- "${key[Backspace]}" backward-delete-char
|
||||
[[ -n "${key[Delete]}" ]] && bindkey -- "${key[Delete]}" delete-char
|
||||
[[ -n "${key[Up]}" ]] && bindkey -- "${key[Up]}" up-line-or-history
|
||||
[[ -n "${key[Down]}" ]] && bindkey -- "${key[Down]}" down-line-or-history
|
||||
[[ -n "${key[Left]}" ]] && bindkey -- "${key[Left]}" backward-char
|
||||
[[ -n "${key[Right]}" ]] && bindkey -- "${key[Right]}" forward-char
|
||||
[[ -n "${key[PageUp]}" ]] && bindkey -- "${key[PageUp]}" beginning-of-buffer-or-history
|
||||
[[ -n "${key[PageDown]}" ]] && bindkey -- "${key[PageDown]}" end-of-buffer-or-history
|
||||
[[ -n "${key[Shift-Tab]}" ]] && bindkey -- "${key[Shift-Tab]}" reverse-menu-complete
|
||||
|
||||
# Finally, make sure the terminal is in application mode, when zle is
|
||||
# active. Only then are the values from $terminfo valid.
|
||||
if (( ${+terminfo[smkx]} && ${+terminfo[rmkx]} )); then
|
||||
autoload -Uz add-zle-hook-widget
|
||||
function zle_application_mode_start { echoti smkx }
|
||||
function zle_application_mode_stop { echoti rmkx }
|
||||
add-zle-hook-widget -Uz zle-line-init zle_application_mode_start
|
||||
add-zle-hook-widget -Uz zle-line-finish zle_application_mode_stop
|
||||
fi
|
||||
|
||||
bindkey -v '^[[3~' delete-char
|
||||
bindkey '^ ' autosuggest-accept
|
||||
|
1
.config/zsh/keybinds
Symbolic link
1
.config/zsh/keybinds
Symbolic link
|
@ -0,0 +1 @@
|
|||
include/keybinds
|
|
@ -1,61 +0,0 @@
|
|||
#!/bin/env zsh
|
||||
autoload -Uz vcs_info
|
||||
precmd_vcs_info() { vcs_info }
|
||||
precmd_functions+=( precmd_vcs_info )
|
||||
setopt prompt_subst
|
||||
zstyle ':vcs_info:*' stagedstr 'M'
|
||||
zstyle ':vcs_info:*' unstagedstr '!'
|
||||
zstyle ':vcs_info:*' check-for-changes true
|
||||
zstyle ':vcs_info:git:*' formats '%F{5} %b %F{1}%c%u %f'
|
||||
zstyle ':vcs_info:git*+set-message:*' hooks git-untracked
|
||||
zstyle ':vcs_info:*' enable git
|
||||
+vi-git-untracked() {
|
||||
|
||||
# git status ahead
|
||||
if [[ $(git status --porcelain -b | grep '^## [^ ]\+ .*ahead') ]]; then
|
||||
hook_com[unstaged]+='%F{1}⇡%f'
|
||||
fi
|
||||
|
||||
# git untracked
|
||||
if [ $(git rev-parse --is-inside-work-tree 2> /dev/null) = 'true' ] && \
|
||||
[ $(git ls-files --other --directory --exclude-standard | sed q | wc -l | tr -d ' ') = 1 ] ; then
|
||||
hook_com[unstaged]+='%F{1}?%f'
|
||||
fi
|
||||
}
|
||||
|
||||
function zle-line-init zle-keymap-select {
|
||||
PS1="
|
||||
%B%F{blue}%~ \$vcs_info_msg_0_
|
||||
%F{green}${${KEYMAP/vicmd/N }/(main|viins)/}$>%f%b "
|
||||
PS2="%B%F{blue}?>%f%b "
|
||||
# RPS1="${${KEYMAP/vicmd/-- NORMAL --}/(main|viins)/-- INSERT --}"
|
||||
# RPS2=$RPS1
|
||||
|
||||
if [[ ${KEYMAP} == vicmd ]] ||
|
||||
[[ $1 = 'block' ]]; then
|
||||
echo -ne '\e[1 q'
|
||||
|
||||
elif [[ ${KEYMAP} == main ]] ||
|
||||
[[ ${KEYMAP} == viins ]] ||
|
||||
[[ ${KEYMAP} = '' ]] ||
|
||||
[[ $1 = 'beam' ]]; then
|
||||
echo -ne '\e[5 q'
|
||||
fi
|
||||
|
||||
zle reset-prompt
|
||||
}
|
||||
zle -N zle-line-init
|
||||
zle -N zle-keymap-select
|
||||
|
||||
_fix_cursor() {
|
||||
echo -ne '\e[5 q'
|
||||
}
|
||||
|
||||
precmd () {
|
||||
RPROMPT="" # for some reason path added to RPROMPT in macOS, I have no idea where it's coming from
|
||||
vcs_info
|
||||
_fix_cursor
|
||||
}
|
||||
#RPROMPT=\$vcs_info_msg_0_
|
||||
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#60C0FF,bold,underline"
|
||||
ZSH_AUTOSUGGEST_HISTORY_IGNORE="ls *,cd *"
|
1
.config/zsh/theme
Symbolic link
1
.config/zsh/theme
Symbolic link
|
@ -0,0 +1 @@
|
|||
include/theme
|
Loading…
Add table
Add a link
Reference in a new issue