Skip to content

Instantly share code, notes, and snippets.

@pashtet04
Last active April 19, 2020 16:40
Show Gist options
  • Select an option

  • Save pashtet04/dd3aa97f44f64ef7c1a11e05466bc8c6 to your computer and use it in GitHub Desktop.

Select an option

Save pashtet04/dd3aa97f44f64ef7c1a11e05466bc8c6 to your computer and use it in GitHub Desktop.

Revisions

  1. pashtet04 revised this gist Apr 19, 2020. 1 changed file with 9 additions and 3 deletions.
    12 changes: 9 additions & 3 deletions .zshrc
    Original file line number Diff line number Diff line change
    @@ -93,13 +93,19 @@ source /usr/share/doc/find-the-command/ftc.zsh
    # OMZ before completions
    source $ZSH/oh-my-zsh.sh

    # kubens & kubectx plugin aliases and completion init
    alias kns='kubens'
    alias ktx='kubectx'
    autoload -U compinit && compinit

    # Completions ALWAYS after OMZ
    #function kubectl() { echo "+ kubectl $@">&2; command kubectl $@; }
    function kubectl() { echo "+ kubectl $@">&2; command kubectl $@; }
    source <(kind completion zsh)
    source <(helm completion zsh)
    source <(kubectl completion zsh)
    alias k='kubectl'
    [ -f ~/.kubectl_aliases ] && source ~/.kubectl_aliases
    complete -F __start_kubectl k

    autoload -U compinit && compinit

    # https://github.com/trapd00r/LS_COLORS/
    [ -f /usr/share/LS_COLORS/dircolors.sh ] && source /usr/share/LS_COLORS/dircolors.sh
  2. pashtet04 revised this gist Apr 19, 2020. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions .zshrc
    Original file line number Diff line number Diff line change
    @@ -101,4 +101,5 @@ complete -F __start_kubectl k

    autoload -U compinit && compinit

    # https://github.com/trapd00r/LS_COLORS/
    [ -f /usr/share/LS_COLORS/dircolors.sh ] && source /usr/share/LS_COLORS/dircolors.sh
  3. pashtet04 created this gist Apr 19, 2020.
    104 changes: 104 additions & 0 deletions .zshrc
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,104 @@
    export ZSH=$HOME/.oh-my-zsh
    export ZSH_CUSTOM=$HOME/.oh-my-zsh/custom

    # Lines configured by zsh-newuser-install
    HISTFILE=~/.histfile
    HISTSIZE=10000
    SAVEHIST=10000
    setopt appendhistory autocd COMPLETE_ALIASES
    bindkey -v
    # End of lines configured by zsh-newuser-install
    # The following lines were added by compinstall

    zstyle ':completion:*' menu select completer _complete _ignored
    zstyle :compinstall filename '/home/nolche/.zshrc'

    zle -N up-line-or-beginning-search
    zle -N down-line-or-beginning-search

    typeset -U PATH path
    path=("$HOME/.local/bin" "$path[@]")
    export PATH

    # 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[ShiftTab]="${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-beginning-search
    [[ -n "${key[Down]}" ]] && bindkey -- "${key[Down]}" down-line-or-beginning-search
    [[ -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[ShiftTab]}" ]] && bindkey -- "${key[ShiftTab]}" 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

    plugins=(
    archlinux
    git
    history-substring-search
    colored-man-pages
    zsh-autosuggestions
    zsh-syntax-highlighting
    history
    kubectl
    helm
    )

    ZSH_THEME="spaceship"

    export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"
    export PATH="$PATH:$HOME/go/bin"

    if systemctl -q is-active graphical.target && [[ ! $DISPLAY && $XDG_VTNR -eq 1 ]]; then
    exec startx
    fi
    export EDITOR=/usr/bin/vim
    export VISUAL=/usr/bin/vim

    # Find the command
    source /usr/share/doc/find-the-command/ftc.zsh
    # OMZ before completions
    source $ZSH/oh-my-zsh.sh

    # Completions ALWAYS after OMZ
    #function kubectl() { echo "+ kubectl $@">&2; command kubectl $@; }
    source <(kubectl completion zsh)
    [ -f ~/.kubectl_aliases ] && source ~/.kubectl_aliases
    complete -F __start_kubectl k

    autoload -U compinit && compinit

    [ -f /usr/share/LS_COLORS/dircolors.sh ] && source /usr/share/LS_COLORS/dircolors.sh