From: Armaan Bhojwani Date: Mon, 26 Apr 2021 03:36:18 +0000 (-0400) Subject: zsh: simplify config X-Git-Url: https://git.armaanb.net/?p=config.org.git;a=commitdiff_plain;h=6458abe3ad0b881cd21f7c26ef947a37009936c7 zsh: simplify config --- diff --git a/config.org b/config.org index bda9540..ba77865 100644 --- a/config.org +++ b/config.org @@ -855,6 +855,16 @@ No more clogging up init.el. setopt no_case_glob unsetopt glob_complete + + # Fragment completions + zstyle ':completion:*' list-suffixes
zstyle ':completion:*' expand prefix suffix + + # Menu completions + zstyle ':completion:*' menu select + zmodload zsh/complist + bindkey -M menuselect '^n' expand-or-complete + bindkey -M menuselect '^p' reverse-menu-complete + #+end_src **** Vim bindings #+begin_src shell :tangle ~/.config/zsh/zshrc @@ -883,11 +893,11 @@ No more clogging up init.el. #+end_src *** Plugins I manage plugins using my own plugin manager, ZPE. https://git.sr.ht/~armaan/zpe + +Right now, I'm only using fast-syntax-highlighting. It's a really nice visual addition. **** ZPE #+begin_src conf :tangle ~/.config/zpe/repositories - https://github.com/Aloxaf/fzf-tab - https://github.com/zdharma/fast-syntax-highlighting - https://github.com/rupa/z + https://github.com/zdharma/fast-syntax-highlighting #+end_src **** Zshrc #+begin_src shell :tangle ~/.config/zsh/zshrc @@ -895,25 +905,9 @@ I manage plugins using my own plugin manager, ZPE. https://git.sr.ht/~armaan/zpe source ~/Code/admone/admone.zsh source ~/.config/zsh/fzf-bindings.zsh - zpe-source fzf-tab/fzf-tab.zsh - zstyle ':completion:*:descriptions' format '[%d]' - zstyle ':fzf-tab:complete:cd:*' fzf-preview 'exa -1 --color=always $realpath' - zstyle ':completion:*' completer _complete - zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' \ - 'm:{a-zA-Z}={A-Za-z} l:|=* r:|=*' - enable-fzf-tab zpe-source fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh - export _Z_DATA="/home/armaa/.local/share/z" - zpe-source z/z.sh #+end_src *** Functions -**** Alert after long command -#+begin_src shell :tangle ~/.config/zsh/zshrc - alert() { - notify-send --urgency=low -i ${(%):-%(?.terminal.error)} \ - ${history[$HISTCMD]%[;&|][[:space:]]##alert} - } -#+end_src **** Time Zsh startup #+begin_src shell :tangle ~/.config/zsh/zshrc timezsh() { @@ -966,27 +960,6 @@ I manage plugins using my own plugin manager, ZPE. https://git.sr.ht/~armaan/zpe echo "${color}All orphans cleaned!${reset}" } #+end_src -**** ls every cd -#+begin_src shell :tangle ~/.config/zsh/zshrc - chpwd() { - emulate -L zsh - exa -lh --icons --git --group-directories-first - } -#+end_src -**** Change default enter behavior -If no command given, =ls=, if in a Git repo, =git status= as well. -#+begin_src shell :tangle ~/.config/zsh/zshrc - acheam-accept-line () { - zle accept-line - if [ ${#${(z)BUFFER}} -eq 0 ]; then - echo - exa -lh --icons --git --group-directories-first - [ -d ".git" ] && git status - fi - } - zle -N acheam-accept-line - bindkey '^M' acheam-accept-line -#+end_src **** Setup anaconda #+begin_src shell :tangle ~/.config/zsh/zshrc zconda() { @@ -1012,14 +985,6 @@ If no command given, =ls=, if in a Git repo, =git status= as well. 0short() { curl -F"shorten=$1" "$zxz" ; } 0clip() { xclip -out | curl -F"file=@-;" "$zxz" ; } #+end_src -**** Swap two files -#+begin_src shell :tangle ~/.config/zsh/zshrc - sw() { - mv $1 $1.tmp - mv $2 $1 - mv $1.tmp $2 - } -#+end_src **** Finger #+begin_src shell :tangle ~/.config/zsh/zshrc finger() {