Skip to content

Instantly share code, notes, and snippets.

@akimdi
Created June 19, 2023 20:23
Show Gist options
  • Save akimdi/d5afd9045f515b6b6a502ff0218cfd0b to your computer and use it in GitHub Desktop.
Save akimdi/d5afd9045f515b6b6a502ff0218cfd0b to your computer and use it in GitHub Desktop.
# Set up the prompt
autoload -Uz promptinit
promptinit
setopt histignorealldups sharehistory
setopt promptsubst
bindkey -v
autoload -Uz compinit
autoload zmv
compinit
# Completion for kitty
kitty + complete setup zsh | source /dev/stdin
zstyle ':completion:*:git-checkout:*' sort false
zstyle ':completion:*:descriptions' format '[%d]'
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
zstyle ':fzf-tab:complete:cd:*' fzf-preview 'exa -1 --color=always $realpath'
zstyle ':fzf-tab:*' switch-group ',' '.'
zstyle :plugin:history-search-multi-word reset-prompt-protect 1
zstyle :plugin:zsh-completion-generator programs ggrep tr cat
zstyle :omz:plugins:ssh-agent identities
PROMPT=%B%F{yellow}%D{%H:%M:%S}%B%b%f
schedprompt() {
zle && zle reset-prompt
sched +1 schedprompt
}
zmodload -i zsh/sched
schedprompt
# https://github.com/docker/cli/commit/b10fb43048
# https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/docker#settings
zstyle ':completion:*:*:docker:*' option-stacking yes
zstyle ':completion:*:*:docker-*:*' option-stacking yes
zstyle ":history-search-multi-word" page-size "8"
zstyle ":history-search-multi-word" highlight-color "fg=yellow,bold"
zstyle ":plugin:history-search-multi-word" synhl "yes"
zstyle ":plugin:history-search-multi-word" active "underline"
zstyle ":plugin:history-search-multi-word" check-paths "yes"
zstyle ":plugin:history-search-multi-word" clear-on-cancel "no"
zstyle ':completion:*' menu select
# To disable automatic updates entirely
# https://github.com/ohmyzsh/ohmyzsh#getting-updates
# Uncomment the following line to use case-sensitive completion.
CASE_SENSITIVE="true"
# Uncomment the following line to enable command auto-correction.
ENABLE_CORRECTION="false"
# Uncomment one of the following lines to change the auto-update behavior
# disable automatic updates
zstyle ':omz:update' mode disabled
setopt completealiases
setopt HIST_IGNORE_DUPS
setopt autocd
autoload colors zsh/terminfo
colors
alias -s {erl,ml,hs,php,phtml,php4,php3,php5,phps,phar,kt,kts,c,h,cc,cpp,cxx,c,c++,h,hpp,hh,hxx,h++,java,p,pp,pas,html,htm,xml,css,json,js,mjs,js,rs,jse,wsf,wsc,asp,markdown,md,mk,txt,groovy,conf,zshrc,bashrc,yml}=vim
alias -s {3g2,3gp,3gp2,3gpp,3gpp2,asf,asx,avi,dat,drv,f4v,flv,h264,m4v,mkv,mod,moov,mov,mp4,mpeg,mpg,mts,rm,rmvb,spl,swf,vcd,vid,vob,webm,wm,wmv,yuv}=mpv
alias -s {pdf,djvu,djv}=zathura
alias -s {odt,doc,sxw,rtf}=libreoffice
# skim with vim
# https://github.com/lotabout/skim
alias skv='vim $(sk -m)'
# https://github.com/lotabout/skim#as-interactive-interface
alias skl="sk -m --ansi -i -c 'rga --rga-adapters=ffmpeg,pandoc,poppler,zip,decompress,tar,sqlite,pdfpages,tesseract -uuu -i --color=always --line-number "{}"'"
# start skim with multiple selection (press TAB key select multiple items with -m enabled)
# https://github.com/lotabout/skim#as-filter
alias skm="sk -m --ansi --preview 'bat --color=always --style=grid {}'"
# copy path file or folder (interactive)
# example: copypath <file>
# example: copypathinteractive <file>
alias copypathinteractive='echo -n $(pwd)$(sk -m --ansi | sed -e "s/^.\{1\}//") | clipcopy'
alias e='exa --all --classify --icons --long --group-directories-first --bytes --group --header --links --inode --blocks --time-style=long-iso --extended --git --color-scale --colour=always'
# exa tree recursive
alias etree='exa --all --classify --icons --long --group-directories-first --bytes --group --header --links --inode --blocks --time-style=long-iso --extended --git --color-scale --colour=always --tree'
# exa sort size
alias es='exa --all --classify --icons --long --group-directories-first --bytes --group --header --links --inode --blocks --time-style=long-iso --extended --git --color-scale --colour=always --sort=size'
zstyle ':completion:*' auto-description 'specify: %d'
zstyle ':completion:*' completer _expand _complete _correct _approximate
zstyle ':completion:*' format 'Completing %d'
zstyle ':completion:*' group-name ''
zstyle ':completion:*' menu select=2
eval "$(dircolors -b)"
eval "$(starship init zsh)"
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
zstyle ':completion:*' list-colors ''
zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s
zstyle ':completion:*' matcher-list '' 'm:{a-z}={A-Z}' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=* l:|=*'
zstyle ':completion:*' menu select=long
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s
zstyle ':completion:*' use-compctl false
zstyle ':completion:*' verbose true
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'
zstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,cputime,cmd'
[[ -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[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[PageUp]}" ]] && bindkey "${key[PageUp]}" history-beginning-search-backward
[[ -n "${key[PageDown]}" ]] && bindkey "${key[PageDown]}" history-beginning-search-forward
# Antidote zsh plugin manager
# https://github.com/mattmc3/antidote
# https://github.com/mattmc3/antidote
# https://getantidote.github.io/migrating-from-antigen
source ~/.zsh-plugin-manager/antidote/antidote.zsh
# Initialize antidote's dynamic mode, which changes `antidote bundle` from static mode
source <(antidote init)
# Antidote doesn't have the 'use' command like antigen,
# but instead you can accomplish the same via annotations:
# Bundle oh-my-zsh libs and plugins with the 'path:' annotation
antidote bundle ohmyzsh/ohmyzsh path:lib
# Bundles from the default repo (robbyrussell's oh-my-zsh) https://github.com/robbyrussell/oh-my-zsh
# New default repo https://github.com/ohmyzsh/ohmyzsh
#
# https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/git
antidote bundle ohmyzsh/ohmyzsh path:plugins/git
# https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/extract
antidote bundle ohmyzsh/ohmyzsh path:plugins/extract
# https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/ssh-agent
antidote bundle ohmyzsh/ohmyzsh path:plugins/ssh-agent
# https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/copypath
antidote bundle ohmyzsh/ohmyzsh path:plugins/copypath
# https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/copyfile
antidote bundle ohmyzsh/ohmyzsh path:plugins/copyfile
# https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/aliases
antidote bundle ohmyzsh/ohmyzsh path:plugins/aliases
# https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/archlinux
antidote bundle ohmyzsh/ohmyzsh path:plugins/archlinux
# https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/alias-finder
antidote bundle ohmyzsh/ohmyzsh path:plugins/alias-finder
# https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/gitfast
antidote bundle ohmyzsh/ohmyzsh path:plugins/gitfast
# main -> https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/colored-man-pages
#
# alternative -> https://github.com/ael-code/zsh-colored-man-pages
antidote bundle ohmyzsh/ohmyzsh path:plugins/colored-man-pages
# https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/sudo
antidote bundle ohmyzsh/ohmyzsh path:plugins/sudo
# https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/torrent
antidote bundle ohmyzsh/ohmyzsh path:plugins/torrent
# https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/colorize
antidote bundle ohmyzsh/ohmyzsh path:plugins/colorize
# https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/cp
antidote bundle ohmyzsh/ohmyzsh path:plugins/cp
# https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/docker-compose
antidote bundle ohmyzsh/ohmyzsh path:plugins/docker-compose
# https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/docker-machine
antidote bundle ohmyzsh/ohmyzsh path:plugins/docker-machine
# https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/emoji
antidote bundle ohmyzsh/ohmyzsh path:plugins/emoji
# https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/docker
# https://github.com/docker/cli/blob/master/contrib/completion/zsh/_docker
# /usr/share/zsh/site-functions/_docker
# https://github.com/ohmyzsh/ohmyzsh/issues/11762
antidote bundle ohmyzsh/ohmyzsh path:plugins/docker
# https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/encode64
antidote bundle ohmyzsh/ohmyzsh path:plugins/encode64
# https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/firewalld
antidote bundle ohmyzsh/ohmyzsh path:plugins/firewalld
# https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/fzf
antidote bundle ohmyzsh/ohmyzsh path:plugins/fzf
# https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/git-escape-magic
antidote bundle ohmyzsh/ohmyzsh path:plugins/git-escape-magic
# https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/git-extras
# https://github.com/tj/git-extras/blob/master/Commands.md
antidote bundle ohmyzsh/ohmyzsh path:plugins/git-extras
# https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/git-lfs
antidote bundle ohmyzsh/ohmyzsh path:plugins/git-lfs
# https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/gitignore
antidote bundle ohmyzsh/ohmyzsh path:plugins/gitignore
# https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/gpg-agent
antidote bundle ohmyzsh/ohmyzsh path:plugins/gpg-agent
# https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/history
antidote bundle ohmyzsh/ohmyzsh path:plugins/history
# https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/isodate
antidote bundle ohmyzsh/ohmyzsh path:plugins/isodate
# https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/nmap
antidote bundle ohmyzsh/ohmyzsh path:plugins/nmap
# https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/pre-commit
antidote bundle ohmyzsh/ohmyzsh path:plugins/pre-commit
# https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/rsync
antidote bundle ohmyzsh/ohmyzsh path:plugins/rsync
# https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/screen
antidote bundle ohmyzsh/ohmyzsh path:plugins/screen
# https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/tig
antidote bundle ohmyzsh/ohmyzsh path:plugins/tig
# https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/tmux
antidote bundle ohmyzsh/ohmyzsh path:plugins/tmux
# https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/web-search
antidote bundle ohmyzsh/ohmyzsh path:plugins/web-search
# https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/zsh-interactive-cd
antidote bundle ohmyzsh/ohmyzsh path:plugins/zsh-interactive-cd
# https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/universalarchive
antidote bundle ohmyzsh/ohmyzsh path:plugins/universalarchive
# https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/command-not-found
antidote bundle ohmyzsh/ohmyzsh path:plugins/command-not-found
# https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/dirpersist
antidote bundle ohmyzsh/ohmyzsh path:plugins/dirpersist
# https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/safe-paste
antidote bundle ohmyzsh/ohmyzsh path:plugins/safe-paste
# https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/copybuffer
antidote bundle ohmyzsh/ohmyzsh path:plugins/copybuffer
# https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/jsontools
antidote bundle ohmyzsh/ohmyzsh path:plugins/jsontools
# https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/rust
antidote bundle ohmyzsh/ohmyzsh path:plugins/rust
# https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/urltools
antidote bundle ohmyzsh/ohmyzsh path:plugins/urltools
# https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/supervisor
antidote bundle ohmyzsh/ohmyzsh path:plugins/supervisor
# https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/terraform
antidote bundle ohmyzsh/ohmyzsh path:plugins/terraform
# Easy file sharing from the command line
# https://transfer.sh
antidote bundle ohmyzsh/ohmyzsh path:plugins/transfer
# https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/ansible
antidote bundle ohmyzsh/ohmyzsh path:plugins/ansible
# https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/vagrant
antidote bundle ohmyzsh/ohmyzsh path:plugins/vagrant
### If you authored a Zsh plugin, the recommended snippet for antidote is:
### antidote install gh_user/gh_repo
###
### If your plugin is hosted somewhere other than GitHub, you can use this:
### antidote install https://bitbucket.org/bb_user/bb_repo
###
###
### alternative zsh-editing-workbench --> https://github.com/Joaquin6/zsh-cmd-architect
### alternative zsh-editing-workbench --> https://github.com/zdharma-continuum/zsh-cmd-architect
###
### https://github.com/zdharma-continuum/zsh-editing-workbench
antidote bundle zdharma-continuum/zsh-editing-workbench
# https://github.com/zdharma-continuum/zsh-diff-so-fancy
antidote bundle zdharma-continuum/zsh-diff-so-fancy
# https://github.com/Aloxaf/fzf-tab
antidote bundle Aloxaf/fzf-tab
# https://github.com/clarketm/zsh-completions
antidote bundle clarketm/zsh-completions
# https://github.com/RobSis/zsh-completion-generator
antidote bundle RobSis/zsh-completion-generator
# https://github.com/arzzen/calc.plugin.zsh
antidote bundle arzzen/calc.plugin.zsh
# https://github.com/michaelxmcbride/zsh-dircycle
antidote bundle michaelxmcbride/zsh-dircycle
# https://github.com/Tarrasch/zsh-colors
antidote bundle Tarrasch/zsh-colors
# https://github.com/wfxr/forgit
antidote bundle wfxr/forgit
# Awesome tmux-based terminal divider
# https://github.com/greymd/tmux-xpanes
antidote bundle greymd/tmux-xpanes
# https://github.com/chrissicool/zsh-256color
antidote bundle chrissicool/zsh-256color
# https://github.com/djui/alias-tips
antidote bundle djui/alias-tips
# https://github.com/hlissner/zsh-autopair
antidote bundle hlissner/zsh-autopair
# main -> https://github.com/z-shell/H-S-MW
#
# alternative H-S-MW --> https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/history-substring-search
# alternative H-S-MW --> https://github.com/zsh-users/zsh-history-substring-search
# alternative H-S-MW --> https://github.com/zdharma-continuum/history-search-multi-word
antidote bundle z-shell/H-S-MW
# Fish-like autosuggestions for zsh
# It suggests commands as you type based on history and completions.
# Fish-like fast/unobtrusive autosuggestions for zsh
#
# https://github.com/zsh-users/zsh-autosuggestions
antidote bundle zsh-users/zsh-autosuggestions
# main -> https://github.com/z-shell/F-Sy-H
#
# alternative F-Sy-H --> https://github.com/zsh-users/zsh-syntax-highlighting
# alternative F-Sy-H --> https://github.com/zdharma-continuum/fast-syntax-highlighting
antidote bundle z-shell/F-Sy-H
# Update plugins and antidote
# https://getantidote.github.io/commands
alias au="antidote update"
# sudo wget --https-only --output-document=/usr/share/git/completion/git-extras-completion.zsh https://raw.githubusercontent.com/tj/git-extras/master/etc/git-extras-completion.zsh
source /usr/share/git/completion/git-extras-completion.zsh
# https://github.com/docker/cli/blob/master/contrib/completion/zsh/_docker
# https://archlinux.org/packages/extra/x86_64/docker
# https://github.com/ohmyzsh/ohmyzsh/commit/6bffaab2904d4bb37edad90e00b6f6e842d3811d
source /usr/share/zsh/site-functions/_docker
export FZF_BASE='/usr/bin/fzf'
export ARTISAN_OPEN_ON_MAKE_EDITOR='vim'
export JAVA_HOME='/usr/lib/jvm/java-8-openjdk'
export JAVAFX_HOME='/usr/share/openjfx/lib'
# https://the.exa.website/docs/environment-variables
# https://github.com/ogham/exa
export EXA_ICON_SPACING=2
# https://github.com/sharkdp/bat#configuration-file
export BAT_CONFIG_PATH="~/.config/bat/config"
# QCommandLineParser: option not defined: "allow-screencapture"
# https://keepassxc.org/blog/2023-05-14-2.7.5-released/
# https://github.com/keepassxreboot/keepassxc/issues/9420
#
#
# https://github.com/keepassxreboot/keepassxc/issues/5870#issuecomment-817143320
# https://bugs.archlinux.org/task/71820
export QT_SCALE_FACTOR=1.01
export EDITOR='xed'
export VISUAL='xed'
export VIDEO='mpv'
export DIFFPROG='meld'
export TERMINAL='kitty'
export BROWSER='firefox'
export READER='zathura'
export GIT_EDITOR='xed'
export FILEBROWSER='nemo'
export MOZ_WEBRENDER=1
export DISABLE_UPDATE_PROMPT=true
export LIBVA_DRIVER_NAME='iHD'
export VAAPI_MPEG4_ENABLED='true'
export VAGRANT_DEFAULT_PROVIDER=virtualbox
export VAGRANT_PREFERRED_PROVIDERS=virtualbox
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment