Skip to content

Instantly share code, notes, and snippets.

@petrosp
Forked from numToStr/.zshrc.zinit
Created February 21, 2025 21:20
Show Gist options
  • Select an option

  • Save petrosp/bf4f048f10ce3822fe7ac6ee3772a2d8 to your computer and use it in GitHub Desktop.

Select an option

Save petrosp/bf4f048f10ce3822fe7ac6ee3772a2d8 to your computer and use it in GitHub Desktop.

Revisions

  1. @numToStr numToStr revised this gist Sep 24, 2020. 1 changed file with 234 additions and 69 deletions.
    303 changes: 234 additions & 69 deletions .zshrc.zinit
    Original file line number Diff line number Diff line change
    @@ -15,114 +15,277 @@ autoload -Uz _zinit
    ### End of Zinit's installer chunk

    #####################
    # ZSH PLUGINS #
    # PROMPT #
    #####################
    # @source: https://github.com/crivotz/dot_files/blob/master/linux/zplugin/zshrc

    # zinit wait lucid for \
    # atinit"typeset -gA FAST_HIGHLIGHT; FAST_HIGHLIGHT[git-cmsg-len]=100; zpcompinit; zpcdreplay" \
    # zdharma/fast-syntax-highlighting \
    # blockf \
    # zsh-users/zsh-completions \
    # atinit'ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE=20' atload"_zsh_autosuggest_start" \
    # zsh-users/zsh-autosuggestions \
    # atload'bindkey "$terminfo[kcuu1]" history-substring-search-up; bindkey "$terminfo[kcud1]" history-substring-search-down' \
    # zsh-users/zsh-history-substring-search


    zinit ice wait"0a" lucid atload"_zsh_autosuggest_start"
    zinit light zsh-users/zsh-autosuggestions
    zinit ice from"gh-r" as"command" atload'eval "$(starship init zsh)"'
    zinit load starship/starship

    # zinit ice wait"0b" lucid atload'bindkey "$terminfo[kcuu1]" history-substring-search-up; bindkey "$terminfo[kcud1]" history-substring-search-down'

    zinit ice wait"0b" lucid atload'bindkey "$terminfo[kcuu1]" history-substring-search-up; bindkey "$terminfo[kcud1]" history-substring-search-down'
    zinit light zsh-users/zsh-history-substring-search

    zinit ice wait"0b" lucid blockf
    zinit light zsh-users/zsh-completions
    zstyle ':completion:*' completer _expand _complete _ignored _approximate
    zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
    zstyle ':completion:*' menu select=2
    zstyle ':completion:*' select-prompt '%SScrolling active: current selection at %p%s'
    zstyle ':completion:*:descriptions' format '-- %d --'
    zstyle ':completion:*:processes' command 'ps -au$USER'
    zstyle ':completion:complete:*:options' sort false
    zstyle ':fzf-tab:complete:_zlua:*' query-string input
    zstyle ':completion:*:*:*:*:processes' command "ps -u $USER -o pid,user,comm,cmd -w -w"
    zstyle ':fzf-tab:complete:kill:argument-rest' extra-opts --preview=$extract'ps --pid=$in[(w)1] -o cmd --no-headers -w -w' --preview-window=down:3:wrap
    zstyle ':fzf-tab:complete:cd:*' extra-opts --preview=$extract'exa -1 --color=always ${~ctxt[hpre]}$in'

    # Find a way to change after syntax is loaded, otherwise call `fast-theme spa`
    # FAST_THEME_NAME=spa
    zinit ice wait"0c" lucid atinit"typeset -gA FAST_HIGHLIGHT; FAST_HIGHLIGHT[git-cmsg-len]=100; zpcompinit; zpcdreplay"
    zinit light zdharma/fast-syntax-highlighting
    ##########################
    # OMZ Libs and Plugins #
    ##########################

    #####################
    # OHMYZSH PLUGINS #
    #####################
    # IMPORTANT:
    # Ohmyzsh plugins and libs are loaded first as some these sets some defaults which are required later on.
    # Otherwise something will look messed up
    # ie. some settings help zsh-autosuggestions to clear after tab completion

    setopt promptsubst

    # Loading tmux first, to prevent jumps when tmux is loaded after .zshrc
    zinit ice svn atinit"
    # It will only be loaded on first start
    zinit ice atinit"
    ZSH_TMUX_FIXTERM=true;
    ZSH_TMUX_AUTOSTART=true;
    ZSH_TMUX_AUTOCONNECT=true;"
    zinit snippet OMZP::tmux

    zinit wait lucid for \
    OMZL::git.zsh \
    OMZL::clipboard.zsh \
    OMZL::compfix.zsh \
    OMZL::completion.zsh \
    OMZL::correction.zsh \
    atload"
    alias ..='cd ..'
    alias ...='cd ../..'
    alias ....='cd ../../..'
    alias .....='cd ../../../..'
    " \
    OMZL::directories.zsh \
    OMZL::git.zsh \
    OMZL::grep.zsh \
    OMZL::history.zsh \
    OMZL::key-bindings.zsh \
    OMZL::spectrum.zsh \
    OMZL::termsupport.zsh \
    OMZL::compfix.zsh \
    OMZL::correction.zsh \
    OMZL::completion.zsh \
    atload"
    bindkey '^[[A' history-substring-search-up;
    bindkey '^[[B' history-substring-search-down;
    bindkey -M vicmd 'k' history-substring-search-up;
    bindkey -M vicmd 'j' history-substring-search-down;" \
    OMZL::key-bindings.zsh \
    alias gcd='gco dev'
    " \
    OMZP::git \
    OMZP::fzf \
    atload"
    alias dcupb='docker-compose up --build'
    " \
    OMZP::docker-compose \
    as"completion" \
    OMZP::docker/_docker

    # A fork of `z' by rupa deadwyler with much improved zsh/bash completion and better results. The data file format and core algorithm are compatible with those of the original.
    zinit ice wait lucid src"z.sh"
    zinit light knu/z
    OMZP::docker/_docker \
    djui/alias-tips \
    # hlissner/zsh-autopair \
    # chriskempson/base16-shell \

    #####################
    # Prompt #
    # PLUGINS #
    #####################
    zinit ice from"gh-r" as"program" atload'eval "$(starship init zsh)"'
    zinit load starship/starship
    # @source: https://github.com/crivotz/dot_files/blob/master/linux/zplugin/zshrc

    #####################
    # LS_COLORS #
    #####################
    zinit ice wait"0c" lucid reset \
    # IMPORTANT:
    # These plugins should be loaded after ohmyzsh plugins

    zinit wait lucid for \
    light-mode atinit"ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE=20" atload"!_zsh_autosuggest_start" \
    zsh-users/zsh-autosuggestions \
    light-mode atinit"typeset -gA FAST_HIGHLIGHT; FAST_HIGHLIGHT[git-cmsg-len]=100; zpcompinit; zpcdreplay" \
    zdharma/fast-syntax-highlighting \
    light-mode blockf atpull'zinit creinstall -q .' \
    atinit"
    zstyle ':completion:*' completer _expand _complete _ignored _approximate
    zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
    zstyle ':completion:*' menu select=2
    zstyle ':completion:*' select-prompt '%SScrolling active: current selection at %p%s'
    zstyle ':completion:*:descriptions' format '-- %d --'
    zstyle ':completion:*:processes' command 'ps -au$USER'
    zstyle ':completion:complete:*:options' sort false
    zstyle ':fzf-tab:complete:_zlua:*' query-string input
    zstyle ':completion:*:*:*:*:processes' command 'ps -u $USER -o pid,user,comm,cmd -w -w'
    zstyle ':fzf-tab:complete:kill:argument-rest' extra-opts --preview=$extract'ps --pid=$in[(w)1] -o cmd --no-headers -w -w' --preview-window=down:3:wrap
    zstyle ':fzf-tab:complete:cd:*' extra-opts --preview=$extract'exa -1 --color=always ${~ctxt[hpre]}$in'
    " \
    zsh-users/zsh-completions \
    bindmap"^R -> ^H" atinit"
    zstyle :history-search-multi-word page-size 10
    zstyle :history-search-multi-word highlight-color fg=red,bold
    zstyle :plugin:history-search-multi-word reset-prompt-protect 1
    " \
    zdharma/history-search-multi-word \
    reset \
    atclone"local P=${${(M)OSTYPE:#*darwin*}:+g}
    \${P}sed -i \
    '/DIR/c\DIR 38;5;63;1' LS_COLORS; \
    \${P}dircolors -b LS_COLORS > c.zsh" \
    atpull'%atclone' pick"c.zsh" nocompile'!' \
    atload'zstyle ":completion:*" list-colors “${(s.:.)LS_COLORS}”'
    zinit light trapd00r/LS_COLORS
    atload'zstyle ":completion:*" list-colors “${(s.:.)LS_COLORS}”' \
    trapd00r/LS_COLORS

    # atload'bindkey "$terminfo[kcuu1]" history-substring-search-up; bindkey "$terminfo[kcud1]" history-substring-search-down' \
    # zsh-users/zsh-history-substring-search

    # ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE=20
    # zinit ice wait"0a" lucid atload"_zsh_autosuggest_start"
    # zinit light zsh-users/zsh-autosuggestions

    # zinit ice wait"0b" lucid atload'bindkey "$terminfo[kcuu1]" history-substring-search-up; bindkey "$terminfo[kcud1]" history-substring-search-down'
    # zinit light zsh-users/zsh-history-substring-search
    # atload"
    # bindkey '^[[A' history-substring-search-up;
    # bindkey '^[[B' history-substring-search-down;
    # bindkey -M vicmd 'k' history-substring-search-up;
    # bindkey -M vicmd 'j' history-substring-search-down;
    # " \

    # zinit ice wait"0b" lucid bindmap'^R -> ^H' atinit'zstyle ":history-search-multi-word" page-size "10"; zstyle ":history-search-multi-word" highlight-color "fg=red,bold";'
    # zinit load zdharma/history-search-multi-word
    #

    # TAB COMPLETIONS
    # zinit ice wait"0b" lucid blockf
    # zinit light zsh-users/zsh-completions

    # Find a way to change after syntax is loaded
    # FAST_THEME_NAME=spa
    # zinit ice wait"0c" lucid atinit"typeset -gA FAST_HIGHLIGHT; FAST_HIGHLIGHT[git-cmsg-len]=100; zpcompinit; zpcdreplay"
    # zinit light zdharma/fast-syntax-highlighting


    #####################
    # MANUAL CONFIG #
    # PROGRAMS #
    #####################

    # 1. Load ~/.localrc, if it exists
    zinit is-snippet for \
    if"[[ -f $HOME/.localrc ]]" $HOME/.localrc
    # A fork of `z' by rupa deadwyler with much improved zsh/bash completion and better results. The data file format and core algorithm are compatible with those of the original.
    zinit wait'1' lucid light-mode for \
    pick"z.sh" \
    knu/z \
    as'command' atinit'export N_PREFIX="$HOME/n"; [[ :$PATH: == *":$N_PREFIX/bin:"* ]] || PATH+=":$N_PREFIX/bin"' pick"bin/n" \
    tj/n \
    from'gh-r' as'command' atinit'export PATH="$HOME/.yarn/bin:$PATH"' mv'yarn* -> yarn' pick"yarn/bin/yarn" bpick'*.tar.gz' \
    yarnpkg/yarn \


    #####################
    # HISTORY #
    #####################
    [ -z "$HISTFILE" ] && HISTFILE="$HOME/.zsh_history"
    HISTSIZE=290000
    SAVEHIST=$HISTSIZE

    #####################
    # SETOPT #
    #####################
    # set -o emacs
    # setopt vi
    setopt extended_history # record timestamp of command in HISTFILE
    setopt hist_expire_dups_first # delete duplicates first when HISTFILE size exceeds HISTSIZE
    setopt hist_ignore_all_dups # ignore duplicated commands history list
    setopt hist_ignore_space # ignore commands that start with space
    setopt hist_verify # show command with history expansion to user before running it
    setopt inc_append_history # add commands to HISTFILE in order of execution
    setopt share_history # share command history data
    setopt always_to_end # cursor moved to the end in full completion
    setopt hash_list_all # hash everything before completion
    setopt completealiases # complete alisases
    setopt always_to_end # when completing from the middle of a word, move the cursor to the end of the word
    setopt complete_in_word # allow completion from within a word/phrase
    setopt nocorrect # spelling correction for commands
    setopt list_ambiguous # complete as much of a completion until it gets ambiguous.
    setopt nolisttypes
    setopt listpacked
    setopt automenu

    #####################
    # ENV VARIABLE #
    #####################
    ZSH_AUTOSUGGEST_MANUAL_REBIND=1 # make prompt faster
    DISABLE_MAGIC_FUNCTIONS=true # make pasting into terminal faster
    export EDITOR=nvim
    export PAGER=bat
    export DOCKER_BUILDKIT=1
    export COMPOSE_DOCKER_CLI_BUILD=1

    #####################
    # ALIASES #
    #####################
    alias vim=$EDITOR
    alias cat=bat
    alias tf=terraform
    alias l="exa -abghHlS --git --group-directories-first"
    alias myip=ip-internal
    alias sysinfo="inxi -Fxxxz"
    alias psqlstart="sudo systemctl start postgresql.service"
    alias h="http"

    alias checkup="sudo pamac checkupdates -a"
    alias up="pamac upgrade -a --no-confirm"
    alias upnup="sudo pacman -Syyuu"
    alias cleanup="sudo pacman -Rsn $(pacman -Qdtq)"
    alias buildup="pamac build --no-confirm"
    alias npmnuke="echo Deleting ^/node_modules/ && rm -rf ./**/node_modules"

    #####################
    # FZF SETTINGS #
    #####################
    FD_OPTIONS="--hidden --follow"
    export FZF_DEFAULT_OPTS="--prompt '⯈ ' --marker=+ --color=dark --layout=reverse --color=fg:250,fg+:15,hl:203,hl+:203 --color=info:100,pointer:15,marker:220,spinner:11,header:-1,gutter:-1,prompt:15"
    export FZF_DEFAULT_COMMAND="fd --type f --type l $FD_OPTIONS || git ls-files --cached --others --exclude-standard"
    export FZF_CTRL_T_COMMAND="fd $FD_OPTIONS"
    export FZF_ALT_C_COMMAND="fd --type d $FD_OPTIONS"
    export FZF_COMPLETION_OPTS="-x"

    _fzf_compgen_path() {
    fd --hidden --follow . "$1"
    }
    _fzf_compgen_dir() {
    fd --type d --hidden --follow . "$1"
    }

    #####################
    # GO SETTINGS #
    #####################
    export CGO_ENABLED=1
    export CGO_CFLAGS="-g -O2 -Wno-return-local-addr"
    export GOPATH="$HOME/go/"
    export PATH="$GOPATH/bin:$PATH"


    #####################
    # Node and Yarn #
    #####################
    # export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
    # export N_PREFIX="$HOME/n"; [[ :$PATH: == *":$N_PREFIX/bin:"* ]] || PATH+=":$N_PREFIX/bin" # Added by n-install (see http://git.io/n-install-repo).


    #####################
    # Functions #
    #####################
    # echo "Ethernet :: IP => $( ip -4 -o a show wlan1 | awk '{ print $4 }' )"
    ip-internal() echo "Wireless :: IP => $( ip -4 -o a show wlo1 | awk '{ print $4 }' )"
    ip-external() echo "External :: IP => $( curl --silent https://ifconfig.me )"
    ipinfo() { ipInternal && ipExternal }

    prcreate() gh pr create -B "$1" -f
    prmerge() gh pr merge --merge --delete-branch=false "$1"
    prlist() gh pr list --state open
    prcheck() { gh pr checkout "$1" && gh pr diff }

    # open_with_fzf() {
    # fd -t f -H -I | fzf -m --preview="xdg-mime query default {}" | xargs -ro -d "\n" xdg-open 2>&-
    # }

    # cd_with_fzf() {
    # cd $HOME && cd "$(fd -t d | fzf --preview="tree -L 1 {}" --bind="space:toggle-preview" --preview-window=:hidden)"
    # }
    # zle -N cd_with_fzf{,}

    # pacs() {
    # sudo pacman -Syy $(pacman -Ssq | fzf -m --preview="pacman -Si {}" --preview-window=:hidden --bind=space:toggle-preview)
    # }
    # zle -N pacs{,}


    # bindkey '^N' cd_with_fzf


    #####################
    # Misc Stuff #
    #####################

    # typeset -U config_files
    # config_files=($HOME/.zsh/*.zsh)
    @@ -133,3 +296,5 @@ zinit is-snippet for \
    # ${(M)config_files:#*/*e.zsh} \
    # ${config_files:#*/*e.zsh} \

    zinit is-snippet for \
    if"[[ -f $HOME/.localrc ]]" $HOME/.localrc
  2. @numToStr numToStr revised this gist Sep 19, 2020. 1 changed file with 56 additions and 153 deletions.
    209 changes: 56 additions & 153 deletions .zshrc.zinit
    Original file line number Diff line number Diff line change
    @@ -14,31 +14,30 @@ autoload -Uz _zinit
    (( ${+_comps} )) && _comps[zinit]=_zinit
    ### End of Zinit's installer chunk


    #####################
    # PLUGINS #
    # ZSH PLUGINS #
    #####################
    # @source: https://github.com/crivotz/dot_files/blob/master/linux/zplugin/zshrc

    ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE=20
    # zinit wait lucid for \
    # atinit"typeset -gA FAST_HIGHLIGHT; FAST_HIGHLIGHT[git-cmsg-len]=100; zpcompinit; zpcdreplay" \
    # zdharma/fast-syntax-highlighting \
    # blockf \
    # zsh-users/zsh-completions \
    # atinit'ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE=20' atload"_zsh_autosuggest_start" \
    # zsh-users/zsh-autosuggestions \
    # atload'bindkey "$terminfo[kcuu1]" history-substring-search-up; bindkey "$terminfo[kcud1]" history-substring-search-down' \
    # zsh-users/zsh-history-substring-search


    zinit ice wait"0a" lucid atload"_zsh_autosuggest_start"
    zinit light zsh-users/zsh-autosuggestions

    # zinit ice wait"0b" lucid atload'bindkey "$terminfo[kcuu1]" history-substring-search-up; bindkey "$terminfo[kcud1]" history-substring-search-down'

    zinit ice wait"0b" lucid atload'bindkey "$terminfo[kcuu1]" history-substring-search-up; bindkey "$terminfo[kcud1]" history-substring-search-down'
    zinit light zsh-users/zsh-history-substring-search
    bindkey '^[[A' history-substring-search-up
    bindkey '^[[B' history-substring-search-down
    bindkey -M vicmd 'k' history-substring-search-up
    bindkey -M vicmd 'j' history-substring-search-down

    # Find a way to change after syntax is loaded
    # FAST_THEME_NAME=spa
    # typeset -gA FAST_HIGHLIGHT
    # FAST_HIGHLIGHT[git-cmsg-len]=120
    zinit ice wait"0c" lucid atinit"typeset -gA FAST_HIGHLIGHT; FAST_HIGHLIGHT[git-cmsg-len]=100; zpcompinit; zpcdreplay"
    zinit light zdharma/fast-syntax-highlighting

    # TAB COMPLETIONS
    zinit ice wait"0b" lucid blockf
    zinit light zsh-users/zsh-completions
    zstyle ':completion:*' completer _expand _complete _ignored _approximate
    @@ -53,8 +52,24 @@ zstyle ':completion:*:*:*:*:processes' command "ps -u $USER -o pid,user,comm,cmd
    zstyle ':fzf-tab:complete:kill:argument-rest' extra-opts --preview=$extract'ps --pid=$in[(w)1] -o cmd --no-headers -w -w' --preview-window=down:3:wrap
    zstyle ':fzf-tab:complete:cd:*' extra-opts --preview=$extract'exa -1 --color=always ${~ctxt[hpre]}$in'

    # Find a way to change after syntax is loaded, otherwise call `fast-theme spa`
    # FAST_THEME_NAME=spa
    zinit ice wait"0c" lucid atinit"typeset -gA FAST_HIGHLIGHT; FAST_HIGHLIGHT[git-cmsg-len]=100; zpcompinit; zpcdreplay"
    zinit light zdharma/fast-syntax-highlighting

    #####################
    # OHMYZSH PLUGINS #
    #####################

    setopt promptsubst

    # Loading tmux first, to prevent jumps when tmux is loaded after .zshrc
    zinit ice svn atinit"
    ZSH_TMUX_FIXTERM=true;
    ZSH_TMUX_AUTOSTART=true;
    ZSH_TMUX_AUTOCONNECT=true;"
    zinit snippet OMZP::tmux

    zinit wait lucid for \
    OMZL::git.zsh \
    OMZL::clipboard.zsh \
    @@ -66,18 +81,31 @@ zinit wait lucid for \
    OMZL::compfix.zsh \
    OMZL::correction.zsh \
    OMZL::completion.zsh \
    atload"
    bindkey '^[[A' history-substring-search-up;
    bindkey '^[[B' history-substring-search-down;
    bindkey -M vicmd 'k' history-substring-search-up;
    bindkey -M vicmd 'j' history-substring-search-down;" \
    OMZL::key-bindings.zsh \
    OMZP::git \
    OMZP::fzf \
    OMZP::docker-compose \
    svn atinit'ZSH_TMUX_FIXTERM=true; ZSH_TMUX_AUTOSTART=true; ZSH_TMUX_AUTOCONNECT=true;' \
    OMZP::tmux \
    as"completion" \
    OMZP::docker/_docker

    # A fork of `z' by rupa deadwyler with much improved zsh/bash completion and better results. The data file format and core algorithm are compatible with those of the original.
    zinit ice wait lucid src"z.sh"
    zinit light knu/z

    #####################
    # Prompt #
    #####################
    zinit ice from"gh-r" as"program" atload'eval "$(starship init zsh)"'
    zinit load starship/starship

    #####################
    # LS_COLORS #
    #####################
    zinit ice wait"0c" lucid reset \
    atclone"local P=${${(M)OSTYPE:#*darwin*}:+g}
    \${P}sed -i \
    @@ -87,146 +115,21 @@ zinit ice wait"0c" lucid reset \
    atload'zstyle ":completion:*" list-colors “${(s.:.)LS_COLORS}”'
    zinit light trapd00r/LS_COLORS

    # A fork of `z' by rupa deadwyler with much improved zsh/bash completion and better results. The data file format and core algorithm are compatible with those of the original.
    zinit ice src"z.sh"
    zinit light knu/z

    #####################
    # HISTORY #
    #####################
    [ -z "$HISTFILE" ] && HISTFILE="$HOME/.zsh_history"
    HISTSIZE=290000
    SAVEHIST=$HISTSIZE

    #####################
    # SETOPT #
    #####################
    # set -o emacs
    setopt extended_history # record timestamp of command in HISTFILE
    setopt hist_expire_dups_first # delete duplicates first when HISTFILE size exceeds HISTSIZE
    setopt hist_ignore_all_dups # ignore duplicated commands history list
    setopt hist_ignore_space # ignore commands that start with space
    setopt hist_verify # show command with history expansion to user before running it
    setopt inc_append_history # add commands to HISTFILE in order of execution
    setopt share_history # share command history data
    setopt always_to_end # cursor moved to the end in full completion
    setopt hash_list_all # hash everything before completion
    setopt completealiases # complete alisases
    setopt always_to_end # when completing from the middle of a word, move the cursor to the end of the word
    setopt complete_in_word # allow completion from within a word/phrase
    setopt nocorrect # spelling correction for commands
    setopt list_ambiguous # complete as much of a completion until it gets ambiguous.
    setopt nolisttypes
    setopt listpacked
    setopt automenu
    # setopt vi

    #####################
    # ENV VARIABLE #
    #####################
    ZSH_AUTOSUGGEST_MANUAL_REBIND=1 # make prompt faster
    DISABLE_MAGIC_FUNCTIONS=true # make pasting into terminal faster
    export EDITOR=nvim
    export PAGER=bat
    export DOCKER_BUILDKIT=1
    export COMPOSE_DOCKER_CLI_BUILD=1

    #####################
    # ALIASES #
    #####################
    alias vim=$EDITOR
    alias ..="cd .."
    alias ...="cd ..."
    alias cat=bat
    alias tf=terraform
    alias l="exa -abghHlS --git --group-directories-first"
    alias myip=ipInternal
    alias sysinfo="inxi -Fxxxz"
    alias gcd="gco dev"
    alias psqlstart="sudo systemctl start postgresql.service"
    alias dcupb="docker-compose up --build"
    alias h="http"

    alias checkup="sudo pamac checkupdates -a"
    alias up="pamac upgrade -a --no-confirm"
    alias upnup="sudo pacman -Syyuu"
    alias cleanup="sudo pacman -Rsn $(pacman -Qdtq)"
    alias buildup="pamac build --no-confirm"
    alias npmnuke="echo Deleting ^/node_modules/ && rm -rf ./**/node_modules"

    alias myip=ipInternal
    alias sysinfo="inxi -Fxxxz"

    #####################
    # FZF SETTINGS #
    # MANUAL CONFIG #
    #####################
    FD_OPTIONS="--hidden --follow"
    export FZF_DEFAULT_OPTS="--prompt '⯈ ' --marker=+ --color=dark --layout=reverse --color=fg:250,fg+:15,hl:203,hl+:203 --color=info:100,pointer:15,marker:220,spinner:11,header:-1,gutter:-1,prompt:15"
    export FZF_DEFAULT_COMMAND="fd --type f --type l $FD_OPTIONS || git ls-files --cached --others --exclude-standard"
    export FZF_CTRL_T_COMMAND="fd $FD_OPTIONS"
    export FZF_ALT_C_COMMAND="fd --type d $FD_OPTIONS"
    export FZF_COMPLETION_OPTS="-x"

    _fzf_compgen_path() {
    fd --hidden --follow . "$1"
    }
    _fzf_compgen_dir() {
    fd --type d --hidden --follow . "$1"
    }

    #####################
    # GO SETTINGS #
    #####################
    export CGO_ENABLED=1
    export CGO_CFLAGS="-g -O2 -Wno-return-local-addr"
    export GOPATH="$HOME/go/"
    export PATH="$GOPATH/bin:$PATH"
    # 1. Load ~/.localrc, if it exists
    zinit is-snippet for \
    if"[[ -f $HOME/.localrc ]]" $HOME/.localrc

    # typeset -U config_files
    # config_files=($HOME/.zsh/*.zsh)

    #####################
    # Node and Yarn #
    #####################
    export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
    export N_PREFIX="$HOME/n"; [[ :$PATH: == *":$N_PREFIX/bin:"* ]] || PATH+=":$N_PREFIX/bin" # Added by n-install (see http://git.io/n-install-repo).

    # 1. Load anything which ends with e.zsh
    # 2. Load anything except file ending with e.zsh
    # zinit is-snippet for \
    # ${(M)config_files:#*/*e.zsh} \
    # ${config_files:#*/*e.zsh} \

    #####################
    # Functions #
    #####################
    function ipInternal() {
    # echo "Ethernet :: IP => $( ip -4 -o a show wlan1 | awk '{ print $4 }' )"
    echo "Wireless :: IP => $( ip -4 -o a show wlo1 | awk '{ print $4 }' )"
    }

    function ipExternal() {
    echo "External :: IP => $( curl --silent https://ifconfig.me )"
    }

    function ipinfo() {
    ipInternal
    ipExternal
    }

    prcreate() {
    gh pr create -B "$1" -f
    }

    prmerge() {
    gh pr merge --merge --delete-branch=false "$1"
    }

    prlist() {
    gh pr list --state open
    }

    open_with_fzf() {
    fd -t f -H -I | fzf -m --preview="xdg-mime query default {}" | xargs -ro -d "\n" xdg-open 2>&-
    }

    cd_with_fzf() {
    cd $HOME && cd "$(fd -t d | fzf --preview="tree -L 1 {}" --bind="space:toggle-preview" --preview-window=:hidden)"
    }

    pacs() {
    sudo pacman -Syy $(pacman -Ssq | fzf -m --preview="pacman -Si {}" --preview-window=:hidden --bind=space:toggle-preview)
    }
  3. @numToStr numToStr revised this gist Sep 17, 2020. 1 changed file with 196 additions and 26 deletions.
    222 changes: 196 additions & 26 deletions .zshrc.zinit
    Original file line number Diff line number Diff line change
    @@ -14,35 +14,44 @@ autoload -Uz _zinit
    (( ${+_comps} )) && _comps[zinit]=_zinit
    ### End of Zinit's installer chunk

    # Globals
    export EDITOR='nvim'
    export PAGER='bat'
    export DOCKER_BUILDKIT=1
    export COMPOSE_DOCKER_CLI_BUILD=1

    # Aliases
    alias vim=$(which nvim)
    alias ..="cd .."
    alias ...="cd ..."

    # Ohmyzsh variables
    ZSH_TMUX_FIXTERM=true
    ZSH_TMUX_AUTOSTART=true
    ZSH_TMUX_AUTOCONNECT=true
    #####################
    # PLUGINS #
    #####################
    # @source: https://github.com/crivotz/dot_files/blob/master/linux/zplugin/zshrc

    ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE=20
    zinit ice wait"0a" lucid atload"_zsh_autosuggest_start"
    zinit light zsh-users/zsh-autosuggestions

    # Two regular plugins loaded without investigating.
    # zinit light zsh-users/zsh-autosuggestions
    # zinit light zdharma/fast-syntax-highlighting
    zinit ice wait"0b" lucid atload'bindkey "$terminfo[kcuu1]" history-substring-search-up; bindkey "$terminfo[kcud1]" history-substring-search-down'
    zinit light zsh-users/zsh-history-substring-search
    bindkey '^[[A' history-substring-search-up
    bindkey '^[[B' history-substring-search-down
    bindkey -M vicmd 'k' history-substring-search-up
    bindkey -M vicmd 'j' history-substring-search-down

    zinit for \
    zsh-users/zsh-completions \
    light-mode zdharma/fast-syntax-highlighting \
    light-mode zsh-users/zsh-autosuggestions \
    light-mode zsh-users/zsh-history-substring-search
    # Find a way to change after syntax is loaded
    # FAST_THEME_NAME=spa
    # typeset -gA FAST_HIGHLIGHT
    # FAST_HIGHLIGHT[git-cmsg-len]=120
    zinit ice wait"0c" lucid atinit"typeset -gA FAST_HIGHLIGHT; FAST_HIGHLIGHT[git-cmsg-len]=100; zpcompinit; zpcdreplay"
    zinit light zdharma/fast-syntax-highlighting

    zinit ice from"gh-r" as"program" atload'eval "$(starship init zsh)"'
    zinit load starship/starship
    # TAB COMPLETIONS
    zinit ice wait"0b" lucid blockf
    zinit light zsh-users/zsh-completions
    zstyle ':completion:*' completer _expand _complete _ignored _approximate
    zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
    zstyle ':completion:*' menu select=2
    zstyle ':completion:*' select-prompt '%SScrolling active: current selection at %p%s'
    zstyle ':completion:*:descriptions' format '-- %d --'
    zstyle ':completion:*:processes' command 'ps -au$USER'
    zstyle ':completion:complete:*:options' sort false
    zstyle ':fzf-tab:complete:_zlua:*' query-string input
    zstyle ':completion:*:*:*:*:processes' command "ps -u $USER -o pid,user,comm,cmd -w -w"
    zstyle ':fzf-tab:complete:kill:argument-rest' extra-opts --preview=$extract'ps --pid=$in[(w)1] -o cmd --no-headers -w -w' --preview-window=down:3:wrap
    zstyle ':fzf-tab:complete:cd:*' extra-opts --preview=$extract'exa -1 --color=always ${~ctxt[hpre]}$in'

    setopt promptsubst

    @@ -54,9 +63,170 @@ zinit wait lucid for \
    OMZL::history.zsh \
    OMZL::spectrum.zsh \
    OMZL::termsupport.zsh \
    OMZL::compfix.zsh \
    OMZL::correction.zsh \
    OMZL::completion.zsh \
    OMZL::key-bindings.zsh \
    OMZP::git \
    OMZP::tmux \
    OMZP::fzf \
    OMZP::docker-compose \
    svn atinit'ZSH_TMUX_FIXTERM=true; ZSH_TMUX_AUTOSTART=true; ZSH_TMUX_AUTOCONNECT=true;' \
    OMZP::tmux \
    as"completion" \
    OMZP::docker/_docker
    OMZP::docker/_docker

    zinit ice from"gh-r" as"program" atload'eval "$(starship init zsh)"'
    zinit load starship/starship

    zinit ice wait"0c" lucid reset \
    atclone"local P=${${(M)OSTYPE:#*darwin*}:+g}
    \${P}sed -i \
    '/DIR/c\DIR 38;5;63;1' LS_COLORS; \
    \${P}dircolors -b LS_COLORS > c.zsh" \
    atpull'%atclone' pick"c.zsh" nocompile'!' \
    atload'zstyle ":completion:*" list-colors “${(s.:.)LS_COLORS}”'
    zinit light trapd00r/LS_COLORS

    # A fork of `z' by rupa deadwyler with much improved zsh/bash completion and better results. The data file format and core algorithm are compatible with those of the original.
    zinit ice src"z.sh"
    zinit light knu/z

    #####################
    # HISTORY #
    #####################
    [ -z "$HISTFILE" ] && HISTFILE="$HOME/.zsh_history"
    HISTSIZE=290000
    SAVEHIST=$HISTSIZE

    #####################
    # SETOPT #
    #####################
    # set -o emacs
    setopt extended_history # record timestamp of command in HISTFILE
    setopt hist_expire_dups_first # delete duplicates first when HISTFILE size exceeds HISTSIZE
    setopt hist_ignore_all_dups # ignore duplicated commands history list
    setopt hist_ignore_space # ignore commands that start with space
    setopt hist_verify # show command with history expansion to user before running it
    setopt inc_append_history # add commands to HISTFILE in order of execution
    setopt share_history # share command history data
    setopt always_to_end # cursor moved to the end in full completion
    setopt hash_list_all # hash everything before completion
    setopt completealiases # complete alisases
    setopt always_to_end # when completing from the middle of a word, move the cursor to the end of the word
    setopt complete_in_word # allow completion from within a word/phrase
    setopt nocorrect # spelling correction for commands
    setopt list_ambiguous # complete as much of a completion until it gets ambiguous.
    setopt nolisttypes
    setopt listpacked
    setopt automenu
    # setopt vi

    #####################
    # ENV VARIABLE #
    #####################
    ZSH_AUTOSUGGEST_MANUAL_REBIND=1 # make prompt faster
    DISABLE_MAGIC_FUNCTIONS=true # make pasting into terminal faster
    export EDITOR=nvim
    export PAGER=bat
    export DOCKER_BUILDKIT=1
    export COMPOSE_DOCKER_CLI_BUILD=1

    #####################
    # ALIASES #
    #####################
    alias vim=$EDITOR
    alias ..="cd .."
    alias ...="cd ..."
    alias cat=bat
    alias tf=terraform
    alias l="exa -abghHlS --git --group-directories-first"
    alias myip=ipInternal
    alias sysinfo="inxi -Fxxxz"
    alias gcd="gco dev"
    alias psqlstart="sudo systemctl start postgresql.service"
    alias dcupb="docker-compose up --build"
    alias h="http"

    alias checkup="sudo pamac checkupdates -a"
    alias up="pamac upgrade -a --no-confirm"
    alias upnup="sudo pacman -Syyuu"
    alias cleanup="sudo pacman -Rsn $(pacman -Qdtq)"
    alias buildup="pamac build --no-confirm"
    alias npmnuke="echo Deleting ^/node_modules/ && rm -rf ./**/node_modules"

    alias myip=ipInternal
    alias sysinfo="inxi -Fxxxz"

    #####################
    # FZF SETTINGS #
    #####################
    FD_OPTIONS="--hidden --follow"
    export FZF_DEFAULT_OPTS="--prompt '⯈ ' --marker=+ --color=dark --layout=reverse --color=fg:250,fg+:15,hl:203,hl+:203 --color=info:100,pointer:15,marker:220,spinner:11,header:-1,gutter:-1,prompt:15"
    export FZF_DEFAULT_COMMAND="fd --type f --type l $FD_OPTIONS || git ls-files --cached --others --exclude-standard"
    export FZF_CTRL_T_COMMAND="fd $FD_OPTIONS"
    export FZF_ALT_C_COMMAND="fd --type d $FD_OPTIONS"
    export FZF_COMPLETION_OPTS="-x"

    _fzf_compgen_path() {
    fd --hidden --follow . "$1"
    }
    _fzf_compgen_dir() {
    fd --type d --hidden --follow . "$1"
    }

    #####################
    # GO SETTINGS #
    #####################
    export CGO_ENABLED=1
    export CGO_CFLAGS="-g -O2 -Wno-return-local-addr"
    export GOPATH="$HOME/go/"
    export PATH="$GOPATH/bin:$PATH"


    #####################
    # Node and Yarn #
    #####################
    export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
    export N_PREFIX="$HOME/n"; [[ :$PATH: == *":$N_PREFIX/bin:"* ]] || PATH+=":$N_PREFIX/bin" # Added by n-install (see http://git.io/n-install-repo).


    #####################
    # Functions #
    #####################
    function ipInternal() {
    # echo "Ethernet :: IP => $( ip -4 -o a show wlan1 | awk '{ print $4 }' )"
    echo "Wireless :: IP => $( ip -4 -o a show wlo1 | awk '{ print $4 }' )"
    }

    function ipExternal() {
    echo "External :: IP => $( curl --silent https://ifconfig.me )"
    }

    function ipinfo() {
    ipInternal
    ipExternal
    }

    prcreate() {
    gh pr create -B "$1" -f
    }

    prmerge() {
    gh pr merge --merge --delete-branch=false "$1"
    }

    prlist() {
    gh pr list --state open
    }

    open_with_fzf() {
    fd -t f -H -I | fzf -m --preview="xdg-mime query default {}" | xargs -ro -d "\n" xdg-open 2>&-
    }

    cd_with_fzf() {
    cd $HOME && cd "$(fd -t d | fzf --preview="tree -L 1 {}" --bind="space:toggle-preview" --preview-window=:hidden)"
    }

    pacs() {
    sudo pacman -Syy $(pacman -Ssq | fzf -m --preview="pacman -Si {}" --preview-window=:hidden --bind=space:toggle-preview)
    }
  4. @numToStr numToStr created this gist Sep 17, 2020.
    62 changes: 62 additions & 0 deletions .zshrc.zinit
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,62 @@
    #!/bin/zsh

    ### Added by Zinit's installer
    if [[ ! -f $HOME/.zinit/bin/zinit.zsh ]]; then
    print -P "%F{33}▓▒░ %F{220}Installing %F{33}DHARMA%F{220} Initiative Plugin Manager (%F{33}zdharma/zinit%F{220})…%f"
    command mkdir -p "$HOME/.zinit" && command chmod g-rwX "$HOME/.zinit"
    command git clone https://github.com/zdharma/zinit "$HOME/.zinit/bin" && \
    print -P "%F{33}▓▒░ %F{34}Installation successful.%f%b" || \
    print -P "%F{160}▓▒░ The clone has failed.%f%b"
    fi

    source "$HOME/.zinit/bin/zinit.zsh"
    autoload -Uz _zinit
    (( ${+_comps} )) && _comps[zinit]=_zinit
    ### End of Zinit's installer chunk

    # Globals
    export EDITOR='nvim'
    export PAGER='bat'
    export DOCKER_BUILDKIT=1
    export COMPOSE_DOCKER_CLI_BUILD=1

    # Aliases
    alias vim=$(which nvim)
    alias ..="cd .."
    alias ...="cd ..."

    # Ohmyzsh variables
    ZSH_TMUX_FIXTERM=true
    ZSH_TMUX_AUTOSTART=true
    ZSH_TMUX_AUTOCONNECT=true


    # Two regular plugins loaded without investigating.
    # zinit light zsh-users/zsh-autosuggestions
    # zinit light zdharma/fast-syntax-highlighting

    zinit for \
    zsh-users/zsh-completions \
    light-mode zdharma/fast-syntax-highlighting \
    light-mode zsh-users/zsh-autosuggestions \
    light-mode zsh-users/zsh-history-substring-search

    zinit ice from"gh-r" as"program" atload'eval "$(starship init zsh)"'
    zinit load starship/starship

    setopt promptsubst

    zinit wait lucid for \
    OMZL::git.zsh \
    OMZL::clipboard.zsh \
    OMZL::directories.zsh \
    OMZL::grep.zsh \
    OMZL::history.zsh \
    OMZL::spectrum.zsh \
    OMZL::termsupport.zsh \
    OMZP::git \
    OMZP::tmux \
    OMZP::fzf \
    OMZP::docker-compose \
    as"completion" \
    OMZP::docker/_docker