first commit
This commit is contained in:
commit
205faf4224
5471 changed files with 973850 additions and 0 deletions
800
config/zsh/.zhistory
Normal file
800
config/zsh/.zhistory
Normal file
|
|
@ -0,0 +1,800 @@
|
|||
: 1766748319:0;unset LD_PRELOAD; ls
|
||||
: 1766748437:0;rm .bashrc .bash_profile .bash_logout .bash_history
|
||||
: 1766748460:0;sudo rm .bash_logout .bash_profile .bashrc .bash_history
|
||||
: 1766748762:0;cd .config/hypr
|
||||
: 1766748887:0;ls -l /lib/intel64/libmkl_rt.so\
|
||||
|
||||
: 1766748917:0;sudo pacman -S intel-mkl
|
||||
: 1766748944:0;find / -name "libmkl_rt.so" 2>/dev/null\
|
||||
|
||||
: 1766748995:0;zsh
|
||||
: 1766748998:0;cd zsh
|
||||
: 1766749010:0;vim options
|
||||
: 1766749023:0;vim prompt
|
||||
: 1766749199:0;sudo pacman -S Nyxt
|
||||
: 1766749206:0;yay -S nyxt
|
||||
: 1766749330:0;sudo pacman -Rns nyxt
|
||||
: 1766749388:0;echo $LD_PRELOAD
|
||||
: 1766749394:0;grep -r "LD_PRELOAD" ~/.bashrc ~/.bash_profile ~/.profile ~/.zshrc ~/.zshenv 2>/dev/null\
|
||||
|
||||
: 1766749411:0;vim .zshrc
|
||||
: 1766749420:0;vim .zshenv
|
||||
: 1766749521:0;cat /etc/ld.so.preload\
|
||||
|
||||
: 1766749533:0;env | grep LD_PRELOAD\
|
||||
printenv LD_PRELOAD
|
||||
: 1766749556:0;grep -r "LD_PRELOAD\|libmkl_rt" ~/*rc ~/*profile /etc/profile.d/ 2>/dev/null || true
|
||||
: 1766749562:0;history | grep -i "export.*LD_PRELOAD"
|
||||
: 1766749574:0;ps -o pid,ppid,cmd -p $$ # PID de votre shell actuel\
|
||||
pstree -p $$ -a | grep LD_PRELOAD # ou ps aux | grep LD_PRELOAD
|
||||
: 1766749578:0;unset LD_PRELOAD
|
||||
: 1766749647:0;rm -r nyxt
|
||||
: 1766749655:0;sudo rm -r nyxt
|
||||
: 1766750633:0;sudo pacman -S neo-matrix
|
||||
: 1766750679:0;yay -S tty-clock
|
||||
: 1766750761:0;neo -h
|
||||
: 1766750783:0;man neo-matrix
|
||||
: 1766750967:0;fastfetch
|
||||
: 1766751160:0;neo-matrix -a -D -F
|
||||
: 1766751189:0;tty-clock -S
|
||||
: 1766751213:0;tty-clock -c -r
|
||||
: 1766751220:0;tty-clock -c
|
||||
: 1766751461:0;sudo pacman -S ttf-cousine-nerd
|
||||
: 1766751734:0;vim /etc/local.gen
|
||||
: 1766751739:0;vim /etc/locale.gen
|
||||
: 1766751831:0;sudo vim etc/locale.gen
|
||||
: 1766751870:0;locale.gen
|
||||
: 1766753501:0;sudo dpkg-reconfigure locale
|
||||
: 1766753554:0;fc-cache -fv
|
||||
: 1766753571:0;kitty --debug-font-fallback
|
||||
: 1766753591:0;neo-matrix -aDF
|
||||
: 1766753607:0;sudo pacman -Rns neo-matrix
|
||||
: 1766753617:0;yay -S cmatrix
|
||||
: 1766753653:0;cmatrix -ac
|
||||
: 1766753673:0;sudo vim /etc/locale.gen
|
||||
: 1766753687:0;locale-gen
|
||||
: 1766753693:0;sudo locale-gen
|
||||
: 1766753703:0;cmatrix -c
|
||||
: 1766753715:0;cmatrix -f
|
||||
: 1766753736:0;cmatrix -h
|
||||
: 1766753749:0;cmatrix -r -m
|
||||
: 1766753760:0;cmatrix -r
|
||||
: 1766753771:0;cmatrix -C red
|
||||
: 1766753788:0;cmatrix -C red -o
|
||||
: 1766753805:0;cmatrix -C red -l
|
||||
: 1766753825:0;cmatrix -C red -f
|
||||
: 1766754297:0;sudo pacman -S slurp cliphist
|
||||
: 1766754320:0;sudo pacman -Rns slurp cliphist
|
||||
: 1766754333:0;sudo pacman -S grimblast
|
||||
: 1766754338:0;yay -S grimblast
|
||||
: 1766754405:0;yay -S zotero
|
||||
: 1766754893:0;nano /etc/pacman.conf
|
||||
: 1766755013:0;clear
|
||||
: 1766755221:0;pacman -Syy
|
||||
: 1766755261:0;pacman -Sl multilib
|
||||
: 1766755305:0;vim /etc/pacman.conf
|
||||
: 1766755382:0;sudo vim /etc/pacman.conf
|
||||
: 1766755392:0;pacman -Syu
|
||||
: 1766755803:0;sudo steam
|
||||
: 1766755881:0;sudo pacman -Scc
|
||||
: 1766755887:0;sudo pacman -Suu
|
||||
: 1766755897:0;sudo pacman -Rns steam
|
||||
: 1766755900:0;sudo pacman -S steam
|
||||
: 1766755939:0;lspci -v -nn -d ::03xx
|
||||
: 1766756050:0;sudo pacman -Syu linux-headers
|
||||
: 1766756072:0;sudo pacman -S nvidia-dkms nvidia-utils lib32-nvidia-utils nvidia-settings nvidia-prime\
|
||||
|
||||
: 1766756224:0;sudo vim /etc/default/grub
|
||||
: 1766756337:0;sudo grub-mkconfig -o /boot/grub/grub.cfg\
|
||||
|
||||
: 1766756394:0;steam
|
||||
: 1766757867:0;systemctl --failed
|
||||
: 1766757876:0;journalctl -b
|
||||
: 1766758919:0;sudo pacman -S power-profiles-daemon
|
||||
: 1766758928:0;powerprofilectl list
|
||||
: 1766783997:0;powerprofilesctl set economy
|
||||
: 1766784004:0;powerprofilesctl list
|
||||
: 1766784010:0;powerprofilesctl set power-saver
|
||||
: 1766784106:0;yay -S zen
|
||||
: 1766784177:0;yay -S zen-browser-bin
|
||||
: 1766786634:0;zen
|
||||
: 1766786640:0;zen-browser
|
||||
: 1766787271:0;neovim
|
||||
: 1766834411:0;ashell
|
||||
: 1766835788:0;sudo pacman -S ssh
|
||||
: 1766835881:0;sudo pacman -S xclip openssh
|
||||
: 1766835911:0;ls -l
|
||||
: 1766836533:0;ssh-keygen -t ed25519 -C "arch_1.0-ssh"
|
||||
: 1766836660:0;vim id_ed25519.pub
|
||||
: 1766836894:0;sudo pacman -Rns stylua
|
||||
: 1766837001:0;sudo pacman -S xclip
|
||||
: 1766837032:0;sudo pacman -S wl-clipboard
|
||||
: 1766837044:0;sudo pacman -S cliphist
|
||||
: 1766837128:0;sudo pacman -S stylua
|
||||
: 1766837204:0;which stylua
|
||||
: 1766837289:0;nvim pkglist.txt
|
||||
: 1766837307:0;nvim .ssh/id_ed25519.pub
|
||||
: 1766837654:0;git config --global user.name "afoucaultc"
|
||||
: 1766837664:0;git config --global user.email "antoine.fo.ca@proton.me"
|
||||
: 1766837690:0;git clone git@gitlab.com:afoucaultc/dotfiles.git
|
||||
: 1766837771:0;rm Templates
|
||||
: 1766837777:0;rm -r Templates
|
||||
: 1766837783:0;sudo rm -r Templates
|
||||
: 1766837859:0;rm -r hypr fastfetch kitty nvim rofi style.css Typora waybar zsh config.jsonc
|
||||
: 1766837868:0;sudo rm -r hypr fastfetch kitty nvim rofi style.css Typora waybar zsh config.jsonc
|
||||
: 1766837880:0;sudo rm -r .config
|
||||
: 1766837889:0;rm import-config.sh
|
||||
: 1766837896:0;sudo rm import-config.sh
|
||||
: 1766837910:0;sudo rm save_config.sh
|
||||
: 1766837931:0;cd .config/* dotfiles
|
||||
: 1766837939:0;cp .config/* dotfiles
|
||||
: 1766837987:0;sudo rm dotfiles/*
|
||||
: 1766837991:0;sudo rm -r dotfiles/*
|
||||
: 1766838094:0;cp -r .config/* dotfiles
|
||||
: 1766838118:0;cp -r .config/* dotfiles/
|
||||
: 1766838210:0;cp .zsh* /dotfiles
|
||||
: 1766838217:0;cp .zsh* dotfiles/
|
||||
: 1766838270:0;git commit -m "Arch 1.0"
|
||||
: 1766838449:0;git clone git@gitlab.com:afoucaultc/master-report.git
|
||||
: 1766843397:0;sudo pacman -S nomacs
|
||||
: 1766843406:0;yay -S nomacs
|
||||
: 1766858704:0;git commit -m "final commit ggwp"
|
||||
: 1766858830:0;git commit -m "final report"
|
||||
: 1766858977:0;cd cfd/Assignement_3
|
||||
: 1766859006:0;cd workspace
|
||||
: 1766859026:0;mv cfd cfd_copy
|
||||
: 1766859046:0;git clone git@gitlab.com:afoucaultc/CFD.git
|
||||
: 1766859094:0;sudo cp -r cfd_copy/* CFD/
|
||||
: 1766859098:0;cd CFD
|
||||
: 1766859106:0;ls Assignement_3
|
||||
: 1766859306:0;powerprofilesctl set performance
|
||||
: 1766866886:0;sudo pacman -Rns $(pacman -Qdtq)
|
||||
: 1766866929:0;sudo pacman -S pacman-contrib
|
||||
: 1766866959:0;sudo paccache -ruk 1
|
||||
: 1766869361:0;sudo pacman -S htop
|
||||
: 1766869404:0;kill steam
|
||||
: 1766965515:0;yay -S CAVA
|
||||
: 1766965646:0;pacman -Qqe > pkglist.txt
|
||||
: 1766965667:0;yay -Qqe > pkglist_yay.txt
|
||||
: 1766965843:0;sudo pacman -S nftables
|
||||
: 1766965903:0;systemctl enable nftables
|
||||
: 1766966329:0;yay -Rns CAVA
|
||||
: 1767008634:0;sudo pacman -S python
|
||||
: 1767009317:0;mkdir JuliaTraining
|
||||
: 1767009319:0;cd JuliaTraining
|
||||
: 1767010240:0;cd master-report
|
||||
: 1767010244:0;git status
|
||||
: 1767010326:0;git clone https://gitlab.com/afoucaultc/latex_report.git
|
||||
: 1767010355:0;sudo pacman -S open-ssh
|
||||
: 1767010357:0;sudo pacman -S openssh
|
||||
: 1767010363:0;git@gitlab.com:afoucaultc/latex_report.git
|
||||
: 1767010383:0;cd .ssh
|
||||
: 1767010390:0;vim known_hosts
|
||||
: 1767010467:0;sudo git clone git@gitlab.com:afoucaultc/latex_report.git
|
||||
: 1767010548:0;ssh -Tv git@github.com
|
||||
: 1767010568:0;sudo nft list ruleset
|
||||
: 1767010636:0;ls -l ~/.ssh
|
||||
: 1767010660:0;ssh -T git@gitlab.com
|
||||
: 1767011276:0;ssh -vT git@gitlab.com
|
||||
: 1767011321:0;ssh -Tv -4 git@gitlab.com
|
||||
: 1767011425:0;vim ~/.ssh/config
|
||||
: 1767011488:0;chmod ~/.ssh/config
|
||||
: 1767011492:0;chmod 600 ~/.ssh/config
|
||||
: 1767011498:0;git clone git@gitlab.com:afoucaultc/latex_report.git
|
||||
: 1767011587:0;mv latex_report Workspace
|
||||
: 1767011595:0;cd la
|
||||
: 1767011598:0;cd latex_report
|
||||
: 1767014606:0;sudo pacman -S node.js yarn
|
||||
: 1767014616:0;yay -S node.js
|
||||
: 1767014646:0;sudo pacman -S nodejs yarn
|
||||
: 1767016013:0;sudo pacman -S unzip
|
||||
: 1767016104:0;which zen
|
||||
: 1767016124:0;/usr/bin/zen-browser
|
||||
: 1767016437:0;sudo pacman -S tslib
|
||||
: 1767016503:0;cd ~/lvim/lazy/markdown-preview.nvim/app/lib/app/
|
||||
: 1767016557:0;cd /home/afoucaultc/.local/share/nvim/lazy/markdown-preview.nvim/app/
|
||||
: 1767016974:0;mkdir chrome
|
||||
: 1767016980:0;sudo mkdir chrome
|
||||
: 1767016986:0;cd chrome
|
||||
: 1767016995:0;touch userChrome.css
|
||||
: 1767017004:0;sudo touch userChrome.css
|
||||
: 1767017010:0;vim userChrome.css
|
||||
: 1767017015:0;sudo vim userChrome.css
|
||||
: 1767019231:0;locale -a
|
||||
: 1767019254:0;sudo pacman -S noto-fonts-cjk
|
||||
: 1767019860:0;yay -S neomatrix
|
||||
: 1767019891:0;yay -S neo
|
||||
: 1767019898:0;yay -S neo-git
|
||||
: 1767019995:0;yay -Rns neo
|
||||
: 1767019998:0;yay -Rns neo-git
|
||||
: 1767020031:0;yay -S neo-matrix
|
||||
: 1767020129:0;sudo pacman -Syu noto-fonts noto-fonts-cjk noto-fonts-emoji noto-fonts-extra\
|
||||
|
||||
: 1767020149:0;neo-matrix
|
||||
: 1767020173:0;cmatrix
|
||||
: 1767020178:0;sudo pacman -Rns cmatrix
|
||||
: 1767020192:0;neo-matrix -h
|
||||
: 1767020230:0;neo-matrix -c red -D
|
||||
: 1767020252:0;neo-matrix -c purple -D -a
|
||||
: 1767020273:0;neo-matrix -c purple -D -a -f 500
|
||||
: 1767020281:0;neo-matrix -c purple -D -a -f 10000
|
||||
: 1767020302:0;neo-matrix -c purple -D -a -V
|
||||
: 1767020341:0;neo-matrix -c purple -D -a -S 200
|
||||
: 1767020348:0;neo-matrix -c purple -D -a -S 10000
|
||||
: 1767020363:0;neo-matrix -c purple -D -a -S -F
|
||||
: 1767020368:0;neo-matrix -c purple -D -a -F
|
||||
: 1767020393:0;neo-matrix -c purple -D
|
||||
: 1767020418:0;neo-matrix -c purple -D -message="I use arch btw"
|
||||
: 1767020424:0;neo-matrix -c purple -D -message=YES
|
||||
: 1767020440:0;neo-matrix -c purple -D -message=I use arch btw
|
||||
: 1767020456:0;neo-matrix -c purple -D -m I use arch btw
|
||||
: 1767020484:0;neo-matrix -c purple -D -m "I use arch btw"
|
||||
: 1767020545:0;neo-matrix -c purple -D -m "天七ªå¤ªéƒ¸³çºƒ‚僱€çºƒ‚彤彤僳ƒ®\
|
||||
心£ä¸çƒºƒ¤å¤ªéƒ¸³æƒ¸¯æ¯ƒ»æ³½ä¸ƒ¼åƒ³ƒ®\
|
||||
仃¶éƒ‚ƒ¦å¯¼æƒ¨ƒ±ä»¬å¾ƒ·è§£æƒ´¾åƒ³ƒ®\
|
||||
人氃±ç¿»èº«å½ƒ³å®¶å<EFBFBD>ƒºä¸»äºº\
|
||||
侃½åƒ±€ä¾ƒ½åƒ°åƒ³ƒ¿åƒµƒªåƒ±€å¾ƒ·åƒ±€åƒ°åƒ³ƒ¿åƒµƒª\
|
||||
人氃±ç¿»èº«å½ƒ³å®¶å<EFBFBD>ƒºä¸»äºº"
|
||||
: 1767020640:0;neo-matrix -c purple -D -m "Travailleur.euse.s de tous les pays, unissez vous" -s 100
|
||||
: 1767020643:0;neo-matrix -c purple -D -m "Travailleur.euse.s de tous les pays, unissez vous" -s 500
|
||||
: 1767020649:0;neo-matrix -c purple -D -m "Travailleur.euse.s de tous les pays, unissez vous" -S 500
|
||||
: 1767020663:0;neo-matrix -c red -D -m "Travailleur.euse.s de tous les pays, unissez vous" -S 200
|
||||
: 1767020708:0;neo-matrix -c red -D -m "Never gonna give you up, never gonna let you down" -S 200
|
||||
: 1767020987:0;neo-matrix -c red -D -m "" -S 200
|
||||
: 1767020991:0;neo-matrix -c red -D -m "⃀€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€â£¸â£ƒ§âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€\
|
||||
⃀€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ‚°â£¿â£¿âƒ<EFBFBD>ƒ¦âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€\
|
||||
⃀€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ‚ƒ€â£¿â£¿â£¿â£¿âƒ<EFBFBD>ƒ¤âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€\
|
||||
⃀€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ‚¿â£¿â£¿â£¿â£¿â£¿âƒ<EFBFBD>ƒ¤âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€\
|
||||
⃀€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ‚€â£·â£¤â£ƒ¹âƒ‚»â£¿â£¿â£¿â£¿âƒ<EFBFBD>€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€\
|
||||
⃀€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ‚€â£¿â£¿â£¿â£¿â£¿â£¿â£¿â£¿â£¿â£¿âƒ<EFBFBD>€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€\
|
||||
⃀€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ‚ƒ€â£¾â£¿â£¿â£¿â£¿â£¿â£¿â£¿â£¿â£¿â£¿â£·âƒ<EFBFBD>ƒ¤âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€\
|
||||
⃀€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ‚ƒ€â£¿â£¿â£¿â£¿â£¿âƒ<EFBFBD>¿âƒ€ƒ»âƒ€ƒ»âƒ€¿â£¿â£¿â£¿â£¿â£¿âƒ<EFBFBD>ƒ¤âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€\
|
||||
⃀€âƒ€€âƒ€€âƒ€€âƒ€€âƒ‚ƒ€â£¿â£¿â£¿â£¿â£¿âƒ€ƒ¯âƒ€€âƒ€€âƒ€€âƒ€€âƒ€ƒ¹â£¿â£¿â£¿â£¿â£¿âƒ<EFBFBD>ƒ¤âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€\
|
||||
⃀€âƒ€€âƒ€€âƒ€€â£°â£¿â£¿â£¿â£¿â£¿â£¿âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ‚¿â£¿â£¿â£¿â£¿âƒ€¿â£ƒ¦âƒ€€âƒ€€âƒ€€âƒ€€\
|
||||
⃀€âƒ€€âƒ€€â£´â£¿â£¿â£¿â£¿â£¿â£¿â£¿âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€â£¿â£¿â£¿â£¿â£¿â£·â£¦âƒ<EFBFBD>€âƒ€€âƒ€€âƒ€€\
|
||||
⃀€âƒ‚€â£¾â£¿â£¿âƒ€¿âƒ€ƒ¿âƒ€ƒ»âƒ€ƒ«âƒ€ƒ©âƒ€ƒ©âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€ƒ©âƒ€ƒ©âƒ€ƒ¹âƒ€ƒ»âƒ€»âƒ€¿â£¿â£¿â£·âƒ<EFBFBD>€âƒ€€\
|
||||
⣃€âƒ€ƒ¿âƒ€ƒ«âƒ€<EFBFBD>⃀€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€€âƒ€ƒ¨âƒ€ƒ¹âƒ€»â£ƒ¤" -S 200
|
||||
: 1767021028:0;neo-matrix -c red -D -m "  ³\
|
||||
. O+ `\
|
||||
` OOO /\
|
||||
` +OOOO :\
|
||||
` +OOOOOO :\
|
||||
- +OOOOOO+ :\
|
||||
` / : - : + +OOOO+ :\
|
||||
` / ++++ / +++++++ :\
|
||||
` / ++++++++++++++ :\
|
||||
` / +++OOOOOOOOOOO/ `\
|
||||
. / OOOSSSSO++OSSSSSO+`\
|
||||
. OOSSSSSO - ` ` ` ` /OSSSSSS+ `\
|
||||
- OSSSSSSO . : SSSSSSSO .\
|
||||
: OSSSSSSS / OSSSSO+++ .\
|
||||
/ OSSSSSSSS / +SSSSOOO/ - \
|
||||
` / OSSSSSO+ / : - - : / +OSSSSO+ -\
|
||||
` +SSO+ : - ` ` . - / +OSO :\
|
||||
` ++ : . ` - / + /\
|
||||
. ` ` /" -S 200\
|
||||
\
|
||||
\
|
||||
\
|
||||
\
|
||||
\
|
||||
\
|
||||
\
|
||||
\
|
||||
\
|
||||
\
|
||||
\
|
||||
\
|
||||
\
|
||||
\
|
||||
\
|
||||
\
|
||||
\
|
||||
\
|
||||
\
|
||||
\
|
||||
\
|
||||
\
|
||||
\
|
||||
\
|
||||
\
|
||||
\
|
||||
\
|
||||
\
|
||||
\
|
||||
\
|
||||
\
|
||||
\
|
||||
\
|
||||
\
|
||||
\
|
||||
\
|
||||
\
|
||||
\
|
||||
\
|
||||
\
|
||||
\
|
||||
\
|
||||
\
|
||||
\
|
||||
\
|
||||
\
|
||||
\
|
||||
\
|
||||
\
|
||||
\
|
||||
\
|
||||
\
|
||||
\
|
||||
\
|
||||
\
|
||||
\
|
||||
\
|
||||
\
|
||||
\
|
||||
\
|
||||
\
|
||||
\
|
||||
\
|
||||
\
|
||||
\
|
||||
\
|
||||
\
|
||||
\
|
||||
\
|
||||
\
|
||||
|
||||
: 1767021046:0;neo-matrix -c purple -D -m "Travailleur.euse.s de tous les pays, unissez vous"
|
||||
: 1767021176:0;neo-matrix -c purple -D -m "Abattez la citadelle, n'écoutez jamais personne qui vous dira de reculer, de céder. Une société résiste d'autant mieux qu'elle est travaillée par l'instinct de la solidarité et du collectivisme. Soyez collectivistes, soyez solidaires."
|
||||
: 1767021382:0;yay -S neofetch-git
|
||||
: 1767021612:0;htop -C
|
||||
: 1767021651:0;htop
|
||||
: 1767021723:0;htop
|
||||
: 1767022873:0;neo-matrix -c red -D -m "Abattez la citadelle, n'écoutez jamais personne qui vous dira de reculer, de céder. Une société résiste d'autant mieux qu'elle est travaillée par l'instinct de la solidarité et du collectivisme. Soyez collectivistes, soyez solidaires."
|
||||
: 1767023343:0;sudo pacman -S cava
|
||||
: 1767023573:0;cava -p ~/.config/cava/
|
||||
: 1767023626:0;$ pkill -USR1 cava
|
||||
: 1767023642:0;$ pkill -afoucaultc cava
|
||||
: 1767023645:0;pkill cava
|
||||
: 1767023663:0;killall cava
|
||||
: 1767023818:0;ttl-clock
|
||||
: 1767023825:0;clock-ctl
|
||||
: 1767023831:0;ttf-clock
|
||||
: 1767023841:0;tty-clock
|
||||
: 1767045167:0;cd opt/
|
||||
: 1767045193:0;git clone https://github.com/Kwandes/shitpost-generator
|
||||
: 1767045214:0;sudo pacman -S nx
|
||||
: 1767045220:0;npm install -g nx
|
||||
: 1767045228:0;npm install
|
||||
: 1767045300:0;sudo pacman -S docker
|
||||
: 1767045312:0;docker run --name mysql --restart unless-stopped -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=shitpost_generator -p 3306:3306 -d mysql
|
||||
: 1767045333:0;npm run seed
|
||||
: 1767045357:0;nx serve api\
|
||||
nx serve api-mongo\
|
||||
nx serve api-neo\
|
||||
nx serve shitpost-generator
|
||||
: 1767045384:0;sudo rm -r shitpost-generator
|
||||
: 1767045399:0;rm -r Dow
|
||||
: 1767045401:0;rm -r Downloads
|
||||
: 1767045407:0;sudo rm -r Downloads
|
||||
: 1767045427:0;sudo pacman -S gimp
|
||||
: 1767089914:0;killall steam
|
||||
: 1767090810:0;touch latexsnip.lua
|
||||
: 1767090814:0;nvim latexsnip.lua
|
||||
: 1767187322:0;sudo pacman -S signal
|
||||
: 1767187337:0;sudo pacman -S signal-desktop
|
||||
: 1767193869:0;sudo pacman -S ntp
|
||||
: 1767193891:0;timesyncd
|
||||
: 1767193906:0;timedatectl set-ntp true
|
||||
: 1767190316:0;timedatectl
|
||||
: 1767194437:0;sudo pacman -S intel-ucode
|
||||
: 1767196446:0;vim /etc/hostname
|
||||
: 1767196473:0;sudo /etc/hostname
|
||||
: 1767196481:0;sudo vim /etc/hostname
|
||||
: 1767220227:0;sudo pacman -S openvpn openresolv
|
||||
: 1767220272:0;sudo dolphin
|
||||
: 1767220279:0;dolphin --sudo
|
||||
: 1767220303:0;sudo pacman -S kio-admin
|
||||
: 1767220323:0;sudo pacman -Rns kio-admin
|
||||
: 1767220328:0;cd Téléchargements
|
||||
: 1767220405:0;cd mullvad_config_linux_ie_dub
|
||||
: 1767220529:0;sudo openvpn --config ~/Téléchargements/mullvad_config_linux_ie_dub/mullvad_ie_dub.conf
|
||||
: 1767220610:0;sudo cp ~/Téléchargements/mullvad_config_linux_ie_dub /etc/openvpn/client/
|
||||
: 1767220613:0;openvpn
|
||||
: 1767220698:0;ls /etc/openvpn/client
|
||||
: 1767220706:0;sudo ls /etc/openvpn/client
|
||||
: 1767220732:0;cp ~/Téléchargements/mullvad_config_linux_ie_dub /etc/openvpn/client
|
||||
: 1767220741:0;sudo cp -r ~/Téléchargements/mullvad_config_linux_ie_dub /etc/openvpn/client
|
||||
: 1767220746:0;sudo ls -a /etc/openvpn/client
|
||||
: 1767220767:0;sudo cd etc/openvpn/client
|
||||
: 1767220778:0;cd etc/openvpn/client
|
||||
: 1767220794:0;cd -s etc/openvpn/client
|
||||
: 1767220831:0;sudo systemctl start openvpn
|
||||
: 1767220845:0;sudo systemctl enable openvpn
|
||||
: 1767220966:0;sudo ls etc/openvpn/client
|
||||
: 1767221007:0;sudo mv /etc/openvpn/client/mullvad_config_linux_ie_dub/* /etc/openvpn/client/
|
||||
: 1767221036:0;sudo rm -r /etc/openvpn/client/*
|
||||
: 1767221040:0;sudo ls -a etc/openvpn/client
|
||||
: 1768680299:0;exit
|
||||
: 1768680299:0;cd /etc/openvpn/client
|
||||
: 1768680299:0;rm -r mullvad_config_linux_ie_dub/
|
||||
: 1768680299:0;cp ~/Téléchargements/mullvad_config_linux_ie_dub/* /etc/openvpn/client/
|
||||
: 1768680299:0;cp -r ~/Téléchargements/mullvad_config_linux_ie_dub/* /etc/openvpn/client/
|
||||
: 1768680299:0;cp -r /home/afoucaultc/Téléchargements/mullvad_config_linux_ie_dub/* /etc/openvpn/client/
|
||||
: 1768680299:0;openvpn --config /etc/openvpn/client/mullvad_ie_dub.conf
|
||||
: 1768680299:0;cd etc/
|
||||
: 1768680299:0;mv update-resolv-conf ../
|
||||
: 1768680299:0;chmod 755 update-resolv-conf
|
||||
: 1768680299:0;sudo openvpn --config mullvad_ie_dub.conf
|
||||
: 1768680299:0;rm update-resolv-conf
|
||||
: 1768680299:0;cd client/
|
||||
: 1768680299:0;rm mullvad_ca.crt mullvad_ie_dub.conf mullvad_userpass.txt
|
||||
: 1767221773:0;sudo openvpn --config mullvad_ie_dub.conf
|
||||
: 1767221841:0;cp mullvad_config_linux_ie_dub /etc/openvpn/client/
|
||||
: 1767221848:0;sudo cp -r mullvad_config_linux_ie_dub /etc/openvpn/client/
|
||||
: 1767221862:0;sudo cd /etc/openvpn/client/
|
||||
: 1767221869:0;cd /etc/openvpn/client/
|
||||
: 1767221887:0;sudo -s
|
||||
: 1767222290:0;curl https://am.i.mullvad.net/connected
|
||||
: 1767222305:0;sudo chmod 600 /etc/openvpn/client/mullvad_config_linux_ie_dub/mullvad_userpass.txt\
|
||||
|
||||
: 1767222399:0;sudo mv /etc/openvpn/client/mullvad_config_linux_ie_dub/mullvad_ie_dub.conf /etc/openvpn/client/mullvad.conf\
|
||||
sudo mv /etc/openvpn/client/mullvad_config_linux_ie_dub/mullvad_ca.crt /etc/openvpn/client/\
|
||||
sudo mv /etc/openvpn/client/mullvad_config_linux_ie_dub/mullvad_userpass.txt /etc/openvpn/client/\
|
||||
# Le script update-resolv-conf peut rester ou être déplacé selon tes besoins\
|
||||
sudo rmdir /etc/openvpn/client/mullvad_config_linux_ie_dub\
|
||||
|
||||
: 1767222555:0;# up /etc/openvpn/update-resolv-conf\
|
||||
# down /etc/openvpn/update-resolv-conf\
|
||||
|
||||
: 1767222612:0;sudo chown root:openvpn /etc/openvpn/client/mullvad_userpass.txt
|
||||
: 1767222617:0;sudo chmod 640 /etc/openvpn/client/mullvad_userpass.txt
|
||||
: 1767222644:0;sudo chown root:openvpn /etc/openvpn/client/mullvad.conf\
|
||||
sudo chmod 640 /etc/openvpn/client/mullvad.conf\
|
||||
|
||||
: 1767222652:0;sudo systemctl status openvpn-client@mullvad.service\
|
||||
journalctl -xeu openvpn-client@mullvad.service\
|
||||
|
||||
: 1767222694:0;ls -l /etc/openvpn/client/mullvad_userpass.txt\
|
||||
ls -l /etc/openvpn/client/mullvad.conf\
|
||||
|
||||
: 1767222888:0;cd Téléchargements/mullvad_config_linux_ie_dub
|
||||
: 1767222902:0;sudo cp update-resolv-conf /etc/openvpn/
|
||||
: 1767223132:0;sudo systemctl start openvpn-client@mullvad
|
||||
: 1767223216:0;cd /etc/openvpn/
|
||||
: 1767223234:0;-s
|
||||
: 1767223247:0;su
|
||||
: 1767223294:0;sudo openvpn --config /etc/openvpn/client/mullvad.conf
|
||||
: 1767223515:0;sudo chown root:openvpn /etc/openvpn/client/mullvad_userpass.txt\
|
||||
sudo chmod 640 /etc/openvpn/client/mullvad_userpass.txt\
|
||||
|
||||
: 1767223520:0;systemctl start openvpn-client@mullvad.service
|
||||
: 1767223557:0;sudo systemctl restart openvpn-client@mullvad.service
|
||||
: 1767223568:0;systemctl status openvpn-client@mullvad.service
|
||||
: 1767223630:0;sudo pacman -Rns openvpn open-resolve
|
||||
: 1767223633:0;sudo pacman -Rns openvpn openresolve
|
||||
: 1767223639:0;sudo pacman -Rns openvpn
|
||||
: 1767223673:0;sudo pacman -Rns openresolv
|
||||
: 1768680299:0;cd client
|
||||
: 1768680299:0;nano mullvad.conf
|
||||
: 1768680299:0;vim mullvad.conf
|
||||
: 1767224690:0;sudo pacman -S mullvad-vpn
|
||||
: 1767224694:0;sudo pacman -S mullvad-vpn-bin
|
||||
: 1767258074:0;cd .pkg
|
||||
: 1767258089:0;sudo pacman -S gnupg2
|
||||
: 1767258096:0;yay -S gnupg2
|
||||
: 1767258474:0;sudo pacman -S wget
|
||||
: 1767258478:0;wget https://mullvad.net/media/mullvad-code-signing.asc
|
||||
: 1767258481:0;gpg --import mullvad-code-signing.asc
|
||||
: 1767258485:0;gpg --fingerprint admin@mullvad.net
|
||||
: 1767258488:0;gpg --gen-key
|
||||
: 1767258541:0;gpg --sign-key admin@mullvad.net
|
||||
: 1767258560:0;wget --trust-server-names https://mullvad.net/download/app/deb/latest\
|
||||
wget --trust-server-names https://mullvad.net/download/app/deb/latest/signature
|
||||
: 1767258572:0;gpg --verify MullvadVPN-*.deb.asc
|
||||
: 1767258643:0;yay -S mullvad-vpn
|
||||
: 1767259224:0;yay -S mullvad-vpn-bin
|
||||
: 1767260216:0;visudo
|
||||
: 1767260220:0;sudo visudo
|
||||
: 1767287015:0;sudo pacman -Syy
|
||||
: 1767289261:0;sudo pacman -S hyprcursor
|
||||
: 1767289670:0;sudo pacman -S texlive
|
||||
: 1767290445:0;sudo pacman -S zathura-pdf-poppler
|
||||
: 1767291315:0;sudo pacman -S git
|
||||
: 1767291323:0;sudo pacman -S yay
|
||||
: 1767291536:0;sudo pacman -S zen-browser
|
||||
: 1767291669:0;pacman -Q
|
||||
: 1767291677:0;pacman -Qe
|
||||
: 1767291694:0;sudo pacman -S node.js
|
||||
: 1767291730:0;sudo pacman -S npm
|
||||
: 1767291751:0;sudo pacman -S hyprland hyprpaper hyprlock hyprtoolkit ashell dolphin rofi neovim kitty zsh zathura zathura-pdf-poppler texlive grimblast-git cliphist wl-clipboard mako pipewire wireplumber sof-firmware pipewire-pulse pipewire-alsa bluez bluez-utils blueman htop steam gimp nomacs unzip npm yarn\
|
||||
|
||||
: 1767291800:0;sudo pacman -S hyprland hyprpaper hyprlock hyprtoolkit dolphin rofi neovim kitty zsh zathura zathura-pdf-poppler texlive cliphist wl-clipboard mako pipewire wireplumber sof-firmware pipewire-pulse pipewire-alsa bluez bluez-utils blueman htop steam gimp unzip npm yarn\
|
||||
|
||||
: 1767293048:0;cava
|
||||
: 1767299413:0;journalctl -f
|
||||
: 1767299535:0;hyprctl monitors all
|
||||
: 1767299945:0;sudo pacman -Syyu
|
||||
: 1767300343:0;sudo pacman -S nvidia-utils lib32-nvidia-utils
|
||||
: 1767300399:0;sudo vim /etc/modprobe.d/nvidia.conf
|
||||
: 1767300448:0;vim /etc/mkinitcpio.conf
|
||||
: 1767300524:0;sudo vim /etc/mkinitcpio.conf
|
||||
: 1767300693:0;sudo pacman -S libva-nvidia-driver
|
||||
: 1767300872:0;reboot now
|
||||
: 1767300875:0;sudo reboot now
|
||||
: 1767519952:0;touch copy.sh
|
||||
: 1767519958:0;neovim copy.sh
|
||||
: 1767533698:0;chmod +x copy.sh
|
||||
: 1767533707:0;./copy
|
||||
: 1767534240:0;nvim copy.sh
|
||||
: 1767534291:0;git commit -m "maj"
|
||||
: 1767548366:0;git commit -m "minor changes on nvim"
|
||||
: 1767548580:0;nvim autocmd.lua
|
||||
: 1767548601:0;nvim lazy
|
||||
: 1767548622:0;nvim remap.lua
|
||||
: 1767548642:0;nvim settings.lua
|
||||
: 1767548801:0;nvi
|
||||
: 1767548823:0;touch oil.lua
|
||||
: 1767548869:0;nvim init.lua
|
||||
: 1767548886:0;cd lazy
|
||||
: 1767548889:0;nvim oil.lua
|
||||
: 1767551128:0;cd nvim
|
||||
: 1767551135:0;cd lua
|
||||
: 1767559026:0;cd ..
|
||||
: 1767559029:0;cd neoconf
|
||||
: 1767559089:0;nvim lazy_init.lua
|
||||
: 1767559116:0;git clone https://github.com/neovim/nvim-lspconfig ~/.config/nvim/pack/nvim/start/nvim-lspconfig
|
||||
: 1767559274:0;nvim dotfiles
|
||||
: 1767608914:0;sudo pacman -S deno
|
||||
: 1767627681:0;sudo pacman -S utftex
|
||||
: 1767627689:0;sudo pacman -S latex2text
|
||||
: 1767627756:0;sudo pacman -S libtexprintf
|
||||
: 1767627764:0;sudo pacman -S pylatexenc
|
||||
: 1767627803:0;yay -S libtexprintf
|
||||
: 1767627907:0;yay tree-sitter-cli
|
||||
: 1767627913:0;yay -S tree-sitter-cli
|
||||
: 1767628080:0;sudo pacman -S python3
|
||||
: 1767628938:0;biber --version
|
||||
: 1767628959:0;yay -S biber-git
|
||||
: 1767628963:0;yay -S biber
|
||||
: 1767629040:0;pacman -S biber
|
||||
: 1767629051:0;pacman --debug
|
||||
: 1767629056:0;pacman -Syyyu
|
||||
: 1767629063:0;sudo pacman -Syyyu
|
||||
: 1767629301:0;sudo pacman -S biber
|
||||
: 1767629908:0;sudo pacman -S ImageMagick
|
||||
: 1767629917:0;sudo pacman -S imagemagick
|
||||
: 1767630214:0;sudo pacman -S luarocks
|
||||
: 1767630277:0;npm install -g neovim
|
||||
: 1767632773:0;git commit -m "major changes on neovim"
|
||||
: 1767718848:0;sudo pacman -S twrp
|
||||
: 1767719052:0;sudo pacman -S heimdall
|
||||
: 1767719422:0;heimdall detect
|
||||
: 1767719715:0;heimdall flash --RECOVERY twrp-3.7.0_9-0-j3lte.img
|
||||
: 1767720091:0;yay -S pmbootstrap
|
||||
: 1767720126:0;pmbootstrap init
|
||||
: 1767726470:0;ypmbootstrap zap
|
||||
: 1767726474:0;pmbootstrap zap
|
||||
: 1767726619:0;pmbootstrap export
|
||||
: 1767726627:0;cd ~/.local/var/pmbootstrap/export/
|
||||
: 1767726643:0;cd .local/var/pmbootstrap/
|
||||
: 1767726648:0;ls -la
|
||||
: 1767726701:0;sudo pmbootstrap export
|
||||
: 1767726768:0;pmbootstrap flasher flash_kernel
|
||||
: 1767726806:0;pmbootstrap install
|
||||
: 1767727085:0;pmbootstrap shutdown\
|
||||
pmbootstrap zap\
|
||||
|
||||
: 1767727092:0;pmbootstrap export\
|
||||
|
||||
: 1767789598:0;sudo pacman -S pandoc
|
||||
: 1767789676:0;pandoc ~/Downloads/trame_rapport\ d\ eÌ<65>change_GM_2025-2026.doc -t markdown -p ~/Workspace/Temp/rapport_fin_echange.md
|
||||
: 1767789727:0;sudo pacman -S libreoffice
|
||||
: 1767789767:0;libreoffice --headless --convert-to docs ~/Downloads/trame_rapport\ d\ eÌ<65>change_GM_2025-2026.doc
|
||||
: 1767789792:0;libreoffice --headless --convert-to docs trame_rapport\ d\ eÌ<65>change_GM_2025-2026.doc
|
||||
: 1767789809:0;mv trame_rapport\ d\ eÌ<65>change_GM_2025-2026.doc rapport_fin_echange.doc
|
||||
: 1767789824:0;libreoffice --headless --convert-to docs rapport_fin_echange.doc
|
||||
: 1767789849:0;libreoffice --headless --convert-to docx rapport_fin_echange.doc
|
||||
: 1767789862:0;pandoc rapport_fin_echange.docx
|
||||
: 1767789873:0;pandoc rapport_fin_echange.docx -o document.md
|
||||
: 1767789894:0;mv document.md ~/Workspace/Temp
|
||||
: 1767789909:0;mkdir temp
|
||||
: 1767789957:0;mv Temp temp/FOUCAULT_ANTOINE_LTU_SE_5GM_S1.md
|
||||
: 1767789965:0;nvim FOUCAULT_ANTOINE_LTU_SE_5GM_S1.md
|
||||
: 1767789995:0;cd Downloads
|
||||
: 1767790012:0;pandoc rapport_fin_echange.docx -t markdown -o output.md
|
||||
: 1767790015:0;nvim output.md
|
||||
: 1767790032:0;rm rapport_fin_echange.doc rapport_fin_echange.docx output.md
|
||||
: 1767790040:0;sudo rm rapport_fin_echange.doc rapport_fin_echange.doc output.md
|
||||
: 1767790051:0;rm rapport_fin_echange.docx
|
||||
: 1767790058:0;sudo rm rapport_fin_echange.docx
|
||||
: 1767796016:0;zathura FOUCAULT_ANTOINE_LTU_SE_5GM_S1.md
|
||||
: 1767796228:0;pandoc FOUCAULT_ANTOINE_LTU_SE_5GM_S1.md -t pdf -o FOUCAULT_ANTOINE_LTU_SE_5GM_S1.pdf
|
||||
: 1767796232:0;zathura FOUCAULT_ANTOINE_LTU_SE_5GM_S1.pdf
|
||||
: 1767884384:0;pandoc 2.\ Consignes-redaction_rapport.2026.docx -o consignes.md
|
||||
: 1767884392:0;nvim consignes.md
|
||||
: 1767888580:0;sudo pacman -S arial
|
||||
: 1767888618:0;sudo pacman -S ttf-ms-win11-auto
|
||||
: 1767888629:0;yay -S ttf-ms-win11-auto
|
||||
: 1768049849:0;hyprpaper -man
|
||||
: 1768049855:0;man hyprpaper
|
||||
: 1768062870:0;g++ --v
|
||||
: 1768062874:0;g++ -version
|
||||
: 1768062877:0;g++ --version
|
||||
: 1768062911:0;mv JuliaTraining/ c++/
|
||||
: 1768062914:0;cd c++
|
||||
: 1768062959:0;kitty
|
||||
: 1768062966:0;cd kitty
|
||||
: 1768063691:0;nvim finite_difference.cpp
|
||||
: 1768064182:0;sudo pacman -S egl-wayland
|
||||
: 1768064207:0;cd /etc/modprobe.d
|
||||
: 1768064215:0;touch nvidia.conf
|
||||
: 1768064220:0;sudo touch nvidia.conf
|
||||
: 1768064227:0;sudo nvim nvidia.conf
|
||||
: 1768064249:0;ls -a
|
||||
: 1768064258:0;cd
|
||||
: 1768064274:0;cd /etc/mkinitcpio.conf
|
||||
: 1768064285:0;sudo nvim /etc/mkinitcpio.conf
|
||||
: 1768064312:0;sudo mkinitcpio -P
|
||||
: 1768064360:0;sudo pacman -Rns optimus-manager
|
||||
: 1768064369:0;yay -Rns optimus-manager
|
||||
: 1768064482:0;reboot
|
||||
: 1768065234:0;yay -S asusctl supergfxctl
|
||||
: 1768066668:0;asusctl -h
|
||||
: 1768066674:0;asusctl --help
|
||||
: 1768066692:0;asusctl -s
|
||||
: 1768066719:0;asus -c 60
|
||||
: 1768066724:0;asusctl -c 60
|
||||
: 1768066743:0;asusctl aura -p
|
||||
: 1768066757:0;asusctl aura -h
|
||||
: 1768066764:0;asusctl aura -s
|
||||
: 1768066771:0;asusctl aura -n
|
||||
: 1768066832:0;systemctl enable supergfxd
|
||||
: 1768066848:0;systemctl start supergfxd
|
||||
: 1768066854:0;supergfxctl -m AsusMuxDgpu
|
||||
: 1768066869:0;sudo pacman -S rog-control-center
|
||||
: 1768066877:0;yay pacman -S rog-control-center
|
||||
: 1768069990:0;nvim .config
|
||||
: 1768076412:0;sudo pacman -S clang++
|
||||
: 1768076425:0;sudo pacman -S clang
|
||||
: 1768076831:0;clang++ --debug Workspace/c++/finite_difference.cpp -o main
|
||||
: 1768076857:0;
|
||||
: 1768076860:0;
|
||||
: 1768148923:0;shutdown now
|
||||
: 1768164258:0;hyprland
|
||||
: 1768165997:0;sudo pacman -S g++
|
||||
: 1768166003:0;sudo pacman -S gpp
|
||||
: 1768166007:0;yay -S g++
|
||||
: 1768166149:0;git --version
|
||||
: 1768166200:0;rm -rf ~/.local/share/nvim/lazy
|
||||
: 1768166332:0;sudo pacman -S gcc
|
||||
: 1768166351:0;yay -Syu
|
||||
: 1768166915:0;nvil
|
||||
: 1768171320:0;./copy.sh
|
||||
: 1768171362:0;git commit -m "Ajout des tutoriels et maj lourde de neovim"
|
||||
: 1768171406:0;cd
|
||||
: 1768171418:0;nvim README.md
|
||||
: 1768171935:0;cd dotfiles
|
||||
: 1768171944:0;sudo rm install.sh
|
||||
: 1768172375:0;git add -all
|
||||
: 1768172380:0;git add --all
|
||||
: 1768172392:0;git commit -m "changement du readme"
|
||||
: 1768172394:0;git push
|
||||
: 1768206521:0;iwt
|
||||
: 1768206557:0;NetworkManager
|
||||
: 1768206563:0;nm-gui
|
||||
: 1768206581:0;nmcli
|
||||
: 1768206600:0;network-manager-applet
|
||||
: 1768206608:0;nm-applet
|
||||
: 1768227060:0;python3 -m pip list | grep numpy
|
||||
: 1768227103:0;sudo pacman -Syu python-numpy python-pylot python-scipy
|
||||
: 1768227154:0;sudo pacman -S python-numpy python-pylot python-scipy
|
||||
: 1768227163:0;sudo pacman -S python-numpy python-matplotlib python-scipy
|
||||
: 1768227458:0;cd Workspace/Modele_moteur
|
||||
: 1768227465:0;python3 LTU_BALDOS_II.py
|
||||
: 1768228042:0;python "/home/afoucaultc/Workspace/Modele_moteur/LTU_BALDOS_II.py"
|
||||
: 1768228202:0;:q
|
||||
: 1768228363:0;.config
|
||||
: 1768422308:0;sta
|
||||
: 1768498389:0;cd Workspace
|
||||
: 1768498392:0;cd temp
|
||||
: 1768498398:0;touch airbus.md
|
||||
: 1768498401:0;nvim airbus.md
|
||||
: 1768500813:0;sudo pacman -Syu
|
||||
: 1768580442:0;cd Workspace/temp/
|
||||
: 1768580460:0;pandoc reponse_a_iel.md contre_communique.pdf
|
||||
: 1768580527:0;ls
|
||||
: 1768586835:0;zathura contre_communique.pdf
|
||||
: 1768602423:0;neofetch
|
||||
: 1768654408:0;nvim reponse_a_iel.md
|
||||
: 1768654851:0;cd Workspace/temp
|
||||
: 1768654856:0;pandoc reponse_a_iel.md -o contre_communique.pdf
|
||||
: 1768670209:0;start-hyprland
|
||||
: 1768677782:0;sudo pacman -S newpipe
|
||||
: 1768677789:0;yay -S newpipe
|
||||
: 1768677932:0;sudo pacman -S SMTube
|
||||
: 1768677935:0;yay -S SMTube
|
||||
: 1768678939:0;nvim
|
||||
: 1768678945:0;cd .config
|
||||
: 1768678946:0;ls
|
||||
: 1768679063:0;du -sh /var/cache/pacman/pkg/
|
||||
: 1768679073:0;sudo paccache -r
|
||||
: 1768679808:0;sudo ls /var/cache/pacman/pkg/ | wc -l
|
||||
: 1768679832:0;sudo paccache -ruk0
|
||||
: 1768679838:0;sudo pacman -Sc
|
||||
: 1768680021:0;sudo pacman -S floorp
|
||||
: 1768680028:0;yay -S floorp
|
||||
: 1768744172:0;start-hyprland
|
||||
: 1768857665:0;sudo pacman -S xdg-desktop-portal-hyprland
|
||||
: 1768857706:0;start-hyprland
|
||||
: 1768858028:0;sudo pacman -Rns nftables
|
||||
: 1768858042:0;sudo pacman -Rns iptables
|
||||
: 1768858081:0;sudo ufw allow 27015:27016/udp
|
||||
: 1768858099:0;sudo nft list ruleset
|
||||
: 1768858106:0;sudo nft insert rule inet filter input position 1 ip protocol icmp icmp type echo-request accept\
|
||||
sudo nft insert rule inet filter input position 2 ip protocol icmp icmp type echo-reply accept\
|
||||
sudo nft insert rule inet filter output position 1 ip protocol icmp icmp type echo-request accept\
|
||||
sudo nft insert rule inet filter output position 2 ip protocol icmp icmp type echo-reply accept
|
||||
: 1768858111:0;sudo nft insert rule inet filter input position 3 udp dport 27015-27016 ct state new,established,related accept\
|
||||
sudo nft insert rule inet filter output position 3 udp sport 27015-27016 ct state new,established,related accept
|
||||
: 1768858115:0;sudo nft list chain inet filter input
|
||||
: 1768858707:0;nc -u -z 8.8.8.8 27015
|
||||
: 1768858759:0;sudo pacman -S proton-ge
|
||||
: 1768903104:0;start-hyprland
|
||||
: 1769100798:0;sudo pacman -S kde
|
||||
: 1769100828:0;sudo pacman -S plasma-meta
|
||||
: 1769100867:0;sudo pacman -Rns plasma-meta
|
||||
: 1769101737:0;sudo pacman -S virtualbox
|
||||
: 1769101790:0;sudo pacman -Rns virtualbox
|
||||
: 1769101819:0;sudo pacman -S virtualbox
|
||||
: 1769102044:0;sudo pacman -Syu
|
||||
: 1769102392:0;lsblk -f
|
||||
: 1769102413:0;ysudo dmesg | tail -n 50
|
||||
: 1769102414:0;sudo dmesg | tail -n 50
|
||||
: 1769102492:0;sudo mkdir -p /mnt/wd
|
||||
: 1769102501:0;sudo mount -t ntfs3 /dev/sdb1 /mnt/wd
|
||||
: 1769102528:0;sudo pacman -S ntfs-3g
|
||||
: 1769102533:0;sudo mount -t ntfs3 /dev/sdb1 /mnt/wd
|
||||
: 1769102546:0;sudo mount /dev/sdb1 /mnt/wd
|
||||
: 1769103263:0;lsblk
|
||||
: 1769103536:0;lsmod | grep vbox
|
||||
: 1769103545:0;VBoxManage startvm "Arch-test" --log 0
|
||||
: 1769103559:0;pacman -Qs virtualbox
|
||||
: 1769103580:0;sudo pacman -Syu linux-headers virtualbox-host-dkms
|
||||
: 1769103722:0;sudo systemctl restart vboxdrv
|
||||
: 1769103750:0;sudo modprobe vboxdrv
|
||||
: 1769103795:0;virtualbox-host-modules-arch
|
||||
: 1769103799:0;sudo pacman -S virtualbox-host-modules-arch
|
||||
: 1769103872:0;modprobe vboxdrv
|
||||
: 1769103902:0;VBoxManage modifyvm "Virtual machine name" --firmware efi
|
||||
: 1769103925:0;sudo pacman -S virtualbox-guest-utils
|
||||
: 1769103934:0;modprobe -a vboxguest vboxsf vboxvideo
|
||||
: 1769104072:0;start-hyprland
|
||||
: 1769104367:0;nvim
|
||||
: 1769676071:0;start-hyprland
|
||||
: 1769678082:0;hyprctl clients
|
||||
: 1769678156:0;.config
|
||||
: 1769678157:0;nvim
|
||||
: 1769678329:0;:q
|
||||
: 1769690010:0;sudo pacman -S gnumeric
|
||||
: 1769705930:0;sudo pacman -S jre
|
||||
: 1769705980:0;sudo pacman -Rns libreoffice
|
||||
: 1769706004:0;sudo pacman -S onlyoffice
|
||||
: 1769706015:0;sudo pacman -Rns libreoffice-still
|
||||
: 1769706018:0;sudo pacman -Rns libreoffice-fresh
|
||||
: 1769706031:0;yay -S onlyoffice
|
||||
: 1769706543:0;.config
|
||||
: 1769706545:0;nvim
|
||||
: 1769707324:0;desktopeditors
|
||||
: 1769707337:0;sudo pacman -S openoffice
|
||||
: 1769707396:0;sudo pacman -S libreoffice-still
|
||||
: 1769768165:0;start-hyprland
|
||||
: 1769768505:0;sudo pacman -S v4l-utils
|
||||
: 1769768521:0;v4l2-ctl --list-devices
|
||||
: 1769769947:0;start-hyprland
|
||||
: 1769769970:0;sudo pacman -Syu
|
||||
: 1769778660:0;start-hyprland
|
||||
: 1769792123:0;cd dotfiles
|
||||
: 1769792124:0;ls
|
||||
: 1769792136:0;nvim copy.sh
|
||||
: 1769792150:0;./copy.sh
|
||||
0
config/zsh/.zlogin
Normal file
0
config/zsh/.zlogin
Normal file
0
config/zsh/.zlogout
Normal file
0
config/zsh/.zlogout
Normal file
0
config/zsh/.zprofile
Normal file
0
config/zsh/.zprofile
Normal file
20
config/zsh/.zshrc
Normal file
20
config/zsh/.zshrc
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
source /$ZDOTDIR/aliases
|
||||
source /$ZDOTDIR/options
|
||||
|
||||
plugins=(git zsh-autosuggestions zsh-syntax-highlighting you-should-use zsh-bat)
|
||||
|
||||
zmodload zsh/complist
|
||||
bindkey -M menuselect 'h' vi-backward-char
|
||||
bindkey -M menuselect 'k' vi-up-line-or-history
|
||||
bindkey -M menuselect 'l' vi-forward-char
|
||||
bindkey -M menuselect 'j' vi-down-line-or-history
|
||||
|
||||
fpath=(/$ZDOTDIR $fpath)
|
||||
autoload -Uz prompt; prompt
|
||||
|
||||
export MANPATH=$MANPATH:/usr/local/texlive/2025/texmf-dist/doc/man
|
||||
export INFOPATH=$INFOPATH:/usr/local/texlive/2025/texmf-dist/doc/info
|
||||
export PATH=$PATH:/usr/local/texlive/2025/bin/x86_64-linux
|
||||
export LD_PRELOAD=$MKLROOT/lib/intel64/libmkl_rt.so
|
||||
export OPENBLAS_NUM_THREADS=12
|
||||
export OMP_NUM_THREADS=12
|
||||
0
config/zsh/README.md
Normal file
0
config/zsh/README.md
Normal file
74
config/zsh/aliases
Normal file
74
config/zsh/aliases
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
# git
|
||||
alias gs='git status'
|
||||
alias gss='git status -s'
|
||||
alias ga='git add'
|
||||
alias gp='git push'
|
||||
alias gpraise='git blame'
|
||||
alias gpo='git push origin'
|
||||
alias gpof='git push origin --force-with-lease'
|
||||
alias gpofn='git push origin --force-with-lease --no-verify'
|
||||
alias gpt='git push --tag'
|
||||
alias gtd='git tag --delete'
|
||||
alias gtdr='git tag --delete origin'
|
||||
alias grb='git branch -r'
|
||||
alias gplo='git pull origin'
|
||||
alias gb='git branch '
|
||||
alias gc='git commit'
|
||||
alias gca='git commit --amend'
|
||||
alias gd='git diff'
|
||||
alias gco='git checkout '
|
||||
alias gl='git log --oneline'
|
||||
alias gr='git remote'
|
||||
alias grs='git remote show'
|
||||
alias glol='git log --graph --abbrev-commit --oneline --decorate'
|
||||
alias gclean="git branch --merged | grep -v '\\*\\|master\\|develop' | xargs -n 1 git branch -d"
|
||||
alias gblog="git for-each-ref --sort=committerdate refs/heads/ --format='%(HEAD) %(color:red)%(refname:short)%(color:reset) - %(color:yellow)%(objectname:short)%(color:reset) - %(contents:subject) - %(authorname) (%(color:blue)%(committerdate:relative)%(color:reset))'"
|
||||
alias gsub="git submodule update --remote"
|
||||
alias gj="git-jump"
|
||||
|
||||
# dirs
|
||||
alias d='dirs -v'
|
||||
for index ({1..9}) alias "$index"="cd +${index} > /dev/null"; unset index # directory stack
|
||||
|
||||
# ls
|
||||
alias ls='ls --color=auto'
|
||||
alias l='ls -l'
|
||||
alias ll='ls -lahF'
|
||||
alias lls='ls -lahFtr'
|
||||
alias la='ls -A'
|
||||
alias lc='ls -CF'
|
||||
|
||||
# cp
|
||||
alias cp='cp -iv'
|
||||
alias mv='mv -iv'
|
||||
alias rm='rm -iv'
|
||||
alias la='ls -alh'
|
||||
|
||||
# grep
|
||||
alias grep="grep -P -i --color=auto"
|
||||
|
||||
# pacman
|
||||
alias paci='sudo pacman -S' # install
|
||||
alias pachi='sudo pacman -Ql' # Pacman Has Installed - what files where installed in a package
|
||||
alias pacs='sudo pacman -Ss' # search
|
||||
alias pacu='sudo pacman -Syu' # update
|
||||
alias pacr='sudo pacman -R' # remove package but not dependencies
|
||||
alias pacrr='sudo pacman -Rs' # remove package with unused dependencies by other softwares
|
||||
alias pacrc='sudo pacman -Sc' # remove pacman's cache
|
||||
alias pacro='pacman -Rns $(pacman -Qtdq)'
|
||||
alias pacrl='rm /var/lib/pacman/db.lck' # pacman remove locks
|
||||
alias pacls="sudo pacman -Qe"
|
||||
alias pacc='sudo pacman -Sc'
|
||||
alias paccc='sudo pacman -Scc' # empty the whole cache
|
||||
|
||||
# yay
|
||||
alias yayi='yay -S' # install
|
||||
alias yayhi='yay -Ql' # Yay Has Installed - what files where installed in a package
|
||||
alias yays='yay -Ss' # search
|
||||
alias yayu='yay -Syu' # update
|
||||
alias yayr='yay -R' # remove package but not dependencies
|
||||
alias yayrr='yay -Rs' # remove package with unused dependencies by other softwares
|
||||
alias yayrc='yay -Sc' # remove yay's cache
|
||||
alias yayls="yay -Qe"
|
||||
|
||||
|
||||
35
config/zsh/options
Normal file
35
config/zsh/options
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
# +------------+
|
||||
# | NAVIGATION |
|
||||
# +------------+
|
||||
|
||||
setopt AUTO_CD # Go to folder path without using cd.
|
||||
|
||||
setopt AUTO_PUSHD # Push the old directory onto the stack on cd.
|
||||
setopt PUSHD_IGNORE_DUPS # Do not store duplicates in the stack.
|
||||
setopt PUSHD_SILENT # Do not print the directory stack after pushd or popd.
|
||||
|
||||
setopt CORRECT # Spelling correction
|
||||
setopt CDABLE_VARS # Change directory to a path stored in a variable.
|
||||
setopt EXTENDED_GLOB # Use extended globbing syntax.
|
||||
|
||||
setopt NO_CASE_GLOB
|
||||
# +---------+
|
||||
# | HISTORY |
|
||||
# +---------+
|
||||
|
||||
setopt EXTENDED_HISTORY # Write the history file in the ':start:elapsed;command' format.
|
||||
setopt SHARE_HISTORY # Share history between all sessions.
|
||||
setopt HIST_EXPIRE_DUPS_FIRST # Expire a duplicate event first when trimming history.
|
||||
setopt HIST_IGNORE_DUPS # Do not record an event that was just recorded again.
|
||||
setopt HIST_IGNORE_ALL_DUPS # Delete an old recorded event if a new event is a duplicate.
|
||||
setopt HIST_FIND_NO_DUPS # Do not display a previously found event.
|
||||
setopt HIST_IGNORE_SPACE # Do not record an event starting with a space.
|
||||
setopt HIST_SAVE_NO_DUPS # Do not write a duplicate event to the history file.
|
||||
setopt HIST_VERIFY # Do not execute immediately upon history expansion.
|
||||
|
||||
# +---------+
|
||||
# | STACKS |
|
||||
# +---------+
|
||||
setopt AUTO_PUSHD # Push the current directory visited on the stack.
|
||||
setopt PUSHD_IGNORE_DUPS # Do not store duplicates in the stack.
|
||||
setopt PUSHD_SILENT # Do not print the directory stack after pushd or popd.
|
||||
445
config/zsh/plugins/git/git.plugin.zsh
Normal file
445
config/zsh/plugins/git/git.plugin.zsh
Normal file
|
|
@ -0,0 +1,445 @@
|
|||
# Git version checking
|
||||
autoload -Uz is-at-least
|
||||
git_version="${${(As: :)$(git version 2>/dev/null)}[3]}"
|
||||
|
||||
#
|
||||
# Functions Current
|
||||
# (sorted alphabetically by function name)
|
||||
# (order should follow README)
|
||||
#
|
||||
|
||||
# The name of the current branch
|
||||
# Back-compatibility wrapper for when this function was defined here in
|
||||
# the plugin, before being pulled in to core lib/git.zsh as git_current_branch()
|
||||
# to fix the core -> git plugin dependency.
|
||||
function current_branch() {
|
||||
git_current_branch
|
||||
}
|
||||
|
||||
# Check for develop and similarly named branches
|
||||
function git_develop_branch() {
|
||||
command git rev-parse --git-dir &>/dev/null || return
|
||||
local branch
|
||||
for branch in dev devel develop development; do
|
||||
if command git show-ref -q --verify refs/heads/$branch; then
|
||||
echo $branch
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
|
||||
echo develop
|
||||
return 1
|
||||
}
|
||||
|
||||
# Get the default branch name from common branch names or fallback to remote HEAD
|
||||
function git_main_branch() {
|
||||
command git rev-parse --git-dir &>/dev/null || return
|
||||
|
||||
local remote ref
|
||||
|
||||
for ref in refs/{heads,remotes/{origin,upstream}}/{main,trunk,mainline,default,stable,master}; do
|
||||
if command git show-ref -q --verify $ref; then
|
||||
echo ${ref:t}
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
|
||||
# Fallback: try to get the default branch from remote HEAD symbolic refs
|
||||
for remote in origin upstream; do
|
||||
ref=$(command git rev-parse --abbrev-ref $remote/HEAD 2>/dev/null)
|
||||
if [[ $ref == $remote/* ]]; then
|
||||
echo ${ref#"$remote/"}; return 0
|
||||
fi
|
||||
done
|
||||
|
||||
# If no main branch was found, fall back to master but return error
|
||||
echo master
|
||||
return 1
|
||||
}
|
||||
|
||||
function grename() {
|
||||
if [[ -z "$1" || -z "$2" ]]; then
|
||||
echo "Usage: $0 old_branch new_branch"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Rename branch locally
|
||||
git branch -m "$1" "$2"
|
||||
# Rename branch in origin remote
|
||||
if git push origin :"$1"; then
|
||||
git push --set-upstream origin "$2"
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
# Functions Work in Progress (WIP)
|
||||
# (sorted alphabetically by function name)
|
||||
# (order should follow README)
|
||||
#
|
||||
|
||||
# Similar to `gunwip` but recursive "Unwips" all recent `--wip--` commits not just the last one
|
||||
function gunwipall() {
|
||||
local _commit=$(git log --grep='--wip--' --invert-grep --max-count=1 --format=format:%H)
|
||||
|
||||
# Check if a commit without "--wip--" was found and it's not the same as HEAD
|
||||
if [[ "$_commit" != "$(git rev-parse HEAD)" ]]; then
|
||||
git reset $_commit || return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Warn if the current branch is a WIP
|
||||
function work_in_progress() {
|
||||
command git -c log.showSignature=false log -n 1 2>/dev/null | grep -q -- "--wip--" && echo "WIP!!"
|
||||
}
|
||||
|
||||
#
|
||||
# Aliases
|
||||
# (sorted alphabetically by command)
|
||||
# (order should follow README)
|
||||
# (in some cases force the alias order to match README, like for example gke and gk)
|
||||
#
|
||||
|
||||
alias grt='cd "$(git rev-parse --show-toplevel || echo .)"'
|
||||
|
||||
function ggpnp() {
|
||||
if [[ "$#" == 0 ]]; then
|
||||
ggl && ggp
|
||||
else
|
||||
ggl "${*}" && ggp "${*}"
|
||||
fi
|
||||
}
|
||||
compdef _git ggpnp=git-checkout
|
||||
|
||||
alias ggpur='ggu'
|
||||
alias g='git'
|
||||
alias ga='git add'
|
||||
alias gaa='git add --all'
|
||||
alias gapa='git add --patch'
|
||||
alias gau='git add --update'
|
||||
alias gav='git add --verbose'
|
||||
alias gwip='git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign --message "--wip-- [skip ci]"'
|
||||
alias gam='git am'
|
||||
alias gama='git am --abort'
|
||||
alias gamc='git am --continue'
|
||||
alias gamscp='git am --show-current-patch'
|
||||
alias gams='git am --skip'
|
||||
alias gap='git apply'
|
||||
alias gapt='git apply --3way'
|
||||
alias gbs='git bisect'
|
||||
alias gbsb='git bisect bad'
|
||||
alias gbsg='git bisect good'
|
||||
alias gbsn='git bisect new'
|
||||
alias gbso='git bisect old'
|
||||
alias gbsr='git bisect reset'
|
||||
alias gbss='git bisect start'
|
||||
alias gbl='git blame -w'
|
||||
alias gb='git branch'
|
||||
alias gba='git branch --all'
|
||||
alias gbd='git branch --delete'
|
||||
alias gbD='git branch --delete --force'
|
||||
|
||||
function gbda() {
|
||||
git branch --no-color --merged | command grep -vE "^([+*]|\s*($(git_main_branch)|$(git_develop_branch))\s*$)" | command xargs git branch --delete 2>/dev/null
|
||||
}
|
||||
|
||||
# Copied and modified from James Roeder (jmaroeder) under MIT License
|
||||
# https://github.com/jmaroeder/plugin-git/blob/216723ef4f9e8dde399661c39c80bdf73f4076c4/functions/gbda.fish
|
||||
function gbds() {
|
||||
local default_branch=$(git_main_branch)
|
||||
(( ! $? )) || default_branch=$(git_develop_branch)
|
||||
|
||||
git for-each-ref refs/heads/ "--format=%(refname:short)" | \
|
||||
while read branch; do
|
||||
local merge_base=$(git merge-base $default_branch $branch)
|
||||
if [[ $(git cherry $default_branch $(git commit-tree $(git rev-parse $branch\^{tree}) -p $merge_base -m _)) = -* ]]; then
|
||||
git branch -D $branch
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
alias gbgd='LANG=C git branch --no-color -vv | grep ": gone\]" | cut -c 3- | awk '"'"'{print $1}'"'"' | xargs git branch -d'
|
||||
alias gbgD='LANG=C git branch --no-color -vv | grep ": gone\]" | cut -c 3- | awk '"'"'{print $1}'"'"' | xargs git branch -D'
|
||||
alias gbm='git branch --move'
|
||||
alias gbnm='git branch --no-merged'
|
||||
alias gbr='git branch --remote'
|
||||
alias ggsup='git branch --set-upstream-to=origin/$(git_current_branch)'
|
||||
alias gbg='LANG=C git branch -vv | grep ": gone\]"'
|
||||
alias gco='git checkout'
|
||||
alias gcor='git checkout --recurse-submodules'
|
||||
alias gcb='git checkout -b'
|
||||
alias gcB='git checkout -B'
|
||||
alias gcd='git checkout $(git_develop_branch)'
|
||||
alias gcm='git checkout $(git_main_branch)'
|
||||
alias gcp='git cherry-pick'
|
||||
alias gcpa='git cherry-pick --abort'
|
||||
alias gcpc='git cherry-pick --continue'
|
||||
alias gclean='git clean --interactive -d'
|
||||
alias gcl='git clone --recurse-submodules'
|
||||
alias gclf='git clone --recursive --shallow-submodules --filter=blob:none --also-filter-submodules'
|
||||
|
||||
function gccd() {
|
||||
setopt localoptions extendedglob
|
||||
|
||||
# get repo URI from args based on valid formats: https://git-scm.com/docs/git-clone#URLS
|
||||
local repo="${${@[(r)(ssh://*|git://*|ftp(s)#://*|http(s)#://*|*@*)(.git/#)#]}:-$_}"
|
||||
|
||||
# clone repository and exit if it fails
|
||||
command git clone --recurse-submodules "$@" || return
|
||||
|
||||
# if last arg passed was a directory, that's where the repo was cloned
|
||||
# otherwise parse the repo URI and use the last part as the directory
|
||||
[[ -d "$_" ]] && cd "$_" || cd "${${repo:t}%.git/#}"
|
||||
}
|
||||
compdef _git gccd=git-clone
|
||||
|
||||
alias gcam='git commit --all --message'
|
||||
alias gcas='git commit --all --signoff'
|
||||
alias gcasm='git commit --all --signoff --message'
|
||||
alias gcs='git commit --gpg-sign'
|
||||
alias gcss='git commit --gpg-sign --signoff'
|
||||
alias gcssm='git commit --gpg-sign --signoff --message'
|
||||
alias gcmsg='git commit --message'
|
||||
alias gcsm='git commit --signoff --message'
|
||||
alias gc='git commit --verbose'
|
||||
alias gca='git commit --verbose --all'
|
||||
alias gca!='git commit --verbose --all --amend'
|
||||
alias gcan!='git commit --verbose --all --no-edit --amend'
|
||||
alias gcans!='git commit --verbose --all --signoff --no-edit --amend'
|
||||
alias gcann!='git commit --verbose --all --date=now --no-edit --amend'
|
||||
alias gc!='git commit --verbose --amend'
|
||||
alias gcn='git commit --verbose --no-edit'
|
||||
alias gcn!='git commit --verbose --no-edit --amend'
|
||||
alias gcf='git config --list'
|
||||
alias gcfu='git commit --fixup'
|
||||
alias gdct='git describe --tags $(git rev-list --tags --max-count=1)'
|
||||
alias gd='git diff'
|
||||
alias gdca='git diff --cached'
|
||||
alias gdcw='git diff --cached --word-diff'
|
||||
alias gds='git diff --staged'
|
||||
alias gdw='git diff --word-diff'
|
||||
|
||||
function gdv() { git diff -w "$@" | view - }
|
||||
compdef _git gdv=git-diff
|
||||
|
||||
alias gdup='git diff @{upstream}'
|
||||
|
||||
function gdnolock() {
|
||||
git diff "$@" ":(exclude)package-lock.json" ":(exclude)*.lock"
|
||||
}
|
||||
compdef _git gdnolock=git-diff
|
||||
|
||||
alias gdt='git diff-tree --no-commit-id --name-only -r'
|
||||
alias gf='git fetch'
|
||||
# --jobs=<n> was added in git 2.8
|
||||
is-at-least 2.8 "$git_version" \
|
||||
&& alias gfa='git fetch --all --tags --prune --jobs=10' \
|
||||
|| alias gfa='git fetch --all --tags --prune'
|
||||
alias gfo='git fetch origin'
|
||||
alias gg='git gui citool'
|
||||
alias gga='git gui citool --amend'
|
||||
alias ghh='git help'
|
||||
alias glgg='git log --graph'
|
||||
alias glgga='git log --graph --decorate --all'
|
||||
alias glgm='git log --graph --max-count=10'
|
||||
alias glods='git log --graph --pretty="%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset" --date=short'
|
||||
alias glod='git log --graph --pretty="%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset"'
|
||||
alias glola='git log --graph --pretty="%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset" --all'
|
||||
alias glols='git log --graph --pretty="%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset" --stat'
|
||||
alias glol='git log --graph --pretty="%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset"'
|
||||
alias glo='git log --oneline --decorate'
|
||||
alias glog='git log --oneline --decorate --graph'
|
||||
alias gloga='git log --oneline --decorate --graph --all'
|
||||
|
||||
# Pretty log messages
|
||||
function _git_log_prettily(){
|
||||
if ! [ -z $1 ]; then
|
||||
git log --pretty=$1
|
||||
fi
|
||||
}
|
||||
compdef _git _git_log_prettily=git-log
|
||||
|
||||
alias glp='_git_log_prettily'
|
||||
alias glg='git log --stat'
|
||||
alias glgp='git log --stat --patch'
|
||||
alias gignored='git ls-files -v | grep "^[[:lower:]]"'
|
||||
alias gfg='git ls-files | grep'
|
||||
alias gm='git merge'
|
||||
alias gma='git merge --abort'
|
||||
alias gmc='git merge --continue'
|
||||
alias gms="git merge --squash"
|
||||
alias gmff="git merge --ff-only"
|
||||
alias gmom='git merge origin/$(git_main_branch)'
|
||||
alias gmum='git merge upstream/$(git_main_branch)'
|
||||
alias gmtl='git mergetool --no-prompt'
|
||||
alias gmtlvim='git mergetool --no-prompt --tool=vimdiff'
|
||||
|
||||
alias gl='git pull'
|
||||
alias gpr='git pull --rebase'
|
||||
alias gprv='git pull --rebase -v'
|
||||
alias gpra='git pull --rebase --autostash'
|
||||
alias gprav='git pull --rebase --autostash -v'
|
||||
|
||||
function ggu() {
|
||||
local b
|
||||
[[ "$#" != 1 ]] && b="$(git_current_branch)"
|
||||
git pull --rebase origin "${b:-$1}"
|
||||
}
|
||||
compdef _git ggu=git-pull
|
||||
|
||||
alias gprom='git pull --rebase origin $(git_main_branch)'
|
||||
alias gpromi='git pull --rebase=interactive origin $(git_main_branch)'
|
||||
alias gprum='git pull --rebase upstream $(git_main_branch)'
|
||||
alias gprumi='git pull --rebase=interactive upstream $(git_main_branch)'
|
||||
alias ggpull='git pull origin "$(git_current_branch)"'
|
||||
|
||||
function ggl() {
|
||||
if [[ "$#" != 0 ]] && [[ "$#" != 1 ]]; then
|
||||
git pull origin "${*}"
|
||||
else
|
||||
local b
|
||||
[[ "$#" == 0 ]] && b="$(git_current_branch)"
|
||||
git pull origin "${b:-$1}"
|
||||
fi
|
||||
}
|
||||
compdef _git ggl=git-pull
|
||||
|
||||
alias gluc='git pull upstream $(git_current_branch)'
|
||||
alias glum='git pull upstream $(git_main_branch)'
|
||||
alias gp='git push'
|
||||
alias gpd='git push --dry-run'
|
||||
|
||||
function ggf() {
|
||||
local b
|
||||
[[ "$#" != 1 ]] && b="$(git_current_branch)"
|
||||
git push --force origin "${b:-$1}"
|
||||
}
|
||||
compdef _git ggf=git-push
|
||||
|
||||
alias gpf!='git push --force'
|
||||
is-at-least 2.30 "$git_version" \
|
||||
&& alias gpf='git push --force-with-lease --force-if-includes' \
|
||||
|| alias gpf='git push --force-with-lease'
|
||||
|
||||
function ggfl() {
|
||||
local b
|
||||
[[ "$#" != 1 ]] && b="$(git_current_branch)"
|
||||
git push --force-with-lease origin "${b:-$1}"
|
||||
}
|
||||
compdef _git ggfl=git-push
|
||||
|
||||
alias gpsup='git push --set-upstream origin $(git_current_branch)'
|
||||
is-at-least 2.30 "$git_version" \
|
||||
&& alias gpsupf='git push --set-upstream origin $(git_current_branch) --force-with-lease --force-if-includes' \
|
||||
|| alias gpsupf='git push --set-upstream origin $(git_current_branch) --force-with-lease'
|
||||
alias gpv='git push --verbose'
|
||||
alias gpoat='git push origin --all && git push origin --tags'
|
||||
alias gpod='git push origin --delete'
|
||||
alias ggpush='git push origin "$(git_current_branch)"'
|
||||
|
||||
function ggp() {
|
||||
if [[ "$#" != 0 ]] && [[ "$#" != 1 ]]; then
|
||||
git push origin "${*}"
|
||||
else
|
||||
local b
|
||||
[[ "$#" == 0 ]] && b="$(git_current_branch)"
|
||||
git push origin "${b:-$1}"
|
||||
fi
|
||||
}
|
||||
compdef _git ggp=git-push
|
||||
|
||||
alias gpu='git push upstream'
|
||||
alias grb='git rebase'
|
||||
alias grba='git rebase --abort'
|
||||
alias grbc='git rebase --continue'
|
||||
alias grbi='git rebase --interactive'
|
||||
alias grbo='git rebase --onto'
|
||||
alias grbs='git rebase --skip'
|
||||
alias grbd='git rebase $(git_develop_branch)'
|
||||
alias grbm='git rebase $(git_main_branch)'
|
||||
alias grbom='git rebase origin/$(git_main_branch)'
|
||||
alias grbum='git rebase upstream/$(git_main_branch)'
|
||||
alias grf='git reflog'
|
||||
alias gr='git remote'
|
||||
alias grv='git remote --verbose'
|
||||
alias gra='git remote add'
|
||||
alias grrm='git remote remove'
|
||||
alias grmv='git remote rename'
|
||||
alias grset='git remote set-url'
|
||||
alias grup='git remote update'
|
||||
alias grh='git reset'
|
||||
alias gru='git reset --'
|
||||
alias grhh='git reset --hard'
|
||||
alias grhk='git reset --keep'
|
||||
alias grhs='git reset --soft'
|
||||
alias gpristine='git reset --hard && git clean --force -dfx'
|
||||
alias gwipe='git reset --hard && git clean --force -df'
|
||||
alias groh='git reset origin/$(git_current_branch) --hard'
|
||||
alias grs='git restore'
|
||||
alias grss='git restore --source'
|
||||
alias grst='git restore --staged'
|
||||
alias gunwip='git rev-list --max-count=1 --format="%s" HEAD | grep -q "\--wip--" && git reset HEAD~1'
|
||||
alias grev='git revert'
|
||||
alias greva='git revert --abort'
|
||||
alias grevc='git revert --continue'
|
||||
alias grm='git rm'
|
||||
alias grmc='git rm --cached'
|
||||
alias gcount='git shortlog --summary --numbered'
|
||||
alias gsh='git show'
|
||||
alias gsps='git show --pretty=short --show-signature'
|
||||
alias gstall='git stash --all'
|
||||
alias gstaa='git stash apply'
|
||||
alias gstc='git stash clear'
|
||||
alias gstd='git stash drop'
|
||||
alias gstl='git stash list'
|
||||
alias gstp='git stash pop'
|
||||
# use the default stash push on git 2.13 and newer
|
||||
is-at-least 2.13 "$git_version" \
|
||||
&& alias gsta='git stash push' \
|
||||
|| alias gsta='git stash save'
|
||||
alias gsts='git stash show --patch'
|
||||
alias gst='git status'
|
||||
alias gss='git status --short'
|
||||
alias gsb='git status --short --branch'
|
||||
alias gsi='git submodule init'
|
||||
alias gsu='git submodule update'
|
||||
alias gsd='git svn dcommit'
|
||||
alias git-svn-dcommit-push='git svn dcommit && git push github $(git_main_branch):svntrunk'
|
||||
alias gsr='git svn rebase'
|
||||
alias gsw='git switch'
|
||||
alias gswc='git switch --create'
|
||||
alias gswd='git switch $(git_develop_branch)'
|
||||
alias gswm='git switch $(git_main_branch)'
|
||||
alias gta='git tag --annotate'
|
||||
alias gts='git tag --sign'
|
||||
alias gtv='git tag | sort -V'
|
||||
alias gignore='git update-index --assume-unchanged'
|
||||
alias gunignore='git update-index --no-assume-unchanged'
|
||||
alias gwch='git log --patch --abbrev-commit --pretty=medium --raw'
|
||||
alias gwt='git worktree'
|
||||
alias gwta='git worktree add'
|
||||
alias gwtls='git worktree list'
|
||||
alias gwtmv='git worktree move'
|
||||
alias gwtrm='git worktree remove'
|
||||
alias gstu='gsta --include-untracked'
|
||||
alias gtl='gtl(){ git tag --sort=-v:refname -n --list "${1}*" }; noglob gtl'
|
||||
alias gk='\gitk --all --branches &!'
|
||||
alias gke='\gitk --all $(git log --walk-reflogs --pretty=%h) &!'
|
||||
|
||||
unset git_version
|
||||
|
||||
# Logic for adding warnings on deprecated aliases
|
||||
local old_alias new_alias
|
||||
for old_alias new_alias (
|
||||
# TODO(2023-10-19): remove deprecated `git pull --rebase` aliases
|
||||
gup gpr
|
||||
gupv gprv
|
||||
gupa gpra
|
||||
gupav gprav
|
||||
gupom gprom
|
||||
gupomi gpromi
|
||||
); do
|
||||
aliases[$old_alias]="
|
||||
print -Pu2 \"%F{yellow}[oh-my-zsh] '%F{red}${old_alias}%F{yellow}' is a deprecated alias, using '%F{green}${new_alias}%F{yellow}' instead.%f\"
|
||||
$new_alias"
|
||||
done
|
||||
unset old_alias new_alias
|
||||
18
config/zsh/plugins/zsh-autosuggestions/.editorconfig
Normal file
18
config/zsh/plugins/zsh-autosuggestions/.editorconfig
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
indent_style = tab
|
||||
indent_size = 4
|
||||
|
||||
[*.md]
|
||||
indent_style = space
|
||||
|
||||
[*.rb]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[*.yml]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
3
config/zsh/plugins/zsh-autosuggestions/.rspec
Normal file
3
config/zsh/plugins/zsh-autosuggestions/.rspec
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
--color
|
||||
--require spec_helper
|
||||
--format documentation
|
||||
30
config/zsh/plugins/zsh-autosuggestions/.rubocop.yml
Normal file
30
config/zsh/plugins/zsh-autosuggestions/.rubocop.yml
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
# Rails:
|
||||
# Enabled: true
|
||||
|
||||
AllCops:
|
||||
TargetRubyVersion: 2.3
|
||||
Include:
|
||||
- '**/Rakefile'
|
||||
- '**/config.ru'
|
||||
- '**/Gemfile'
|
||||
|
||||
Metrics/LineLength:
|
||||
Max: 120
|
||||
|
||||
Style/Documentation:
|
||||
Enabled: false
|
||||
|
||||
Style/DotPosition:
|
||||
EnforcedStyle: trailing
|
||||
|
||||
Style/FrozenStringLiteralComment:
|
||||
Enabled: false
|
||||
|
||||
Style/Lambda:
|
||||
Enabled: false
|
||||
|
||||
Style/MultilineMethodCallIndentation:
|
||||
EnforcedStyle: indented
|
||||
|
||||
Style/TrailingUnderscoreVariable:
|
||||
Enabled: false
|
||||
1
config/zsh/plugins/zsh-autosuggestions/.ruby-version
Normal file
1
config/zsh/plugins/zsh-autosuggestions/.ruby-version
Normal file
|
|
@ -0,0 +1 @@
|
|||
2.5.3
|
||||
124
config/zsh/plugins/zsh-autosuggestions/CHANGELOG.md
Normal file
124
config/zsh/plugins/zsh-autosuggestions/CHANGELOG.md
Normal file
|
|
@ -0,0 +1,124 @@
|
|||
# Changelog
|
||||
|
||||
## v0.7.1
|
||||
- Clear POSTDISPLAY instead of unsetting (#634)
|
||||
- Always reset async file descriptor after consuming it (#630)
|
||||
- Always use builtin `exec` (#628)
|
||||
- Add `history-beginning-search-*-end` widgets to clear widget list (#619)
|
||||
- Switch CI from Circle CI to GitHub Actions
|
||||
|
||||
## v0.7.0
|
||||
- Enable asynchronous mode by default (#498)
|
||||
- No longer wrap user widgets starting with `autosuggest-` prefix (#496)
|
||||
- Fix a bug wrapping widgets that modify the buffer (#541)
|
||||
|
||||
|
||||
## v0.6.4
|
||||
- Fix `vi-forward-char` triggering a bell when using it to accept a suggestion (#488)
|
||||
- New configuration option to skip completion suggestions when buffer matches a pattern (#487)
|
||||
- New configuration option to ignore history entries matching a pattern (#456)
|
||||
|
||||
## v0.6.3
|
||||
- Fixed bug moving cursor to end of buffer after accepting suggestion (#453)
|
||||
|
||||
## v0.6.2
|
||||
- Fixed bug deleting the last character in the buffer in vi mode (#450)
|
||||
- Degrade gracefully when user doesn't have `zsh/system` module installed (#447)
|
||||
|
||||
## v0.6.1
|
||||
- Fixed bug occurring when `_complete` had been aliased (#443)
|
||||
|
||||
## v0.6.0
|
||||
- Added `completion` suggestion strategy powered by completion system (#111)
|
||||
- Allow setting `ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE` to an empty string (#422)
|
||||
- Don't fetch suggestions after copy-earlier-word (#439)
|
||||
- Allow users to unignore zle-\* widgets (e.g. zle-line-init) (#432)
|
||||
|
||||
|
||||
## v0.5.2
|
||||
- Allow disabling automatic widget re-binding for better performance (#418)
|
||||
- Fix async suggestions when `SH_WORD_SPLIT` is set
|
||||
- Refactor async mode to use process substitution instead of zpty (#417)
|
||||
|
||||
## v0.5.1
|
||||
- Speed up widget rebinding (#413)
|
||||
- Clean up global variable creations (#403)
|
||||
- Respect user's set options when running original widget (#402)
|
||||
|
||||
## v0.5.0
|
||||
- Don't overwrite config with default values (#335)
|
||||
- Support fallback strategies by supplying array to suggestion config var
|
||||
- Rename "default" suggestion strategy to "history" to name it based on what it actually does
|
||||
- Reset opts in some functions affected by `GLOB_SUBST` (#334)
|
||||
- Support widgets starting with dashes (ex: `-a-widget`) (#337)
|
||||
- Skip async tests in zsh versions less than 5.0.8 because of reliability issues
|
||||
- Fix handling of newline + carriage return in async pty (#333)
|
||||
|
||||
|
||||
## v0.4.3
|
||||
- Avoid bell when accepting suggestions with `autosuggest-accept` (#228)
|
||||
- Don't fetch suggestions after [up,down]-line-or-beginning-search (#227, #241)
|
||||
- We are now running CI against new 5.5.1 version
|
||||
- Fix partial-accept in vi mode (#188)
|
||||
- Fix suggestion disappearing on fast movement after switching to `vicmd` mode (#290)
|
||||
- Fix issue rotating through kill ring with `yank-pop` (#301)
|
||||
- Fix issue creating new pty for async mode when previous pty is not properly cleaned up (#249)
|
||||
|
||||
## v0.4.2
|
||||
- Fix bug in zsh versions older than 5.0.8 (#296)
|
||||
- Officially support back to zsh v4.3.11
|
||||
|
||||
## v0.4.1
|
||||
- Switch to [[ and (( conditionals instead of [ (#257)
|
||||
- Avoid warnnestedvar warnings with `typeset -g` (#275)
|
||||
- Replace tabs with spaces in yaml (#268)
|
||||
- Clean up and fix escaping of special characters (#267)
|
||||
- Add `emacs-forward-word` to default list of partial accept widgets (#246)
|
||||
|
||||
## v0.4.0
|
||||
- High-level integration tests using RSpec and tmux
|
||||
- Add continuous integration with Circle CI
|
||||
- Experimental support for asynchronous suggestions (#170)
|
||||
- Fix problems with multi-line suggestions (#225)
|
||||
- Optimize case where manually typing in suggestion
|
||||
- Avoid wrapping any zle-\* widgets (#206)
|
||||
- Remove support for deprecated options from v0.0.x
|
||||
- Handle history entries that begin with dashes
|
||||
- Gracefully handle being sourced multiple times (#126)
|
||||
- Add enable/disable/toggle widgets to disable/enable suggestions (#219)
|
||||
|
||||
|
||||
## v0.3.3
|
||||
- Switch from $history array to fc builtin for better performance with large HISTFILEs (#164)
|
||||
- Fix tilde handling when extended_glob is set (#168)
|
||||
- Add config option for maximum buffer length to fetch suggestions for (#178)
|
||||
- Add config option for list of widgets to ignore (#184)
|
||||
- Don't fetch a new suggestion unless a modification widget actually modifies the buffer (#183)
|
||||
|
||||
## v0.3.2
|
||||
- Test runner now supports running specific tests and choosing zsh binary
|
||||
- Return code from original widget is now correctly passed through (#135)
|
||||
- Add `vi-add-eol` to list of accept widgets (#143)
|
||||
- Escapes widget names within evals to fix problems with irregular widget names (#152)
|
||||
- Plugin now clears suggestion while within a completion menu (#149)
|
||||
- .plugin file no longer relies on symbolic link support, fixing issues on Windows (#156)
|
||||
|
||||
## v0.3.1
|
||||
|
||||
- Fixes issue with `vi-next-char` not accepting suggestion (#137).
|
||||
- Fixes global variable warning when WARN_CREATE_GLOBAL option enabled (#133).
|
||||
- Split out a separate test file for each widget.
|
||||
|
||||
## v0.3.0
|
||||
|
||||
- Adds `autosuggest-execute` widget (PR #124).
|
||||
- Adds concept of suggestion "strategies" for different ways of fetching suggestions.
|
||||
- Adds "match_prev_cmd" strategy (PR #131).
|
||||
- Uses git submodules for testing dependencies.
|
||||
- Lots of test cleanup.
|
||||
- Various bug fixes for zsh 5.0.x and `sh_word_split` option.
|
||||
|
||||
|
||||
## v0.2.17
|
||||
|
||||
Start of changelog.
|
||||
1
config/zsh/plugins/zsh-autosuggestions/DESCRIPTION
Normal file
1
config/zsh/plugins/zsh-autosuggestions/DESCRIPTION
Normal file
|
|
@ -0,0 +1 @@
|
|||
Fish-like fast/unobtrusive autosuggestions for zsh.
|
||||
21
config/zsh/plugins/zsh-autosuggestions/Dockerfile
Normal file
21
config/zsh/plugins/zsh-autosuggestions/Dockerfile
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
FROM ruby:2.5.3-alpine
|
||||
|
||||
ARG TEST_ZSH_VERSION
|
||||
RUN : "${TEST_ZSH_VERSION:?}"
|
||||
|
||||
RUN apk add --no-cache autoconf
|
||||
RUN apk add --no-cache libtool
|
||||
RUN apk add --no-cache libcap-dev
|
||||
RUN apk add --no-cache pcre-dev
|
||||
RUN apk add --no-cache curl
|
||||
RUN apk add --no-cache build-base
|
||||
RUN apk add --no-cache ncurses-dev
|
||||
RUN apk add --no-cache tmux
|
||||
|
||||
WORKDIR /zsh-autosuggestions
|
||||
|
||||
ADD install_test_zsh.sh ./
|
||||
RUN ./install_test_zsh.sh
|
||||
|
||||
ADD Gemfile Gemfile.lock ./
|
||||
RUN bundle install
|
||||
5
config/zsh/plugins/zsh-autosuggestions/Gemfile
Normal file
5
config/zsh/plugins/zsh-autosuggestions/Gemfile
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
source 'https://rubygems.org'
|
||||
|
||||
gem 'rspec'
|
||||
gem 'rspec-wait'
|
||||
gem 'pry-byebug'
|
||||
41
config/zsh/plugins/zsh-autosuggestions/Gemfile.lock
Normal file
41
config/zsh/plugins/zsh-autosuggestions/Gemfile.lock
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
byebug (9.0.5)
|
||||
coderay (1.1.1)
|
||||
diff-lcs (1.3)
|
||||
method_source (0.8.2)
|
||||
pry (0.10.4)
|
||||
coderay (~> 1.1.0)
|
||||
method_source (~> 0.8.1)
|
||||
slop (~> 3.4)
|
||||
pry-byebug (3.4.0)
|
||||
byebug (~> 9.0)
|
||||
pry (~> 0.10)
|
||||
rspec (3.5.0)
|
||||
rspec-core (~> 3.5.0)
|
||||
rspec-expectations (~> 3.5.0)
|
||||
rspec-mocks (~> 3.5.0)
|
||||
rspec-core (3.5.4)
|
||||
rspec-support (~> 3.5.0)
|
||||
rspec-expectations (3.5.0)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.5.0)
|
||||
rspec-mocks (3.5.0)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.5.0)
|
||||
rspec-support (3.5.0)
|
||||
rspec-wait (0.0.9)
|
||||
rspec (>= 3, < 4)
|
||||
slop (3.6.0)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
pry-byebug
|
||||
rspec
|
||||
rspec-wait
|
||||
|
||||
BUNDLED WITH
|
||||
1.13.6
|
||||
82
config/zsh/plugins/zsh-autosuggestions/INSTALL.md
Normal file
82
config/zsh/plugins/zsh-autosuggestions/INSTALL.md
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
# Installation
|
||||
|
||||
* [Packages](#packages)
|
||||
* [Antigen](#antigen)
|
||||
* [Oh My Zsh](#oh-my-zsh)
|
||||
* [HomeBrew](#homebrew)
|
||||
* [Manual](#manual-git-clone)
|
||||
|
||||
## Packages
|
||||
|
||||
| System | Package |
|
||||
| ------------- | ------------- |
|
||||
| Alpine Linux | [zsh-autosuggestions](https://pkgs.alpinelinux.org/packages?name=zsh-autosuggestions) |
|
||||
| Debian / Ubuntu | [zsh-autosuggestions OBS repository](https://software.opensuse.org/download.html?project=shells%3Azsh-users%3Azsh-autosuggestions&package=zsh-autosuggestions) |
|
||||
| Fedora / CentOS / RHEL / Scientific Linux | [zsh-autosuggestions OBS repository](https://software.opensuse.org/download.html?project=shells%3Azsh-users%3Azsh-autosuggestions&package=zsh-autosuggestions) |
|
||||
| OpenSUSE / SLE | [zsh-autosuggestions OBS repository](https://software.opensuse.org/download.html?project=shells%3Azsh-users%3Azsh-autosuggestions&package=zsh-autosuggestions) |
|
||||
| Arch Linux / Manjaro / Antergos / Hyperbola | [zsh-autosuggestions](https://www.archlinux.org/packages/zsh-autosuggestions), [zsh-autosuggestions-git](https://aur.archlinux.org/packages/zsh-autosuggestions-git) |
|
||||
| NixOS | [zsh-autosuggestions](https://github.com/NixOS/nixpkgs/blob/master/pkgs/by-name/zs/zsh-autosuggestions/package.nix) |
|
||||
| Void Linux | [zsh-autosuggestions](https://github.com/void-linux/void-packages/blob/master/srcpkgs/zsh-autosuggestions/template) |
|
||||
| Mac OS | [homebrew](https://formulae.brew.sh/formula/zsh-autosuggestions) |
|
||||
| NetBSD | [pkgsrc](http://ftp.netbsd.org/pub/pkgsrc/current/pkgsrc/shells/zsh-autosuggestions/README.html) |
|
||||
| FreeBSD | [pkg](https://cgit.freebsd.org/ports/tree/shells/zsh-autosuggestions) |
|
||||
|
||||
## Antigen
|
||||
|
||||
1. Add the following to your `.zshrc`:
|
||||
|
||||
```sh
|
||||
antigen bundle zsh-users/zsh-autosuggestions
|
||||
```
|
||||
|
||||
2. Start a new terminal session.
|
||||
|
||||
## Oh My Zsh
|
||||
|
||||
1. Clone this repository into `$ZSH_CUSTOM/plugins` (by default `~/.oh-my-zsh/custom/plugins`)
|
||||
|
||||
```sh
|
||||
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
|
||||
```
|
||||
|
||||
2. Add the plugin to the list of plugins for Oh My Zsh to load (inside `~/.zshrc`):
|
||||
|
||||
```sh
|
||||
plugins=(
|
||||
# other plugins...
|
||||
zsh-autosuggestions
|
||||
)
|
||||
```
|
||||
|
||||
3. Start a new terminal session.
|
||||
|
||||
## Homebrew
|
||||
|
||||
1. Install command:
|
||||
```sh
|
||||
brew install zsh-autosuggestions
|
||||
```
|
||||
|
||||
2. To activate the autosuggestions, add the following at the end of your .zshrc:
|
||||
|
||||
```sh
|
||||
source $(brew --prefix)/share/zsh-autosuggestions/zsh-autosuggestions.zsh
|
||||
```
|
||||
|
||||
3. Start a new terminal session.
|
||||
|
||||
## Manual (Git Clone)
|
||||
|
||||
1. Clone this repository somewhere on your machine. This guide will assume `~/.zsh/zsh-autosuggestions`.
|
||||
|
||||
```sh
|
||||
git clone https://github.com/zsh-users/zsh-autosuggestions ~/.zsh/zsh-autosuggestions
|
||||
```
|
||||
|
||||
2. Add the following to your `.zshrc`:
|
||||
|
||||
```sh
|
||||
source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
|
||||
```
|
||||
|
||||
3. Start a new terminal session.
|
||||
23
config/zsh/plugins/zsh-autosuggestions/LICENSE
Normal file
23
config/zsh/plugins/zsh-autosuggestions/LICENSE
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
Copyright (c) 2013 Thiago de Arruda
|
||||
Copyright (c) 2016-2021 Eric Freese
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without
|
||||
restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
35
config/zsh/plugins/zsh-autosuggestions/Makefile
Normal file
35
config/zsh/plugins/zsh-autosuggestions/Makefile
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
SRC_DIR := ./src
|
||||
|
||||
SRC_FILES := \
|
||||
$(SRC_DIR)/config.zsh \
|
||||
$(SRC_DIR)/util.zsh \
|
||||
$(SRC_DIR)/bind.zsh \
|
||||
$(SRC_DIR)/highlight.zsh \
|
||||
$(SRC_DIR)/widgets.zsh \
|
||||
$(SRC_DIR)/strategies/*.zsh \
|
||||
$(SRC_DIR)/fetch.zsh \
|
||||
$(SRC_DIR)/async.zsh \
|
||||
$(SRC_DIR)/start.zsh
|
||||
|
||||
HEADER_FILES := \
|
||||
DESCRIPTION \
|
||||
URL \
|
||||
VERSION \
|
||||
LICENSE
|
||||
|
||||
PLUGIN_TARGET := zsh-autosuggestions.zsh
|
||||
|
||||
all: $(PLUGIN_TARGET)
|
||||
|
||||
$(PLUGIN_TARGET): $(HEADER_FILES) $(SRC_FILES)
|
||||
cat $(HEADER_FILES) | sed -e 's/^/# /g' > $@
|
||||
cat $(SRC_FILES) >> $@
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm $(PLUGIN_TARGET)
|
||||
|
||||
.PHONY: test
|
||||
test: all
|
||||
@test -n "$$TEST_ZSH_BIN" && echo "Testing zsh binary: $(TEST_ZSH_BIN)" || true
|
||||
bundle exec rspec $(TESTS)
|
||||
188
config/zsh/plugins/zsh-autosuggestions/README.md
Normal file
188
config/zsh/plugins/zsh-autosuggestions/README.md
Normal file
|
|
@ -0,0 +1,188 @@
|
|||
# zsh-autosuggestions
|
||||
|
||||
_[Fish](http://fishshell.com/)-like fast/unobtrusive autosuggestions for zsh._
|
||||
|
||||
It suggests commands as you type based on history and completions.
|
||||
|
||||
Requirements: Zsh v4.3.11 or later
|
||||
|
||||
[](https://gitter.im/zsh-users/zsh-autosuggestions)
|
||||
|
||||
<a href="https://asciinema.org/a/37390" target="_blank"><img src="https://asciinema.org/a/37390.png" width="400" /></a>
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
See [INSTALL.md](INSTALL.md).
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
As you type commands, you will see a completion offered after the cursor in a muted gray color. This color can be changed by setting the `ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE` variable. See [configuration](#configuration).
|
||||
|
||||
If you press the <kbd>→</kbd> key (`forward-char` widget) or <kbd>End</kbd> (`end-of-line` widget) with the cursor at the end of the buffer, it will accept the suggestion, replacing the contents of the command line buffer with the suggestion.
|
||||
|
||||
If you invoke the `forward-word` widget, it will partially accept the suggestion up to the point that the cursor moves to.
|
||||
|
||||
|
||||
## Configuration
|
||||
|
||||
You may want to override the default global config variables. Default values of these variables can be found [here](src/config.zsh).
|
||||
|
||||
**Note:** If you are using Oh My Zsh, you can put this configuration in a file in the `$ZSH_CUSTOM` directory. See their comments on [overriding internals](https://github.com/robbyrussell/oh-my-zsh/wiki/Customization#overriding-internals).
|
||||
|
||||
|
||||
### Suggestion Highlight Style
|
||||
|
||||
Set `ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE` to configure the style that the suggestion is shown with. The default is `fg=8`, which will set the foreground color to color 8 from the [256-color palette](https://upload.wikimedia.org/wikipedia/commons/1/15/Xterm_256color_chart.svg). If your terminal only supports 8 colors, you will need to use a number between 0 and 7.
|
||||
|
||||
Background color can also be set, and the suggestion can be styled bold, underlined, or standout. For example, this would show suggestions with bold, underlined, pink text on a cyan background:
|
||||
|
||||
```sh
|
||||
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#ff00ff,bg=cyan,bold,underline"
|
||||
```
|
||||
|
||||
For more info, read the Character Highlighting section of the zsh manual: `man zshzle` or [online](http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Character-Highlighting).
|
||||
|
||||
**Note:** Some iTerm2 users have reported [not being able to see the suggestions](https://github.com/zsh-users/zsh-autosuggestions/issues/416#issuecomment-486516333). If this affects you, the problem is likely caused by incorrect color settings. In order to correct this, go into iTerm2's setting, navigate to profile > colors and make sure that the colors for Basic Colors > Background and ANSI Colors > Bright Black are **different**.
|
||||
|
||||
|
||||
### Suggestion Strategy
|
||||
|
||||
`ZSH_AUTOSUGGEST_STRATEGY` is an array that specifies how suggestions should be generated. The strategies in the array are tried successively until a suggestion is found. There are currently three built-in strategies to choose from:
|
||||
|
||||
- `history`: Chooses the most recent match from history.
|
||||
- `completion`: Chooses a suggestion based on what tab-completion would suggest. (requires `zpty` module, which is included with zsh since 4.0.1)
|
||||
- `match_prev_cmd`: Like `history`, but chooses the most recent match whose preceding history item matches the most recently executed command ([more info](src/strategies/match_prev_cmd.zsh)). Note that this strategy won't work as expected with ZSH options that don't preserve the history order such as `HIST_IGNORE_ALL_DUPS` or `HIST_EXPIRE_DUPS_FIRST`.
|
||||
|
||||
For example, setting `ZSH_AUTOSUGGEST_STRATEGY=(history completion)` will first try to find a suggestion from your history, but, if it can't find a match, will find a suggestion from the completion engine.
|
||||
|
||||
|
||||
### Widget Mapping
|
||||
|
||||
This plugin works by triggering custom behavior when certain [zle widgets](http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Zle-Widgets) are invoked. You can add and remove widgets from these arrays to change the behavior of this plugin:
|
||||
|
||||
- `ZSH_AUTOSUGGEST_CLEAR_WIDGETS`: Widgets in this array will clear the suggestion when invoked.
|
||||
- `ZSH_AUTOSUGGEST_ACCEPT_WIDGETS`: Widgets in this array will accept the suggestion when invoked.
|
||||
- `ZSH_AUTOSUGGEST_EXECUTE_WIDGETS`: Widgets in this array will execute the suggestion when invoked.
|
||||
- `ZSH_AUTOSUGGEST_PARTIAL_ACCEPT_WIDGETS`: Widgets in this array will partially accept the suggestion when invoked.
|
||||
- `ZSH_AUTOSUGGEST_IGNORE_WIDGETS`: Widgets in this array will not trigger any custom behavior.
|
||||
|
||||
Widgets that modify the buffer and are not found in any of these arrays will fetch a new suggestion after they are invoked.
|
||||
|
||||
**Note:** A widget shouldn't belong to more than one of the above arrays.
|
||||
|
||||
|
||||
### Disabling suggestion for large buffers
|
||||
|
||||
Set `ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE` to an integer value to disable autosuggestion for large buffers. The default is unset, which means that autosuggestion will be tried for any buffer size. Recommended value is 20.
|
||||
This can be useful when pasting large amount of text in the terminal, to avoid triggering autosuggestion for strings that are too long.
|
||||
|
||||
### Asynchronous Mode
|
||||
|
||||
Suggestions are fetched asynchronously by default in zsh versions 5.0.8 and greater. To disable asynchronous suggestions and fetch them synchronously instead, `unset ZSH_AUTOSUGGEST_USE_ASYNC` after sourcing the plugin.
|
||||
|
||||
Alternatively, if you are using a version of zsh older than 5.0.8 and want to enable asynchronous mode, set the `ZSH_AUTOSUGGEST_USE_ASYNC` variable after sourcing the plugin (it can be set to anything). Note that there is [a bug](https://github.com/zsh-users/zsh-autosuggestions/issues/364#issuecomment-481423232) in versions of zsh older than 5.0.8 where <kbd>ctrl</kbd> + <kbd>c</kbd> will fail to reset the prompt immediately after fetching a suggestion asynchronously.
|
||||
|
||||
### Disabling automatic widget re-binding
|
||||
|
||||
Set `ZSH_AUTOSUGGEST_MANUAL_REBIND` (it can be set to anything) to disable automatic widget re-binding on each precmd. This can be a big boost to performance, but you'll need to handle re-binding yourself if any of the widget lists change or if you or another plugin wrap any of the autosuggest widgets. To re-bind widgets, run `_zsh_autosuggest_bind_widgets`.
|
||||
|
||||
### Ignoring history suggestions that match a pattern
|
||||
|
||||
Set `ZSH_AUTOSUGGEST_HISTORY_IGNORE` to a [glob pattern](http://zsh.sourceforge.net/Doc/Release/Expansion.html#Glob-Operators) to prevent offering suggestions for history entries that match the pattern. For example, set it to `"cd *"` to never suggest any `cd` commands from history. Or set to `"?(#c50,)"` to never suggest anything 50 characters or longer.
|
||||
|
||||
**Note:** This only affects the `history` and `match_prev_cmd` suggestion strategies.
|
||||
|
||||
### Skipping completion suggestions for certain cases
|
||||
|
||||
Set `ZSH_AUTOSUGGEST_COMPLETION_IGNORE` to a [glob pattern](http://zsh.sourceforge.net/Doc/Release/Expansion.html#Glob-Operators) to prevent offering completion suggestions when the buffer matches that pattern. For example, set it to `"git *"` to disable completion suggestions for git subcommands.
|
||||
|
||||
**Note:** This only affects the `completion` suggestion strategy.
|
||||
|
||||
|
||||
### Key Bindings
|
||||
|
||||
This plugin provides a few widgets that you can use with `bindkey`:
|
||||
|
||||
1. `autosuggest-accept`: Accepts the current suggestion.
|
||||
2. `autosuggest-execute`: Accepts and executes the current suggestion.
|
||||
3. `autosuggest-clear`: Clears the current suggestion.
|
||||
4. `autosuggest-fetch`: Fetches a suggestion (works even when suggestions are disabled).
|
||||
5. `autosuggest-disable`: Disables suggestions.
|
||||
6. `autosuggest-enable`: Re-enables suggestions.
|
||||
7. `autosuggest-toggle`: Toggles between enabled/disabled suggestions.
|
||||
|
||||
For example, this would bind <kbd>ctrl</kbd> + <kbd>space</kbd> to accept the current suggestion.
|
||||
|
||||
```sh
|
||||
bindkey '^ ' autosuggest-accept
|
||||
```
|
||||
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
If you have a problem, please search through [the list of issues on GitHub](https://github.com/zsh-users/zsh-autosuggestions/issues?q=) to see if someone else has already reported it.
|
||||
|
||||
### Reporting an Issue
|
||||
|
||||
Before reporting an issue, please try temporarily disabling sections of your configuration and other plugins that may be conflicting with this plugin to isolate the problem.
|
||||
|
||||
When reporting an issue, please include:
|
||||
|
||||
- The smallest, simplest `.zshrc` configuration that will reproduce the problem. See [this comment](https://github.com/zsh-users/zsh-autosuggestions/issues/102#issuecomment-180944764) for a good example of what this means.
|
||||
- The version of zsh you're using (`zsh --version`)
|
||||
- Which operating system you're running
|
||||
|
||||
|
||||
## Uninstallation
|
||||
|
||||
1. Remove the code referencing this plugin from `~/.zshrc`.
|
||||
|
||||
2. Remove the git repository from your hard drive
|
||||
|
||||
```sh
|
||||
rm -rf ~/.zsh/zsh-autosuggestions # Or wherever you installed
|
||||
```
|
||||
|
||||
|
||||
## Development
|
||||
|
||||
### Build Process
|
||||
|
||||
Edit the source files in `src/`. Run `make` to build `zsh-autosuggestions.zsh` from those source files.
|
||||
|
||||
|
||||
### Pull Requests
|
||||
|
||||
Pull requests are welcome! If you send a pull request, please:
|
||||
|
||||
- Request to merge into the `develop` branch (*NOT* `master`)
|
||||
- Match the existing coding conventions.
|
||||
- Include helpful comments to keep the barrier-to-entry low for people new to the project.
|
||||
- Write tests that cover your code as much as possible.
|
||||
|
||||
|
||||
### Testing
|
||||
|
||||
Tests are written in ruby using the [`rspec`](http://rspec.info/) framework. They use [`tmux`](https://tmux.github.io/) to drive a pseudoterminal, sending simulated keystrokes and making assertions on the terminal content.
|
||||
|
||||
Test files live in `spec/`. To run the tests, run `make test`. To run a specific test, run `TESTS=spec/some_spec.rb make test`. You can also specify a `zsh` binary to use by setting the `TEST_ZSH_BIN` environment variable (ex: `TEST_ZSH_BIN=/bin/zsh make test`).
|
||||
|
||||
It's possible to run the tests for any supported version of zsh in a Docker image by building an image from the provided Dockerfile. To build the docker image for a specific version of zsh (where `<version>` below is substituted with the contents of a line from the [`ZSH_VERSIONS`](ZSH_VERSIONS) file), run:
|
||||
|
||||
```sh
|
||||
docker build --build-arg TEST_ZSH_VERSION=<version> -t zsh-autosuggestions-test .
|
||||
```
|
||||
|
||||
After building the image, run the tests via:
|
||||
|
||||
```sh
|
||||
docker run -it -v $PWD:/zsh-autosuggestions zsh-autosuggestions-test make test
|
||||
```
|
||||
|
||||
|
||||
## License
|
||||
|
||||
This project is licensed under [MIT license](http://opensource.org/licenses/MIT).
|
||||
For the full text of the license, see the [LICENSE](LICENSE) file.
|
||||
1
config/zsh/plugins/zsh-autosuggestions/URL
Normal file
1
config/zsh/plugins/zsh-autosuggestions/URL
Normal file
|
|
@ -0,0 +1 @@
|
|||
https://github.com/zsh-users/zsh-autosuggestions
|
||||
1
config/zsh/plugins/zsh-autosuggestions/VERSION
Normal file
1
config/zsh/plugins/zsh-autosuggestions/VERSION
Normal file
|
|
@ -0,0 +1 @@
|
|||
v0.7.1
|
||||
14
config/zsh/plugins/zsh-autosuggestions/ZSH_VERSIONS
Normal file
14
config/zsh/plugins/zsh-autosuggestions/ZSH_VERSIONS
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
# Zsh releases to run tests against
|
||||
# See https://github.com/zsh-users/zsh/releases
|
||||
4.3.11
|
||||
5.0.2
|
||||
5.0.8
|
||||
5.1.1
|
||||
5.2
|
||||
5.3.1
|
||||
5.4.2
|
||||
5.5.1
|
||||
5.6.2
|
||||
5.7.1
|
||||
5.8.1
|
||||
5.9
|
||||
23
config/zsh/plugins/zsh-autosuggestions/install_test_zsh.sh
Normal file
23
config/zsh/plugins/zsh-autosuggestions/install_test_zsh.sh
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -ex
|
||||
|
||||
mkdir zsh-build
|
||||
cd zsh-build
|
||||
|
||||
curl -L https://api.github.com/repos/zsh-users/zsh/tarball/zsh-$TEST_ZSH_VERSION | tar xz --strip=1
|
||||
|
||||
./Util/preconfig
|
||||
./configure --enable-pcre \
|
||||
--enable-cap \
|
||||
--enable-multibyte \
|
||||
--with-term-lib='ncursesw tinfo' \
|
||||
--with-tcsetpgrp
|
||||
|
||||
make install.bin
|
||||
make install.modules
|
||||
make install.fns
|
||||
|
||||
cd ..
|
||||
|
||||
rm -rf zsh-build
|
||||
70
config/zsh/plugins/zsh-autosuggestions/spec/async_spec.rb
Normal file
70
config/zsh/plugins/zsh-autosuggestions/spec/async_spec.rb
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
context 'with asynchronous suggestions enabled' do
|
||||
let(:options) { ["ZSH_AUTOSUGGEST_USE_ASYNC="] }
|
||||
|
||||
describe '`up-line-or-beginning-search`' do
|
||||
let(:before_sourcing) do
|
||||
-> do
|
||||
session.
|
||||
run_command('autoload -U up-line-or-beginning-search').
|
||||
run_command('zle -N up-line-or-beginning-search').
|
||||
send_string('bindkey "').
|
||||
send_keys('C-v').send_keys('up').
|
||||
send_string('" up-line-or-beginning-search').
|
||||
send_keys('enter')
|
||||
end
|
||||
end
|
||||
|
||||
it 'should show previous history entries' do
|
||||
with_history(
|
||||
'echo foo',
|
||||
'echo bar',
|
||||
'echo baz'
|
||||
) do
|
||||
session.clear_screen
|
||||
3.times { session.send_keys('up') }
|
||||
wait_for { session.content }.to eq("echo foo")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '`copy-earlier-word`' do
|
||||
let(:before_sourcing) do
|
||||
-> do
|
||||
session.
|
||||
run_command('autoload -Uz copy-earlier-word').
|
||||
run_command('zle -N copy-earlier-word').
|
||||
run_command('bindkey "^N" copy-earlier-word')
|
||||
end
|
||||
end
|
||||
|
||||
it 'should cycle through previous words in the buffer' do
|
||||
session.clear_screen
|
||||
session.send_string('foo bar baz')
|
||||
sleep 0.5
|
||||
session.send_keys('C-n')
|
||||
wait_for { session.content }.to eq('foo bar bazbaz')
|
||||
session.send_keys('C-n')
|
||||
wait_for { session.content }.to eq('foo bar bazbar')
|
||||
session.send_keys('C-n')
|
||||
wait_for { session.content }.to eq('foo bar bazfoo')
|
||||
end
|
||||
end
|
||||
|
||||
describe 'pressing ^C after fetching a suggestion' do
|
||||
before do
|
||||
skip 'Workaround does not work below v5.0.8' if session.zsh_version < Gem::Version.new('5.0.8')
|
||||
end
|
||||
|
||||
it 'terminates the prompt and begins a new one' do
|
||||
session.send_keys('e')
|
||||
sleep 0.5
|
||||
session.send_keys('C-c')
|
||||
sleep 0.5
|
||||
session.send_keys('echo')
|
||||
|
||||
wait_for { session.content }.to eq("e\necho")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
describe 'with `AUTO_CD` option set' do
|
||||
let(:after_sourcing) do
|
||||
-> {
|
||||
session.run_command('setopt AUTO_CD')
|
||||
session.run_command('autoload compinit && compinit')
|
||||
}
|
||||
end
|
||||
|
||||
it 'directory names are still completed' do
|
||||
session.send_string('sr')
|
||||
session.send_keys('C-i')
|
||||
wait_for { session.content }.to eq('src/')
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
describe 'pasting using bracketed-paste-magic' do
|
||||
let(:before_sourcing) do
|
||||
-> do
|
||||
session.
|
||||
run_command('autoload -Uz bracketed-paste-magic').
|
||||
run_command('zle -N bracketed-paste bracketed-paste-magic')
|
||||
end
|
||||
end
|
||||
|
||||
context 'with suggestions disabled while pasting' do
|
||||
before do
|
||||
session.
|
||||
run_command('bpm_init() { zle autosuggest-disable }').
|
||||
run_command('bpm_finish() { zle autosuggest-enable }').
|
||||
run_command('zstyle :bracketed-paste-magic paste-init bpm_init').
|
||||
run_command('zstyle :bracketed-paste-magic paste-finish bpm_finish')
|
||||
end
|
||||
|
||||
it 'does not show an incorrect suggestion' do
|
||||
with_history('echo hello') do
|
||||
session.paste_string("echo #{'a' * 60}")
|
||||
sleep 1
|
||||
expect(session.content).to eq("echo #{'a' * 60}")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'with `bracketed-paste` added to the list of widgets that clear the suggestion' do
|
||||
let(:options) { ['ZSH_AUTOSUGGEST_CLEAR_WIDGETS+=(bracketed-paste)'] }
|
||||
|
||||
it 'does not retain an old suggestion' do
|
||||
with_history ('echo foo') do
|
||||
session.send_string('echo ')
|
||||
wait_for { session.content }.to eq('echo foo')
|
||||
session.paste_string('bar')
|
||||
wait_for { session.content }.to eq('echo bar')
|
||||
session.send_keys('C-a') # Any cursor movement works
|
||||
sleep 1
|
||||
expect(session.content).to eq('echo bar')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
describe 'a running zpty command' do
|
||||
let(:before_sourcing) { -> { session.run_command('zmodload zsh/zpty && zpty -b kitty cat') } }
|
||||
|
||||
context 'when using `completion` strategy' do
|
||||
let(:options) { ["ZSH_AUTOSUGGEST_STRATEGY=completion"] }
|
||||
|
||||
it 'is not affected' do
|
||||
session.send_keys('a').send_keys('C-h')
|
||||
session.run_command('zpty -t kitty; echo $?')
|
||||
|
||||
wait_for { session.content }.to end_with("\n0")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
describe 'with `GLOB_SUBST` option set' do
|
||||
let(:after_sourcing) do
|
||||
-> {
|
||||
session.run_command('setopt GLOB_SUBST')
|
||||
}
|
||||
end
|
||||
|
||||
it 'error messages are not printed' do
|
||||
session.send_string('[[')
|
||||
wait_for { session.content }.to eq('[[')
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
describe 'rebinding [' do
|
||||
context 'initialized before sourcing the plugin' do
|
||||
before do
|
||||
session.run_command("function [ { $commands[\\[] \"$@\" }")
|
||||
session.clear_screen
|
||||
end
|
||||
|
||||
it 'executes the custom behavior and the built-in behavior' do
|
||||
session.send_string('asdf')
|
||||
wait_for { session.content }.to eq('asdf')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,80 @@
|
|||
describe 'when using vi mode' do
|
||||
let(:before_sourcing) do
|
||||
-> do
|
||||
session.run_command('bindkey -v')
|
||||
end
|
||||
end
|
||||
|
||||
describe 'moving the cursor after exiting insert mode' do
|
||||
it 'should not clear the current suggestion' do
|
||||
with_history('foobar foo') do
|
||||
session.
|
||||
send_string('foo').
|
||||
send_keys('escape').
|
||||
send_keys('h')
|
||||
|
||||
wait_for { session.content }.to eq('foobar foo')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '`vi-forward-word-end`' do
|
||||
it 'should accept through the end of the current word' do
|
||||
with_history('foobar foo') do
|
||||
session.
|
||||
send_string('foo').
|
||||
send_keys('escape').
|
||||
send_keys('e'). # vi-forward-word-end
|
||||
send_keys('a'). # vi-add-next
|
||||
send_string('baz')
|
||||
|
||||
wait_for { session.content }.to eq('foobarbaz')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '`vi-forward-word`' do
|
||||
it 'should accept through the first character of the next word' do
|
||||
with_history('foobar foo') do
|
||||
session.
|
||||
send_string('foo').
|
||||
send_keys('escape').
|
||||
send_keys('w'). # vi-forward-word
|
||||
send_keys('a'). # vi-add-next
|
||||
send_string('az')
|
||||
|
||||
wait_for { session.content }.to eq('foobar faz')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '`vi-find-next-char`' do
|
||||
it 'should accept through the next occurrence of the character' do
|
||||
with_history('foobar foo') do
|
||||
session.
|
||||
send_string('foo').
|
||||
send_keys('escape').
|
||||
send_keys('f'). # vi-find-next-char
|
||||
send_keys('o').
|
||||
send_keys('a'). # vi-add-next
|
||||
send_string('b')
|
||||
|
||||
wait_for { session.content }.to eq('foobar fob')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '`vi-delete`' do
|
||||
it 'should be able to remove the last character in the buffer' do
|
||||
skip 'deleting last char did not work below zsh version 5.0.8' if session.zsh_version < Gem::Version.new('5.0.8')
|
||||
|
||||
session.
|
||||
send_string('echo foo').
|
||||
send_keys('escape').
|
||||
send_keys('d').
|
||||
send_keys('l')
|
||||
|
||||
wait_for { session.content }.to eq('echo fo')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
describe 'a wrapped widget' do
|
||||
let(:widget) { 'backward-delete-char' }
|
||||
|
||||
context 'initialized before sourcing the plugin' do
|
||||
let(:before_sourcing) do
|
||||
-> do
|
||||
session.
|
||||
run_command("_orig_#{widget}() { zle .#{widget} }").
|
||||
run_command("zle -N orig-#{widget} _orig_#{widget}").
|
||||
run_command("#{widget}-magic() { zle orig-#{widget}; BUFFER+=b }").
|
||||
run_command("zle -N #{widget} #{widget}-magic")
|
||||
end
|
||||
end
|
||||
|
||||
it 'executes the custom behavior and the built-in behavior' do
|
||||
with_history('foobar', 'foodar') do
|
||||
session.send_string('food').send_keys('C-h')
|
||||
wait_for { session.content }.to eq('foobar')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'initialized after sourcing the plugin' do
|
||||
before do
|
||||
session.
|
||||
run_command("zle -N orig-#{widget} ${widgets[#{widget}]#*:}").
|
||||
run_command("#{widget}-magic() { zle orig-#{widget}; BUFFER+=b }").
|
||||
run_command("zle -N #{widget} #{widget}-magic").
|
||||
clear_screen
|
||||
end
|
||||
|
||||
it 'executes the custom behavior and the built-in behavior' do
|
||||
with_history('foobar', 'foodar') do
|
||||
session.send_string('food').send_keys('C-h')
|
||||
wait_for { session.content }.to eq('foobar')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
describe 'using `zle -U`' do
|
||||
let(:before_sourcing) do
|
||||
-> do
|
||||
session.
|
||||
run_command('_zsh_autosuggest_strategy_test() { sleep 1; _zsh_autosuggest_strategy_history "$1" }').
|
||||
run_command('foo() { zle -U - "echo hello" }; zle -N foo; bindkey ^B foo')
|
||||
end
|
||||
end
|
||||
|
||||
let(:options) { ['unset ZSH_AUTOSUGGEST_USE_ASYNC', 'ZSH_AUTOSUGGEST_STRATEGY=test'] }
|
||||
|
||||
# TODO: This is only possible with the $KEYS_QUEUED_COUNT widget parameter, coming soon...
|
||||
xit 'does not fetch a suggestion for every inserted character' do
|
||||
session.send_keys('C-b')
|
||||
wait_for { session.content }.to eq('echo hello')
|
||||
end
|
||||
|
||||
it 'shows a suggestion when the widget completes' do
|
||||
with_history('echo hello world') do
|
||||
session.send_keys('C-b')
|
||||
wait_for { session.content(esc_seqs: true) }.to match(/\Aecho hello\e\[[0-9]+m world/)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
context 'with some items in the kill ring' do
|
||||
before do
|
||||
session.
|
||||
send_string('echo foo').
|
||||
send_keys('C-u').
|
||||
send_string('echo bar').
|
||||
send_keys('C-u')
|
||||
end
|
||||
|
||||
describe '`yank-pop`' do
|
||||
it 'should cycle through all items in the kill ring' do
|
||||
session.send_keys('C-y')
|
||||
wait_for { session.content }.to eq('echo bar')
|
||||
|
||||
session.send_keys('escape').send_keys('y')
|
||||
wait_for { session.content }.to eq('echo foo')
|
||||
|
||||
session.send_keys('escape').send_keys('y')
|
||||
wait_for { session.content }.to eq('echo bar')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
context 'with zle-line-init unignored' do
|
||||
let(:after_sourcing) do
|
||||
-> do
|
||||
session.
|
||||
run_command('setopt extendedglob').
|
||||
run_command('ZSH_AUTOSUGGEST_IGNORE_WIDGETS=(${(@)ZSH_AUTOSUGGEST_IGNORE_WIDGETS:#zle-\*} zle-\^line-init)').
|
||||
run_command('zle-line-init() { BUFFER="echo" }')
|
||||
end
|
||||
end
|
||||
|
||||
it 'should fetch a suggestion on each line initialization' do
|
||||
with_history('echo foo') do
|
||||
session.run_command('zle -N zle-line-init')
|
||||
wait_for { session.content }.to end_with('echo foo')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
describe 'a multi-line suggestion' do
|
||||
it 'should be displayed on multiple lines' do
|
||||
with_history("echo \"\n\"") do
|
||||
session.send_keys('e')
|
||||
wait_for { session.content }.to eq("echo \"\n\"")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
describe 'a suggestion' do
|
||||
let(:term_opts) { { width: 200 } }
|
||||
let(:long_command) { "echo #{'a' * 100}" }
|
||||
|
||||
around do |example|
|
||||
with_history(long_command) { example.run }
|
||||
end
|
||||
|
||||
it 'is provided for any buffer length' do
|
||||
session.send_string(long_command[0...-1])
|
||||
wait_for { session.content }.to eq(long_command)
|
||||
end
|
||||
|
||||
context 'when ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE is specified' do
|
||||
let(:buffer_max_size) { 10 }
|
||||
let(:options) { ["ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE=#{buffer_max_size}"] }
|
||||
|
||||
it 'is provided when the buffer is shorter than the specified length' do
|
||||
session.send_string(long_command[0...(buffer_max_size - 1)])
|
||||
wait_for { session.content }.to eq(long_command)
|
||||
end
|
||||
|
||||
it 'is provided when the buffer is equal to the specified length' do
|
||||
session.send_string(long_command[0...(buffer_max_size)])
|
||||
wait_for { session.content }.to eq(long_command)
|
||||
end
|
||||
|
||||
it 'is not provided when the buffer is longer than the specified length'
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
describe 'a displayed suggestion' do
|
||||
it 'is shown in the default style'
|
||||
|
||||
describe 'when ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE is set to a zle_highlight string' do
|
||||
it 'is shown in the specified style'
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
describe 'an original zle widget' do
|
||||
context 'is accessible with the default prefix'
|
||||
|
||||
context 'when ZSH_AUTOSUGGEST_ORIGINAL_WIDGET_PREFIX is set' do
|
||||
it 'is accessible with the specified prefix'
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
describe 'a suggestion for a given prefix' do
|
||||
let(:history_strategy) { '_zsh_autosuggest_strategy_history() { suggestion="history" }' }
|
||||
let(:foobar_strategy) { '_zsh_autosuggest_strategy_foobar() { [[ "foobar baz" = $1* ]] && suggestion="foobar baz" }' }
|
||||
let(:foobaz_strategy) { '_zsh_autosuggest_strategy_foobaz() { [[ "foobaz bar" = $1* ]] && suggestion="foobaz bar" }' }
|
||||
|
||||
let(:after_sourcing) do
|
||||
-> do
|
||||
session.run_command(history_strategy)
|
||||
end
|
||||
end
|
||||
|
||||
it 'by default is determined by calling the `history` strategy function' do
|
||||
session.send_string('h')
|
||||
wait_for { session.content }.to eq('history')
|
||||
end
|
||||
|
||||
context 'when ZSH_AUTOSUGGEST_STRATEGY is set to an array' do
|
||||
let(:after_sourcing) do
|
||||
-> do
|
||||
session.
|
||||
run_command(foobar_strategy).
|
||||
run_command(foobaz_strategy).
|
||||
run_command('ZSH_AUTOSUGGEST_STRATEGY=(foobar foobaz)')
|
||||
end
|
||||
end
|
||||
|
||||
it 'is determined by the first strategy function to return a suggestion' do
|
||||
session.send_string('foo')
|
||||
wait_for { session.content }.to eq('foobar baz')
|
||||
|
||||
session.send_string('baz')
|
||||
wait_for { session.content }.to eq('foobaz bar')
|
||||
end
|
||||
end
|
||||
|
||||
context 'when ZSH_AUTOSUGGEST_STRATEGY is set to a string' do
|
||||
let(:after_sourcing) do
|
||||
-> do
|
||||
session.
|
||||
run_command(foobar_strategy).
|
||||
run_command(foobaz_strategy).
|
||||
run_command('ZSH_AUTOSUGGEST_STRATEGY="foobar foobaz"')
|
||||
end
|
||||
end
|
||||
|
||||
it 'is determined by the first strategy function to return a suggestion' do
|
||||
session.send_string('foo')
|
||||
wait_for { session.content }.to eq('foobar baz')
|
||||
|
||||
session.send_string('baz')
|
||||
wait_for { session.content }.to eq('foobaz bar')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -0,0 +1,121 @@
|
|||
describe 'a zle widget' do
|
||||
let(:widget) { 'my-widget' }
|
||||
let(:before_sourcing) { -> { session.run_command("#{widget}() {}; zle -N #{widget}; bindkey ^B #{widget}") } }
|
||||
|
||||
context 'when added to ZSH_AUTOSUGGEST_ACCEPT_WIDGETS' do
|
||||
let(:options) { ["ZSH_AUTOSUGGEST_ACCEPT_WIDGETS+=(#{widget})"] }
|
||||
|
||||
it 'accepts the suggestion and moves the cursor to the end of the buffer when invoked' do
|
||||
with_history('echo hello') do
|
||||
session.send_string('e')
|
||||
wait_for { session.content }.to eq('echo hello')
|
||||
session.send_keys('C-b')
|
||||
wait_for { session.content(esc_seqs: true) }.to eq('echo hello')
|
||||
wait_for { session.cursor }.to eq([10, 0])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'when added to ZSH_AUTOSUGGEST_CLEAR_WIDGETS' do
|
||||
let(:options) { ["ZSH_AUTOSUGGEST_CLEAR_WIDGETS+=(#{widget})"] }
|
||||
|
||||
it 'clears the suggestion when invoked' do
|
||||
with_history('echo hello') do
|
||||
session.send_string('e')
|
||||
wait_for { session.content }.to eq('echo hello')
|
||||
session.send_keys('C-b')
|
||||
wait_for { session.content }.to eq('e')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'when added to ZSH_AUTOSUGGEST_EXECUTE_WIDGETS' do
|
||||
let(:options) { ["ZSH_AUTOSUGGEST_EXECUTE_WIDGETS+=(#{widget})"] }
|
||||
|
||||
it 'executes the suggestion when invoked' do
|
||||
with_history('echo hello') do
|
||||
session.send_string('e')
|
||||
wait_for { session.content }.to eq('echo hello')
|
||||
session.send_keys('C-b')
|
||||
wait_for { session.content }.to end_with("\nhello")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'when added to ZSH_AUTOSUGGEST_IGNORE_WIDGETS' do
|
||||
let(:options) { ["ZSH_AUTOSUGGEST_IGNORE_WIDGETS=(#{widget})"] }
|
||||
|
||||
it 'should not be wrapped with an autosuggest widget' do
|
||||
session.run_command("echo $widgets[#{widget}]")
|
||||
wait_for { session.content }.to end_with("\nuser:#{widget}")
|
||||
end
|
||||
end
|
||||
|
||||
context 'that moves the cursor forward' do
|
||||
before { session.run_command("#{widget}() { zle forward-char }") }
|
||||
|
||||
context 'when added to ZSH_AUTOSUGGEST_PARTIAL_ACCEPT_WIDGETS' do
|
||||
let(:options) { ["ZSH_AUTOSUGGEST_PARTIAL_ACCEPT_WIDGETS=(#{widget})"] }
|
||||
|
||||
it 'accepts the suggestion as far as the cursor is moved when invoked' do
|
||||
with_history('echo hello') do
|
||||
session.send_string('e')
|
||||
wait_for { session.content }.to start_with('echo hello')
|
||||
session.send_keys('C-b')
|
||||
wait_for { session.content(esc_seqs: true) }.to match(/\Aec\e\[[0-9]+mho hello/)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'that modifies the buffer' do
|
||||
before { session.run_command("#{widget}() { BUFFER=\"foo\" }") }
|
||||
|
||||
context 'when not added to any of the widget lists' do
|
||||
it 'modifies the buffer and fetches a new suggestion' do
|
||||
with_history('foobar') do
|
||||
session.send_keys('C-b')
|
||||
wait_for { session.content }.to eq('foobar')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'a modification to the widget lists' do
|
||||
let(:widget) { 'my-widget' }
|
||||
let(:before_sourcing) { -> { session.run_command("#{widget}() {}; zle -N #{widget}; bindkey ^B #{widget}") } }
|
||||
before { session.run_command("ZSH_AUTOSUGGEST_ACCEPT_WIDGETS+=(#{widget})") }
|
||||
|
||||
it 'takes effect on the next cmd line' do
|
||||
with_history('echo hello') do
|
||||
session.send_string('e')
|
||||
wait_for { session.content }.to eq('echo hello')
|
||||
session.send_keys('C-b')
|
||||
wait_for { session.content(esc_seqs: true) }.to eq('echo hello')
|
||||
end
|
||||
end
|
||||
|
||||
context 'when manual rebind is enabled' do
|
||||
let(:options) { ["ZSH_AUTOSUGGEST_MANUAL_REBIND=true"] }
|
||||
|
||||
it 'does not take effect until bind command is re-run' do
|
||||
with_history('echo hello') do
|
||||
session.send_string('e')
|
||||
wait_for { session.content }.to eq('echo hello')
|
||||
session.send_keys('C-b')
|
||||
sleep 1
|
||||
expect(session.content(esc_seqs: true)).not_to eq('echo hello')
|
||||
|
||||
session.send_keys('C-c')
|
||||
session.run_command('_zsh_autosuggest_bind_widgets').clear_screen
|
||||
wait_for { session.content }.to eq('')
|
||||
|
||||
session.send_string('e')
|
||||
wait_for { session.content }.to eq('echo hello')
|
||||
session.send_keys('C-b')
|
||||
wait_for { session.content(esc_seqs: true) }.to eq('echo hello')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
54
config/zsh/plugins/zsh-autosuggestions/spec/spec_helper.rb
Normal file
54
config/zsh/plugins/zsh-autosuggestions/spec/spec_helper.rb
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
require 'pry'
|
||||
require 'rspec/wait'
|
||||
require 'terminal_session'
|
||||
require 'tempfile'
|
||||
|
||||
RSpec.shared_context 'terminal session' do
|
||||
let(:term_opts) { {} }
|
||||
let(:session) { TerminalSession.new(term_opts) }
|
||||
let(:before_sourcing) { -> {} }
|
||||
let(:after_sourcing) { -> {} }
|
||||
let(:options) { [] }
|
||||
|
||||
around do |example|
|
||||
before_sourcing.call
|
||||
session.run_command(['source zsh-autosuggestions.zsh', *options].join('; '))
|
||||
after_sourcing.call
|
||||
session.clear_screen
|
||||
|
||||
example.run
|
||||
|
||||
session.destroy
|
||||
end
|
||||
|
||||
def with_history(*commands, &block)
|
||||
Tempfile.create do |f|
|
||||
f.write(commands.map{|c| c.gsub("\n", "\\\n")}.join("\n"))
|
||||
f.flush
|
||||
|
||||
session.run_command('fc -p')
|
||||
session.run_command("fc -R #{f.path}")
|
||||
|
||||
session.clear_screen
|
||||
|
||||
yield block
|
||||
|
||||
session.send_keys('C-c')
|
||||
session.run_command('fc -P')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
RSpec.configure do |config|
|
||||
config.expect_with :rspec do |expectations|
|
||||
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
||||
end
|
||||
|
||||
config.mock_with :rspec do |mocks|
|
||||
mocks.verify_partial_doubles = true
|
||||
end
|
||||
|
||||
config.wait_timeout = 2
|
||||
|
||||
config.include_context 'terminal session'
|
||||
end
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
describe 'the `completion` suggestion strategy' do
|
||||
let(:options) { ['ZSH_AUTOSUGGEST_STRATEGY=completion'] }
|
||||
let(:before_sourcing) do
|
||||
-> do
|
||||
session.
|
||||
run_command('autoload compinit && compinit').
|
||||
run_command('_foo() { compadd bar; compadd bat }').
|
||||
run_command('_num() { compadd two; compadd three }').
|
||||
run_command('compdef _foo baz').
|
||||
run_command('compdef _num one')
|
||||
end
|
||||
end
|
||||
|
||||
it 'suggests the first completion result' do
|
||||
session.send_string('baz ')
|
||||
wait_for { session.content }.to eq('baz bar')
|
||||
end
|
||||
|
||||
it 'does not add extra carriage returns when prefix has a line feed' do
|
||||
skip '`stty` does not work inside zpty below zsh version 5.0.3' if session.zsh_version < Gem::Version.new('5.0.3')
|
||||
session.send_string('baz \\').send_keys('C-v', 'C-j')
|
||||
wait_for { session.content }.to eq("baz \\\nbar")
|
||||
end
|
||||
|
||||
context 'when `_complete` is aliased' do
|
||||
let(:before_sourcing) do
|
||||
-> do
|
||||
session.
|
||||
run_command('autoload compinit && compinit').
|
||||
run_command('_foo() { compadd bar; compadd bat }').
|
||||
run_command('compdef _foo baz').
|
||||
run_command('alias _complete=_complete')
|
||||
end
|
||||
end
|
||||
|
||||
it 'suggests the first completion result' do
|
||||
session.send_string('baz ')
|
||||
wait_for { session.content }.to eq('baz bar')
|
||||
end
|
||||
end
|
||||
|
||||
context 'when ZSH_AUTOSUGGEST_COMPLETION_IGNORE is set to a pattern' do
|
||||
let(:options) { ['ZSH_AUTOSUGGEST_STRATEGY=completion', 'ZSH_AUTOSUGGEST_COMPLETION_IGNORE="one *"'] }
|
||||
|
||||
it 'makes suggestions when the buffer does not match the pattern' do
|
||||
session.send_string('baz ')
|
||||
wait_for { session.content }.to eq('baz bar')
|
||||
end
|
||||
|
||||
it 'does not make suggestions when the buffer matches the pattern' do
|
||||
session.send_string('one t')
|
||||
sleep 1
|
||||
expect(session.content).to eq('one t')
|
||||
end
|
||||
end
|
||||
|
||||
context 'when async mode is enabled' do
|
||||
let(:options) { ['ZSH_AUTOSUGGEST_USE_ASYNC=true', 'ZSH_AUTOSUGGEST_STRATEGY=completion'] }
|
||||
|
||||
it 'suggests the first completion result' do
|
||||
session.send_string('baz ')
|
||||
wait_for { session.content }.to eq('baz bar')
|
||||
end
|
||||
|
||||
it 'does not add extra carriage returns when prefix has a line feed' do
|
||||
skip '`stty` does not work inside zpty below zsh version 5.0.3' if session.zsh_version < Gem::Version.new('5.0.3')
|
||||
session.send_string('baz \\').send_keys('C-v', 'C-j')
|
||||
wait_for { session.content }.to eq("baz \\\nbar")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
require 'strategies/special_characters_helper'
|
||||
|
||||
describe 'the `history` suggestion strategy' do
|
||||
it 'suggests the last matching history entry' do
|
||||
with_history('ls foo', 'ls bar', 'echo baz') do
|
||||
session.send_string('ls')
|
||||
wait_for { session.content }.to eq('ls bar')
|
||||
end
|
||||
end
|
||||
|
||||
context 'when ZSH_AUTOSUGGEST_HISTORY_IGNORE is set to a pattern' do
|
||||
let(:options) { ['ZSH_AUTOSUGGEST_HISTORY_IGNORE="* bar"'] }
|
||||
|
||||
it 'does not make suggestions that match the pattern' do
|
||||
with_history('ls foo', 'ls bar', 'echo baz') do
|
||||
session.send_string('ls')
|
||||
wait_for { session.content }.to eq('ls foo')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
include_examples 'special characters'
|
||||
end
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
require 'strategies/special_characters_helper'
|
||||
|
||||
describe 'the `match_prev_cmd` strategy' do
|
||||
let(:options) { ['ZSH_AUTOSUGGEST_STRATEGY=match_prev_cmd'] }
|
||||
|
||||
let(:history) { [
|
||||
'echo what',
|
||||
'ls foo',
|
||||
'echo what',
|
||||
'ls bar',
|
||||
'ls baz',
|
||||
'echo what'
|
||||
] }
|
||||
|
||||
it 'suggests the last matching history entry after the previous command' do
|
||||
with_history(*history) do
|
||||
session.send_string('ls')
|
||||
wait_for { session.content }.to eq('ls bar')
|
||||
end
|
||||
end
|
||||
|
||||
context 'when ZSH_AUTOSUGGEST_HISTORY_IGNORE is set to a pattern' do
|
||||
let(:options) { ['ZSH_AUTOSUGGEST_STRATEGY=match_prev_cmd', 'ZSH_AUTOSUGGEST_HISTORY_IGNORE="* bar"'] }
|
||||
|
||||
it 'does not make suggestions that match the pattern' do
|
||||
with_history(*history) do
|
||||
session.send_string('ls')
|
||||
wait_for { session.content }.to eq('ls foo')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
include_examples 'special characters'
|
||||
end
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
shared_examples 'special characters' do
|
||||
describe 'a special character in the buffer should be treated like any other character' do
|
||||
it 'asterisk' do
|
||||
with_history('echo "hello*"', 'echo "hello."') do
|
||||
session.send_string('echo "hello*')
|
||||
wait_for { session.content }.to eq('echo "hello*"')
|
||||
end
|
||||
end
|
||||
|
||||
it 'question mark' do
|
||||
with_history('echo "hello?"', 'echo "hello."') do
|
||||
session.send_string('echo "hello?')
|
||||
wait_for { session.content }.to eq('echo "hello?"')
|
||||
end
|
||||
end
|
||||
|
||||
it 'backslash' do
|
||||
with_history('echo "hello\nworld"') do
|
||||
session.send_string('echo "hello\\')
|
||||
wait_for { session.content }.to eq('echo "hello\nworld"')
|
||||
end
|
||||
end
|
||||
|
||||
it 'double backslash' do
|
||||
with_history('echo "\\\\"') do
|
||||
session.send_string('echo "\\\\')
|
||||
wait_for { session.content }.to eq('echo "\\\\"')
|
||||
end
|
||||
end
|
||||
|
||||
it 'tilde' do
|
||||
with_history('echo ~/foo') do
|
||||
session.send_string('echo ~')
|
||||
wait_for { session.content }.to eq('echo ~/foo')
|
||||
end
|
||||
end
|
||||
|
||||
it 'parentheses' do
|
||||
with_history('echo "$(ls foo)"') do
|
||||
session.send_string('echo "$(')
|
||||
wait_for { session.content }.to eq('echo "$(ls foo)"')
|
||||
end
|
||||
end
|
||||
|
||||
it 'square bracket' do
|
||||
with_history('echo "$history[123]"') do
|
||||
session.send_string('echo "$history[')
|
||||
wait_for { session.content }.to eq('echo "$history[123]"')
|
||||
session.send_string('123]')
|
||||
wait_for { session.content }.to eq('echo "$history[123]"')
|
||||
end
|
||||
end
|
||||
|
||||
it 'octothorpe' do
|
||||
with_history('echo "#yolo"') do
|
||||
session.send_string('echo "#')
|
||||
wait_for { session.content }.to eq('echo "#yolo"')
|
||||
end
|
||||
end
|
||||
|
||||
it 'caret' do
|
||||
with_history('echo "^A"', 'echo "^B"') do
|
||||
session.send_string('echo "^A')
|
||||
wait_for { session.content }.to eq('echo "^A"')
|
||||
end
|
||||
end
|
||||
|
||||
it 'dash' do
|
||||
with_history('-foo() {}') do
|
||||
session.send_string('-')
|
||||
wait_for { session.content }.to eq('-foo() {}')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,99 @@
|
|||
require 'securerandom'
|
||||
|
||||
class TerminalSession
|
||||
ZSH_BIN = ENV['TEST_ZSH_BIN'] || 'zsh'
|
||||
|
||||
def initialize(opts = {})
|
||||
opts = {
|
||||
width: 80,
|
||||
height: 24,
|
||||
prompt: '',
|
||||
term: 'xterm-256color',
|
||||
zsh_bin: ZSH_BIN
|
||||
}.merge(opts)
|
||||
|
||||
@opts = opts
|
||||
|
||||
cmd="PS1=\"#{opts[:prompt]}\" TERM=#{opts[:term]} #{ZSH_BIN} -f"
|
||||
tmux_command("new-session -d -x #{opts[:width]} -y #{opts[:height]} '#{cmd}'")
|
||||
end
|
||||
|
||||
def zsh_version
|
||||
@zsh_version ||= Gem::Version.new(`#{ZSH_BIN} -c 'echo -n $ZSH_VERSION'`)
|
||||
end
|
||||
|
||||
def tmux_socket_name
|
||||
@tmux_socket_name ||= SecureRandom.hex(6)
|
||||
end
|
||||
|
||||
def run_command(command)
|
||||
send_string(command)
|
||||
send_keys('enter')
|
||||
|
||||
self
|
||||
end
|
||||
|
||||
def send_string(str)
|
||||
tmux_command("send-keys -t 0 -l -- '#{str.gsub("'", "\\'")}'")
|
||||
|
||||
self
|
||||
end
|
||||
|
||||
def send_keys(*keys)
|
||||
tmux_command("send-keys -t 0 #{keys.join(' ')}")
|
||||
|
||||
self
|
||||
end
|
||||
|
||||
def paste_string(str)
|
||||
tmux_command("set-buffer -- '#{str}'")
|
||||
tmux_command("paste-buffer -dpr -t 0")
|
||||
|
||||
self
|
||||
end
|
||||
|
||||
def content(esc_seqs: false)
|
||||
cmd = 'capture-pane -p -t 0'
|
||||
cmd += ' -e' if esc_seqs
|
||||
tmux_command(cmd).strip
|
||||
end
|
||||
|
||||
def clear_screen
|
||||
send_keys('C-l')
|
||||
|
||||
i = 0
|
||||
until content == opts[:prompt] || i > 20 do
|
||||
sleep(0.1)
|
||||
i = i + 1
|
||||
end
|
||||
|
||||
self
|
||||
end
|
||||
|
||||
def destroy
|
||||
tmux_command('kill-session')
|
||||
end
|
||||
|
||||
def cursor
|
||||
tmux_command("display-message -t 0 -p '\#{cursor_x},\#{cursor_y}'").
|
||||
strip.
|
||||
split(',').
|
||||
map(&:to_i)
|
||||
end
|
||||
|
||||
def attach!
|
||||
tmux_command('attach-session')
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
attr_reader :opts
|
||||
|
||||
def tmux_command(cmd)
|
||||
out = `tmux -u -L #{tmux_socket_name} #{cmd}`
|
||||
|
||||
raise("tmux error running: '#{cmd}'") unless $?.success?
|
||||
|
||||
out
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
describe 'the `autosuggest-disable` widget' do
|
||||
before do
|
||||
session.run_command('bindkey ^B autosuggest-disable')
|
||||
end
|
||||
|
||||
it 'disables suggestions and clears the suggestion' do
|
||||
with_history('echo hello') do
|
||||
session.send_string('echo')
|
||||
wait_for { session.content }.to eq('echo hello')
|
||||
|
||||
session.send_keys('C-b')
|
||||
wait_for { session.content }.to eq('echo')
|
||||
|
||||
session.send_string(' h')
|
||||
sleep 1
|
||||
expect(session.content).to eq('echo h')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
describe 'the `autosuggest-enable` widget' do
|
||||
before do
|
||||
session.
|
||||
run_command('typeset -g _ZSH_AUTOSUGGEST_DISABLED').
|
||||
run_command('bindkey ^B autosuggest-enable')
|
||||
end
|
||||
|
||||
it 'enables suggestions and fetches a suggestion' do
|
||||
with_history('echo hello') do
|
||||
session.send_string('e')
|
||||
sleep 1
|
||||
expect(session.content).to eq('e')
|
||||
|
||||
session.send_keys('C-b')
|
||||
session.send_string('c')
|
||||
wait_for { session.content }.to eq('echo hello')
|
||||
end
|
||||
end
|
||||
|
||||
context 'invoked on an empty buffer' do
|
||||
it 'does not fetch a suggestion' do
|
||||
with_history('echo hello') do
|
||||
session.send_keys('C-b')
|
||||
sleep 1
|
||||
expect(session.content).to eq('')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'invoked on a non-empty buffer' do
|
||||
it 'fetches a suggestion' do
|
||||
with_history('echo hello') do
|
||||
session.send_string('e')
|
||||
sleep 1
|
||||
expect(session.content).to eq('e')
|
||||
|
||||
session.send_keys('C-b')
|
||||
wait_for { session.content }.to eq('echo hello')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
describe 'the `autosuggest-fetch` widget' do
|
||||
context 'when suggestions are disabled' do
|
||||
before do
|
||||
session.
|
||||
run_command('bindkey ^B autosuggest-disable').
|
||||
run_command('bindkey ^F autosuggest-fetch').
|
||||
send_keys('C-b')
|
||||
end
|
||||
|
||||
it 'will fetch and display a suggestion' do
|
||||
with_history('echo hello') do
|
||||
session.send_string('echo h')
|
||||
sleep 1
|
||||
expect(session.content).to eq('echo h')
|
||||
|
||||
session.send_keys('C-f')
|
||||
wait_for { session.content }.to eq('echo hello')
|
||||
|
||||
session.send_string('e')
|
||||
wait_for { session.content }.to eq('echo hello')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
describe 'the `autosuggest-toggle` widget' do
|
||||
before do
|
||||
session.run_command('bindkey ^B autosuggest-toggle')
|
||||
end
|
||||
|
||||
it 'toggles suggestions' do
|
||||
with_history('echo world', 'echo hello') do
|
||||
session.send_string('echo')
|
||||
wait_for { session.content }.to eq('echo hello')
|
||||
|
||||
session.send_keys('C-b')
|
||||
wait_for { session.content }.to eq('echo')
|
||||
|
||||
session.send_string(' h')
|
||||
sleep 1
|
||||
expect(session.content).to eq('echo h')
|
||||
|
||||
session.send_keys('C-b')
|
||||
wait_for { session.content }.to eq('echo hello')
|
||||
|
||||
session.send_keys('C-h')
|
||||
session.send_string('w')
|
||||
wait_for { session.content }.to eq('echo world')
|
||||
end
|
||||
end
|
||||
end
|
||||
77
config/zsh/plugins/zsh-autosuggestions/src/async.zsh
Normal file
77
config/zsh/plugins/zsh-autosuggestions/src/async.zsh
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
|
||||
#--------------------------------------------------------------------#
|
||||
# Async #
|
||||
#--------------------------------------------------------------------#
|
||||
|
||||
_zsh_autosuggest_async_request() {
|
||||
zmodload zsh/system 2>/dev/null # For `$sysparams`
|
||||
|
||||
typeset -g _ZSH_AUTOSUGGEST_ASYNC_FD _ZSH_AUTOSUGGEST_CHILD_PID
|
||||
|
||||
# If we've got a pending request, cancel it
|
||||
if [[ -n "$_ZSH_AUTOSUGGEST_ASYNC_FD" ]] && { true <&$_ZSH_AUTOSUGGEST_ASYNC_FD } 2>/dev/null; then
|
||||
# Close the file descriptor and remove the handler
|
||||
builtin exec {_ZSH_AUTOSUGGEST_ASYNC_FD}<&-
|
||||
zle -F $_ZSH_AUTOSUGGEST_ASYNC_FD
|
||||
|
||||
# We won't know the pid unless the user has zsh/system module installed
|
||||
if [[ -n "$_ZSH_AUTOSUGGEST_CHILD_PID" ]]; then
|
||||
# Zsh will make a new process group for the child process only if job
|
||||
# control is enabled (MONITOR option)
|
||||
if [[ -o MONITOR ]]; then
|
||||
# Send the signal to the process group to kill any processes that may
|
||||
# have been forked by the suggestion strategy
|
||||
kill -TERM -$_ZSH_AUTOSUGGEST_CHILD_PID 2>/dev/null
|
||||
else
|
||||
# Kill just the child process since it wasn't placed in a new process
|
||||
# group. If the suggestion strategy forked any child processes they may
|
||||
# be orphaned and left behind.
|
||||
kill -TERM $_ZSH_AUTOSUGGEST_CHILD_PID 2>/dev/null
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Fork a process to fetch a suggestion and open a pipe to read from it
|
||||
builtin exec {_ZSH_AUTOSUGGEST_ASYNC_FD}< <(
|
||||
# Tell parent process our pid
|
||||
echo $sysparams[pid]
|
||||
|
||||
# Fetch and print the suggestion
|
||||
local suggestion
|
||||
_zsh_autosuggest_fetch_suggestion "$1"
|
||||
echo -nE "$suggestion"
|
||||
)
|
||||
|
||||
# There's a weird bug here where ^C stops working unless we force a fork
|
||||
# See https://github.com/zsh-users/zsh-autosuggestions/issues/364
|
||||
autoload -Uz is-at-least
|
||||
is-at-least 5.8 || command true
|
||||
|
||||
# Read the pid from the child process
|
||||
read _ZSH_AUTOSUGGEST_CHILD_PID <&$_ZSH_AUTOSUGGEST_ASYNC_FD
|
||||
|
||||
# When the fd is readable, call the response handler
|
||||
zle -F "$_ZSH_AUTOSUGGEST_ASYNC_FD" _zsh_autosuggest_async_response
|
||||
}
|
||||
|
||||
# Called when new data is ready to be read from the pipe
|
||||
# First arg will be fd ready for reading
|
||||
# Second arg will be passed in case of error
|
||||
_zsh_autosuggest_async_response() {
|
||||
emulate -L zsh
|
||||
|
||||
local suggestion
|
||||
|
||||
if [[ -z "$2" || "$2" == "hup" ]]; then
|
||||
# Read everything from the fd and give it as a suggestion
|
||||
IFS='' read -rd '' -u $1 suggestion
|
||||
zle autosuggest-suggest -- "$suggestion"
|
||||
|
||||
# Close the fd
|
||||
builtin exec {1}<&-
|
||||
fi
|
||||
|
||||
# Always remove the handler
|
||||
zle -F "$1"
|
||||
_ZSH_AUTOSUGGEST_ASYNC_FD=
|
||||
}
|
||||
106
config/zsh/plugins/zsh-autosuggestions/src/bind.zsh
Normal file
106
config/zsh/plugins/zsh-autosuggestions/src/bind.zsh
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
|
||||
#--------------------------------------------------------------------#
|
||||
# Widget Helpers #
|
||||
#--------------------------------------------------------------------#
|
||||
|
||||
_zsh_autosuggest_incr_bind_count() {
|
||||
typeset -gi bind_count=$((_ZSH_AUTOSUGGEST_BIND_COUNTS[$1]+1))
|
||||
_ZSH_AUTOSUGGEST_BIND_COUNTS[$1]=$bind_count
|
||||
}
|
||||
|
||||
# Bind a single widget to an autosuggest widget, saving a reference to the original widget
|
||||
_zsh_autosuggest_bind_widget() {
|
||||
typeset -gA _ZSH_AUTOSUGGEST_BIND_COUNTS
|
||||
|
||||
local widget=$1
|
||||
local autosuggest_action=$2
|
||||
local prefix=$ZSH_AUTOSUGGEST_ORIGINAL_WIDGET_PREFIX
|
||||
|
||||
local -i bind_count
|
||||
|
||||
# Save a reference to the original widget
|
||||
case $widgets[$widget] in
|
||||
# Already bound
|
||||
user:_zsh_autosuggest_(bound|orig)_*)
|
||||
bind_count=$((_ZSH_AUTOSUGGEST_BIND_COUNTS[$widget]))
|
||||
;;
|
||||
|
||||
# User-defined widget
|
||||
user:*)
|
||||
_zsh_autosuggest_incr_bind_count $widget
|
||||
zle -N $prefix$bind_count-$widget ${widgets[$widget]#*:}
|
||||
;;
|
||||
|
||||
# Built-in widget
|
||||
builtin)
|
||||
_zsh_autosuggest_incr_bind_count $widget
|
||||
eval "_zsh_autosuggest_orig_${(q)widget}() { zle .${(q)widget} }"
|
||||
zle -N $prefix$bind_count-$widget _zsh_autosuggest_orig_$widget
|
||||
;;
|
||||
|
||||
# Completion widget
|
||||
completion:*)
|
||||
_zsh_autosuggest_incr_bind_count $widget
|
||||
eval "zle -C $prefix$bind_count-${(q)widget} ${${(s.:.)widgets[$widget]}[2,3]}"
|
||||
;;
|
||||
esac
|
||||
|
||||
# Pass the original widget's name explicitly into the autosuggest
|
||||
# function. Use this passed in widget name to call the original
|
||||
# widget instead of relying on the $WIDGET variable being set
|
||||
# correctly. $WIDGET cannot be trusted because other plugins call
|
||||
# zle without the `-w` flag (e.g. `zle self-insert` instead of
|
||||
# `zle self-insert -w`).
|
||||
eval "_zsh_autosuggest_bound_${bind_count}_${(q)widget}() {
|
||||
_zsh_autosuggest_widget_$autosuggest_action $prefix$bind_count-${(q)widget} \$@
|
||||
}"
|
||||
|
||||
# Create the bound widget
|
||||
zle -N -- $widget _zsh_autosuggest_bound_${bind_count}_$widget
|
||||
}
|
||||
|
||||
# Map all configured widgets to the right autosuggest widgets
|
||||
_zsh_autosuggest_bind_widgets() {
|
||||
emulate -L zsh
|
||||
|
||||
local widget
|
||||
local ignore_widgets
|
||||
|
||||
ignore_widgets=(
|
||||
.\*
|
||||
_\*
|
||||
${_ZSH_AUTOSUGGEST_BUILTIN_ACTIONS/#/autosuggest-}
|
||||
$ZSH_AUTOSUGGEST_ORIGINAL_WIDGET_PREFIX\*
|
||||
$ZSH_AUTOSUGGEST_IGNORE_WIDGETS
|
||||
)
|
||||
|
||||
# Find every widget we might want to bind and bind it appropriately
|
||||
for widget in ${${(f)"$(builtin zle -la)"}:#${(j:|:)~ignore_widgets}}; do
|
||||
if [[ -n ${ZSH_AUTOSUGGEST_CLEAR_WIDGETS[(r)$widget]} ]]; then
|
||||
_zsh_autosuggest_bind_widget $widget clear
|
||||
elif [[ -n ${ZSH_AUTOSUGGEST_ACCEPT_WIDGETS[(r)$widget]} ]]; then
|
||||
_zsh_autosuggest_bind_widget $widget accept
|
||||
elif [[ -n ${ZSH_AUTOSUGGEST_EXECUTE_WIDGETS[(r)$widget]} ]]; then
|
||||
_zsh_autosuggest_bind_widget $widget execute
|
||||
elif [[ -n ${ZSH_AUTOSUGGEST_PARTIAL_ACCEPT_WIDGETS[(r)$widget]} ]]; then
|
||||
_zsh_autosuggest_bind_widget $widget partial_accept
|
||||
else
|
||||
# Assume any unspecified widget might modify the buffer
|
||||
_zsh_autosuggest_bind_widget $widget modify
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# Given the name of an original widget and args, invoke it, if it exists
|
||||
_zsh_autosuggest_invoke_original_widget() {
|
||||
# Do nothing unless called with at least one arg
|
||||
(( $# )) || return 0
|
||||
|
||||
local original_widget_name="$1"
|
||||
|
||||
shift
|
||||
|
||||
if (( ${+widgets[$original_widget_name]} )); then
|
||||
zle $original_widget_name -- $@
|
||||
fi
|
||||
}
|
||||
95
config/zsh/plugins/zsh-autosuggestions/src/config.zsh
Normal file
95
config/zsh/plugins/zsh-autosuggestions/src/config.zsh
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
|
||||
#--------------------------------------------------------------------#
|
||||
# Global Configuration Variables #
|
||||
#--------------------------------------------------------------------#
|
||||
|
||||
# Color to use when highlighting suggestion
|
||||
# Uses format of `region_highlight`
|
||||
# More info: http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Zle-Widgets
|
||||
(( ! ${+ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE} )) &&
|
||||
typeset -g ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=8'
|
||||
|
||||
# Prefix to use when saving original versions of bound widgets
|
||||
(( ! ${+ZSH_AUTOSUGGEST_ORIGINAL_WIDGET_PREFIX} )) &&
|
||||
typeset -g ZSH_AUTOSUGGEST_ORIGINAL_WIDGET_PREFIX=autosuggest-orig-
|
||||
|
||||
# Strategies to use to fetch a suggestion
|
||||
# Will try each strategy in order until a suggestion is returned
|
||||
(( ! ${+ZSH_AUTOSUGGEST_STRATEGY} )) && {
|
||||
typeset -ga ZSH_AUTOSUGGEST_STRATEGY
|
||||
ZSH_AUTOSUGGEST_STRATEGY=(history)
|
||||
}
|
||||
|
||||
# Widgets that clear the suggestion
|
||||
(( ! ${+ZSH_AUTOSUGGEST_CLEAR_WIDGETS} )) && {
|
||||
typeset -ga ZSH_AUTOSUGGEST_CLEAR_WIDGETS
|
||||
ZSH_AUTOSUGGEST_CLEAR_WIDGETS=(
|
||||
history-search-forward
|
||||
history-search-backward
|
||||
history-beginning-search-forward
|
||||
history-beginning-search-backward
|
||||
history-beginning-search-forward-end
|
||||
history-beginning-search-backward-end
|
||||
history-substring-search-up
|
||||
history-substring-search-down
|
||||
up-line-or-beginning-search
|
||||
down-line-or-beginning-search
|
||||
up-line-or-history
|
||||
down-line-or-history
|
||||
accept-line
|
||||
copy-earlier-word
|
||||
)
|
||||
}
|
||||
|
||||
# Widgets that accept the entire suggestion
|
||||
(( ! ${+ZSH_AUTOSUGGEST_ACCEPT_WIDGETS} )) && {
|
||||
typeset -ga ZSH_AUTOSUGGEST_ACCEPT_WIDGETS
|
||||
ZSH_AUTOSUGGEST_ACCEPT_WIDGETS=(
|
||||
forward-char
|
||||
end-of-line
|
||||
vi-forward-char
|
||||
vi-end-of-line
|
||||
vi-add-eol
|
||||
)
|
||||
}
|
||||
|
||||
# Widgets that accept the entire suggestion and execute it
|
||||
(( ! ${+ZSH_AUTOSUGGEST_EXECUTE_WIDGETS} )) && {
|
||||
typeset -ga ZSH_AUTOSUGGEST_EXECUTE_WIDGETS
|
||||
ZSH_AUTOSUGGEST_EXECUTE_WIDGETS=(
|
||||
)
|
||||
}
|
||||
|
||||
# Widgets that accept the suggestion as far as the cursor moves
|
||||
(( ! ${+ZSH_AUTOSUGGEST_PARTIAL_ACCEPT_WIDGETS} )) && {
|
||||
typeset -ga ZSH_AUTOSUGGEST_PARTIAL_ACCEPT_WIDGETS
|
||||
ZSH_AUTOSUGGEST_PARTIAL_ACCEPT_WIDGETS=(
|
||||
forward-word
|
||||
emacs-forward-word
|
||||
vi-forward-word
|
||||
vi-forward-word-end
|
||||
vi-forward-blank-word
|
||||
vi-forward-blank-word-end
|
||||
vi-find-next-char
|
||||
vi-find-next-char-skip
|
||||
)
|
||||
}
|
||||
|
||||
# Widgets that should be ignored (globbing supported but must be escaped)
|
||||
(( ! ${+ZSH_AUTOSUGGEST_IGNORE_WIDGETS} )) && {
|
||||
typeset -ga ZSH_AUTOSUGGEST_IGNORE_WIDGETS
|
||||
ZSH_AUTOSUGGEST_IGNORE_WIDGETS=(
|
||||
orig-\*
|
||||
beep
|
||||
run-help
|
||||
set-local-history
|
||||
which-command
|
||||
yank
|
||||
yank-pop
|
||||
zle-\*
|
||||
)
|
||||
}
|
||||
|
||||
# Pty name for capturing completions for completion suggestion strategy
|
||||
(( ! ${+ZSH_AUTOSUGGEST_COMPLETIONS_PTY_NAME} )) &&
|
||||
typeset -g ZSH_AUTOSUGGEST_COMPLETIONS_PTY_NAME=zsh_autosuggest_completion_pty
|
||||
27
config/zsh/plugins/zsh-autosuggestions/src/fetch.zsh
Normal file
27
config/zsh/plugins/zsh-autosuggestions/src/fetch.zsh
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
|
||||
#--------------------------------------------------------------------#
|
||||
# Fetch Suggestion #
|
||||
#--------------------------------------------------------------------#
|
||||
# Loops through all specified strategies and returns a suggestion
|
||||
# from the first strategy to provide one.
|
||||
#
|
||||
|
||||
_zsh_autosuggest_fetch_suggestion() {
|
||||
typeset -g suggestion
|
||||
local -a strategies
|
||||
local strategy
|
||||
|
||||
# Ensure we are working with an array
|
||||
strategies=(${=ZSH_AUTOSUGGEST_STRATEGY})
|
||||
|
||||
for strategy in $strategies; do
|
||||
# Try to get a suggestion from this strategy
|
||||
_zsh_autosuggest_strategy_$strategy "$1"
|
||||
|
||||
# Ensure the suggestion matches the prefix
|
||||
[[ "$suggestion" != "$1"* ]] && unset suggestion
|
||||
|
||||
# Break once we've found a valid suggestion
|
||||
[[ -n "$suggestion" ]] && break
|
||||
done
|
||||
}
|
||||
26
config/zsh/plugins/zsh-autosuggestions/src/highlight.zsh
Normal file
26
config/zsh/plugins/zsh-autosuggestions/src/highlight.zsh
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
|
||||
#--------------------------------------------------------------------#
|
||||
# Highlighting #
|
||||
#--------------------------------------------------------------------#
|
||||
|
||||
# If there was a highlight, remove it
|
||||
_zsh_autosuggest_highlight_reset() {
|
||||
typeset -g _ZSH_AUTOSUGGEST_LAST_HIGHLIGHT
|
||||
|
||||
if [[ -n "$_ZSH_AUTOSUGGEST_LAST_HIGHLIGHT" ]]; then
|
||||
region_highlight=("${(@)region_highlight:#$_ZSH_AUTOSUGGEST_LAST_HIGHLIGHT}")
|
||||
unset _ZSH_AUTOSUGGEST_LAST_HIGHLIGHT
|
||||
fi
|
||||
}
|
||||
|
||||
# If there's a suggestion, highlight it
|
||||
_zsh_autosuggest_highlight_apply() {
|
||||
typeset -g _ZSH_AUTOSUGGEST_LAST_HIGHLIGHT
|
||||
|
||||
if (( $#POSTDISPLAY )); then
|
||||
typeset -g _ZSH_AUTOSUGGEST_LAST_HIGHLIGHT="$#BUFFER $(($#BUFFER + $#POSTDISPLAY)) $ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE"
|
||||
region_highlight+=("$_ZSH_AUTOSUGGEST_LAST_HIGHLIGHT")
|
||||
else
|
||||
unset _ZSH_AUTOSUGGEST_LAST_HIGHLIGHT
|
||||
fi
|
||||
}
|
||||
33
config/zsh/plugins/zsh-autosuggestions/src/start.zsh
Normal file
33
config/zsh/plugins/zsh-autosuggestions/src/start.zsh
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
|
||||
#--------------------------------------------------------------------#
|
||||
# Start #
|
||||
#--------------------------------------------------------------------#
|
||||
|
||||
# Start the autosuggestion widgets
|
||||
_zsh_autosuggest_start() {
|
||||
# By default we re-bind widgets on every precmd to ensure we wrap other
|
||||
# wrappers. Specifically, highlighting breaks if our widgets are wrapped by
|
||||
# zsh-syntax-highlighting widgets. This also allows modifications to the
|
||||
# widget list variables to take effect on the next precmd. However this has
|
||||
# a decent performance hit, so users can set ZSH_AUTOSUGGEST_MANUAL_REBIND
|
||||
# to disable the automatic re-binding.
|
||||
if (( ${+ZSH_AUTOSUGGEST_MANUAL_REBIND} )); then
|
||||
add-zsh-hook -d precmd _zsh_autosuggest_start
|
||||
fi
|
||||
|
||||
_zsh_autosuggest_bind_widgets
|
||||
}
|
||||
|
||||
# Mark for auto-loading the functions that we use
|
||||
autoload -Uz add-zsh-hook is-at-least
|
||||
|
||||
# Automatically enable asynchronous mode in newer versions of zsh. Disable for
|
||||
# older versions because there is a bug when using async mode where ^C does not
|
||||
# work immediately after fetching a suggestion.
|
||||
# See https://github.com/zsh-users/zsh-autosuggestions/issues/364
|
||||
if is-at-least 5.0.8; then
|
||||
typeset -g ZSH_AUTOSUGGEST_USE_ASYNC=
|
||||
fi
|
||||
|
||||
# Start the autosuggestion widgets on the next precmd
|
||||
add-zsh-hook precmd _zsh_autosuggest_start
|
||||
|
|
@ -0,0 +1,137 @@
|
|||
|
||||
#--------------------------------------------------------------------#
|
||||
# Completion Suggestion Strategy #
|
||||
#--------------------------------------------------------------------#
|
||||
# Fetches a suggestion from the completion engine
|
||||
#
|
||||
|
||||
_zsh_autosuggest_capture_postcompletion() {
|
||||
# Always insert the first completion into the buffer
|
||||
compstate[insert]=1
|
||||
|
||||
# Don't list completions
|
||||
unset 'compstate[list]'
|
||||
}
|
||||
|
||||
_zsh_autosuggest_capture_completion_widget() {
|
||||
# Add a post-completion hook to be called after all completions have been
|
||||
# gathered. The hook can modify compstate to affect what is done with the
|
||||
# gathered completions.
|
||||
local -a +h comppostfuncs
|
||||
comppostfuncs=(_zsh_autosuggest_capture_postcompletion)
|
||||
|
||||
# Only capture completions at the end of the buffer
|
||||
CURSOR=$#BUFFER
|
||||
|
||||
# Run the original widget wrapping `.complete-word` so we don't
|
||||
# recursively try to fetch suggestions, since our pty is forked
|
||||
# after autosuggestions is initialized.
|
||||
zle -- ${(k)widgets[(r)completion:.complete-word:_main_complete]}
|
||||
|
||||
if is-at-least 5.0.3; then
|
||||
# Don't do any cr/lf transformations. We need to do this immediately before
|
||||
# output because if we do it in setup, onlcr will be re-enabled when we enter
|
||||
# vared in the async code path. There is a bug in zpty module in older versions
|
||||
# where the tty is not properly attached to the pty slave, resulting in stty
|
||||
# getting stopped with a SIGTTOU. See zsh-workers thread 31660 and upstream
|
||||
# commit f75904a38
|
||||
stty -onlcr -ocrnl -F /dev/tty
|
||||
fi
|
||||
|
||||
# The completion has been added, print the buffer as the suggestion
|
||||
echo -nE - $'\0'$BUFFER$'\0'
|
||||
}
|
||||
|
||||
zle -N autosuggest-capture-completion _zsh_autosuggest_capture_completion_widget
|
||||
|
||||
_zsh_autosuggest_capture_setup() {
|
||||
# There is a bug in zpty module in older zsh versions by which a
|
||||
# zpty that exits will kill all zpty processes that were forked
|
||||
# before it. Here we set up a zsh exit hook to SIGKILL the zpty
|
||||
# process immediately, before it has a chance to kill any other
|
||||
# zpty processes.
|
||||
if ! is-at-least 5.4; then
|
||||
zshexit() {
|
||||
# The zsh builtin `kill` fails sometimes in older versions
|
||||
# https://unix.stackexchange.com/a/477647/156673
|
||||
kill -KILL $$ 2>&- || command kill -KILL $$
|
||||
|
||||
# Block for long enough for the signal to come through
|
||||
sleep 1
|
||||
}
|
||||
fi
|
||||
|
||||
# Try to avoid any suggestions that wouldn't match the prefix
|
||||
zstyle ':completion:*' matcher-list ''
|
||||
zstyle ':completion:*' path-completion false
|
||||
zstyle ':completion:*' max-errors 0 not-numeric
|
||||
|
||||
bindkey '^I' autosuggest-capture-completion
|
||||
}
|
||||
|
||||
_zsh_autosuggest_capture_completion_sync() {
|
||||
_zsh_autosuggest_capture_setup
|
||||
|
||||
zle autosuggest-capture-completion
|
||||
}
|
||||
|
||||
_zsh_autosuggest_capture_completion_async() {
|
||||
_zsh_autosuggest_capture_setup
|
||||
|
||||
zmodload zsh/parameter 2>/dev/null || return # For `$functions`
|
||||
|
||||
# Make vared completion work as if for a normal command line
|
||||
# https://stackoverflow.com/a/7057118/154703
|
||||
autoload +X _complete
|
||||
functions[_original_complete]=$functions[_complete]
|
||||
function _complete() {
|
||||
unset 'compstate[vared]'
|
||||
_original_complete "$@"
|
||||
}
|
||||
|
||||
# Open zle with buffer set so we can capture completions for it
|
||||
vared 1
|
||||
}
|
||||
|
||||
_zsh_autosuggest_strategy_completion() {
|
||||
# Reset options to defaults and enable LOCAL_OPTIONS
|
||||
emulate -L zsh
|
||||
|
||||
# Enable extended glob for completion ignore pattern
|
||||
setopt EXTENDED_GLOB
|
||||
|
||||
typeset -g suggestion
|
||||
local line REPLY
|
||||
|
||||
# Exit if we don't have completions
|
||||
whence compdef >/dev/null || return
|
||||
|
||||
# Exit if we don't have zpty
|
||||
zmodload zsh/zpty 2>/dev/null || return
|
||||
|
||||
# Exit if our search string matches the ignore pattern
|
||||
[[ -n "$ZSH_AUTOSUGGEST_COMPLETION_IGNORE" ]] && [[ "$1" == $~ZSH_AUTOSUGGEST_COMPLETION_IGNORE ]] && return
|
||||
|
||||
# Zle will be inactive if we are in async mode
|
||||
if zle; then
|
||||
zpty $ZSH_AUTOSUGGEST_COMPLETIONS_PTY_NAME _zsh_autosuggest_capture_completion_sync
|
||||
else
|
||||
zpty $ZSH_AUTOSUGGEST_COMPLETIONS_PTY_NAME _zsh_autosuggest_capture_completion_async "\$1"
|
||||
zpty -w $ZSH_AUTOSUGGEST_COMPLETIONS_PTY_NAME $'\t'
|
||||
fi
|
||||
|
||||
{
|
||||
# The completion result is surrounded by null bytes, so read the
|
||||
# content between the first two null bytes.
|
||||
zpty -r $ZSH_AUTOSUGGEST_COMPLETIONS_PTY_NAME line '*'$'\0''*'$'\0'
|
||||
|
||||
# Extract the suggestion from between the null bytes. On older
|
||||
# versions of zsh (older than 5.3), we sometimes get extra bytes after
|
||||
# the second null byte, so trim those off the end.
|
||||
# See http://www.zsh.org/mla/workers/2015/msg03290.html
|
||||
suggestion="${${(@0)line}[2]}"
|
||||
} always {
|
||||
# Destroy the pty
|
||||
zpty -d $ZSH_AUTOSUGGEST_COMPLETIONS_PTY_NAME
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
|
||||
#--------------------------------------------------------------------#
|
||||
# History Suggestion Strategy #
|
||||
#--------------------------------------------------------------------#
|
||||
# Suggests the most recent history item that matches the given
|
||||
# prefix.
|
||||
#
|
||||
|
||||
_zsh_autosuggest_strategy_history() {
|
||||
# Reset options to defaults and enable LOCAL_OPTIONS
|
||||
emulate -L zsh
|
||||
|
||||
# Enable globbing flags so that we can use (#m) and (x~y) glob operator
|
||||
setopt EXTENDED_GLOB
|
||||
|
||||
# Escape backslashes and all of the glob operators so we can use
|
||||
# this string as a pattern to search the $history associative array.
|
||||
# - (#m) globbing flag enables setting references for match data
|
||||
# TODO: Use (b) flag when we can drop support for zsh older than v5.0.8
|
||||
local prefix="${1//(#m)[\\*?[\]<>()|^~#]/\\$MATCH}"
|
||||
|
||||
# Get the history items that match the prefix, excluding those that match
|
||||
# the ignore pattern
|
||||
local pattern="$prefix*"
|
||||
if [[ -n $ZSH_AUTOSUGGEST_HISTORY_IGNORE ]]; then
|
||||
pattern="($pattern)~($ZSH_AUTOSUGGEST_HISTORY_IGNORE)"
|
||||
fi
|
||||
|
||||
# Give the first history item matching the pattern as the suggestion
|
||||
# - (r) subscript flag makes the pattern match on values
|
||||
typeset -g suggestion="${history[(r)$pattern]}"
|
||||
}
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
|
||||
#--------------------------------------------------------------------#
|
||||
# Match Previous Command Suggestion Strategy #
|
||||
#--------------------------------------------------------------------#
|
||||
# Suggests the most recent history item that matches the given
|
||||
# prefix and whose preceding history item also matches the most
|
||||
# recently executed command.
|
||||
#
|
||||
# For example, suppose your history has the following entries:
|
||||
# - pwd
|
||||
# - ls foo
|
||||
# - ls bar
|
||||
# - pwd
|
||||
#
|
||||
# Given the history list above, when you type 'ls', the suggestion
|
||||
# will be 'ls foo' rather than 'ls bar' because your most recently
|
||||
# executed command (pwd) was previously followed by 'ls foo'.
|
||||
#
|
||||
# Note that this strategy won't work as expected with ZSH options that don't
|
||||
# preserve the history order such as `HIST_IGNORE_ALL_DUPS` or
|
||||
# `HIST_EXPIRE_DUPS_FIRST`.
|
||||
|
||||
_zsh_autosuggest_strategy_match_prev_cmd() {
|
||||
# Reset options to defaults and enable LOCAL_OPTIONS
|
||||
emulate -L zsh
|
||||
|
||||
# Enable globbing flags so that we can use (#m) and (x~y) glob operator
|
||||
setopt EXTENDED_GLOB
|
||||
|
||||
# TODO: Use (b) flag when we can drop support for zsh older than v5.0.8
|
||||
local prefix="${1//(#m)[\\*?[\]<>()|^~#]/\\$MATCH}"
|
||||
|
||||
# Get the history items that match the prefix, excluding those that match
|
||||
# the ignore pattern
|
||||
local pattern="$prefix*"
|
||||
if [[ -n $ZSH_AUTOSUGGEST_HISTORY_IGNORE ]]; then
|
||||
pattern="($pattern)~($ZSH_AUTOSUGGEST_HISTORY_IGNORE)"
|
||||
fi
|
||||
|
||||
# Get all history event numbers that correspond to history
|
||||
# entries that match the pattern
|
||||
local history_match_keys
|
||||
history_match_keys=(${(k)history[(R)$~pattern]})
|
||||
|
||||
# By default we use the first history number (most recent history entry)
|
||||
local histkey="${history_match_keys[1]}"
|
||||
|
||||
# Get the previously executed command
|
||||
local prev_cmd="$(_zsh_autosuggest_escape_command "${history[$((HISTCMD-1))]}")"
|
||||
|
||||
# Iterate up to the first 200 history event numbers that match $prefix
|
||||
for key in "${(@)history_match_keys[1,200]}"; do
|
||||
# Stop if we ran out of history
|
||||
[[ $key -gt 1 ]] || break
|
||||
|
||||
# See if the history entry preceding the suggestion matches the
|
||||
# previous command, and use it if it does
|
||||
if [[ "${history[$((key - 1))]}" == "$prev_cmd" ]]; then
|
||||
histkey="$key"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
# Give back the matched history entry
|
||||
typeset -g suggestion="$history[$histkey]"
|
||||
}
|
||||
11
config/zsh/plugins/zsh-autosuggestions/src/util.zsh
Normal file
11
config/zsh/plugins/zsh-autosuggestions/src/util.zsh
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
|
||||
#--------------------------------------------------------------------#
|
||||
# Utility Functions #
|
||||
#--------------------------------------------------------------------#
|
||||
|
||||
_zsh_autosuggest_escape_command() {
|
||||
setopt localoptions EXTENDED_GLOB
|
||||
|
||||
# Escape special chars in the string (requires EXTENDED_GLOB)
|
||||
echo -E "${1//(#m)[\"\'\\()\[\]|*?~]/\\$MATCH}"
|
||||
}
|
||||
231
config/zsh/plugins/zsh-autosuggestions/src/widgets.zsh
Normal file
231
config/zsh/plugins/zsh-autosuggestions/src/widgets.zsh
Normal file
|
|
@ -0,0 +1,231 @@
|
|||
|
||||
#--------------------------------------------------------------------#
|
||||
# Autosuggest Widget Implementations #
|
||||
#--------------------------------------------------------------------#
|
||||
|
||||
# Disable suggestions
|
||||
_zsh_autosuggest_disable() {
|
||||
typeset -g _ZSH_AUTOSUGGEST_DISABLED
|
||||
_zsh_autosuggest_clear
|
||||
}
|
||||
|
||||
# Enable suggestions
|
||||
_zsh_autosuggest_enable() {
|
||||
unset _ZSH_AUTOSUGGEST_DISABLED
|
||||
|
||||
if (( $#BUFFER )); then
|
||||
_zsh_autosuggest_fetch
|
||||
fi
|
||||
}
|
||||
|
||||
# Toggle suggestions (enable/disable)
|
||||
_zsh_autosuggest_toggle() {
|
||||
if (( ${+_ZSH_AUTOSUGGEST_DISABLED} )); then
|
||||
_zsh_autosuggest_enable
|
||||
else
|
||||
_zsh_autosuggest_disable
|
||||
fi
|
||||
}
|
||||
|
||||
# Clear the suggestion
|
||||
_zsh_autosuggest_clear() {
|
||||
# Remove the suggestion
|
||||
POSTDISPLAY=
|
||||
|
||||
_zsh_autosuggest_invoke_original_widget $@
|
||||
}
|
||||
|
||||
# Modify the buffer and get a new suggestion
|
||||
_zsh_autosuggest_modify() {
|
||||
local -i retval
|
||||
|
||||
# Only available in zsh >= 5.4
|
||||
local -i KEYS_QUEUED_COUNT
|
||||
|
||||
# Save the contents of the buffer/postdisplay
|
||||
local orig_buffer="$BUFFER"
|
||||
local orig_postdisplay="$POSTDISPLAY"
|
||||
|
||||
# Clear suggestion while waiting for next one
|
||||
POSTDISPLAY=
|
||||
|
||||
# Original widget may modify the buffer
|
||||
_zsh_autosuggest_invoke_original_widget $@
|
||||
retval=$?
|
||||
|
||||
emulate -L zsh
|
||||
|
||||
# Don't fetch a new suggestion if there's more input to be read immediately
|
||||
if (( $PENDING > 0 || $KEYS_QUEUED_COUNT > 0 )); then
|
||||
POSTDISPLAY="$orig_postdisplay"
|
||||
return $retval
|
||||
fi
|
||||
|
||||
# Optimize if manually typing in the suggestion or if buffer hasn't changed
|
||||
if [[ "$BUFFER" = "$orig_buffer"* && "$orig_postdisplay" = "${BUFFER:$#orig_buffer}"* ]]; then
|
||||
POSTDISPLAY="${orig_postdisplay:$(($#BUFFER - $#orig_buffer))}"
|
||||
return $retval
|
||||
fi
|
||||
|
||||
# Bail out if suggestions are disabled
|
||||
if (( ${+_ZSH_AUTOSUGGEST_DISABLED} )); then
|
||||
return $?
|
||||
fi
|
||||
|
||||
# Get a new suggestion if the buffer is not empty after modification
|
||||
if (( $#BUFFER > 0 )); then
|
||||
if [[ -z "$ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE" ]] || (( $#BUFFER <= $ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE )); then
|
||||
_zsh_autosuggest_fetch
|
||||
fi
|
||||
fi
|
||||
|
||||
return $retval
|
||||
}
|
||||
|
||||
# Fetch a new suggestion based on what's currently in the buffer
|
||||
_zsh_autosuggest_fetch() {
|
||||
if (( ${+ZSH_AUTOSUGGEST_USE_ASYNC} )); then
|
||||
_zsh_autosuggest_async_request "$BUFFER"
|
||||
else
|
||||
local suggestion
|
||||
_zsh_autosuggest_fetch_suggestion "$BUFFER"
|
||||
_zsh_autosuggest_suggest "$suggestion"
|
||||
fi
|
||||
}
|
||||
|
||||
# Offer a suggestion
|
||||
_zsh_autosuggest_suggest() {
|
||||
emulate -L zsh
|
||||
|
||||
local suggestion="$1"
|
||||
|
||||
if [[ -n "$suggestion" ]] && (( $#BUFFER )); then
|
||||
POSTDISPLAY="${suggestion#$BUFFER}"
|
||||
else
|
||||
POSTDISPLAY=
|
||||
fi
|
||||
}
|
||||
|
||||
# Accept the entire suggestion
|
||||
_zsh_autosuggest_accept() {
|
||||
local -i retval max_cursor_pos=$#BUFFER
|
||||
|
||||
# When vicmd keymap is active, the cursor can't move all the way
|
||||
# to the end of the buffer
|
||||
if [[ "$KEYMAP" = "vicmd" ]]; then
|
||||
max_cursor_pos=$((max_cursor_pos - 1))
|
||||
fi
|
||||
|
||||
# If we're not in a valid state to accept a suggestion, just run the
|
||||
# original widget and bail out
|
||||
if (( $CURSOR != $max_cursor_pos || !$#POSTDISPLAY )); then
|
||||
_zsh_autosuggest_invoke_original_widget $@
|
||||
return
|
||||
fi
|
||||
|
||||
# Only accept if the cursor is at the end of the buffer
|
||||
# Add the suggestion to the buffer
|
||||
BUFFER="$BUFFER$POSTDISPLAY"
|
||||
|
||||
# Remove the suggestion
|
||||
POSTDISPLAY=
|
||||
|
||||
# Run the original widget before manually moving the cursor so that the
|
||||
# cursor movement doesn't make the widget do something unexpected
|
||||
_zsh_autosuggest_invoke_original_widget $@
|
||||
retval=$?
|
||||
|
||||
# Move the cursor to the end of the buffer
|
||||
if [[ "$KEYMAP" = "vicmd" ]]; then
|
||||
CURSOR=$(($#BUFFER - 1))
|
||||
else
|
||||
CURSOR=$#BUFFER
|
||||
fi
|
||||
|
||||
return $retval
|
||||
}
|
||||
|
||||
# Accept the entire suggestion and execute it
|
||||
_zsh_autosuggest_execute() {
|
||||
# Add the suggestion to the buffer
|
||||
BUFFER="$BUFFER$POSTDISPLAY"
|
||||
|
||||
# Remove the suggestion
|
||||
POSTDISPLAY=
|
||||
|
||||
# Call the original `accept-line` to handle syntax highlighting or
|
||||
# other potential custom behavior
|
||||
_zsh_autosuggest_invoke_original_widget "accept-line"
|
||||
}
|
||||
|
||||
# Partially accept the suggestion
|
||||
_zsh_autosuggest_partial_accept() {
|
||||
local -i retval cursor_loc
|
||||
|
||||
# Save the contents of the buffer so we can restore later if needed
|
||||
local original_buffer="$BUFFER"
|
||||
|
||||
# Temporarily accept the suggestion.
|
||||
BUFFER="$BUFFER$POSTDISPLAY"
|
||||
|
||||
# Original widget moves the cursor
|
||||
_zsh_autosuggest_invoke_original_widget $@
|
||||
retval=$?
|
||||
|
||||
# Normalize cursor location across vi/emacs modes
|
||||
cursor_loc=$CURSOR
|
||||
if [[ "$KEYMAP" = "vicmd" ]]; then
|
||||
cursor_loc=$((cursor_loc + 1))
|
||||
fi
|
||||
|
||||
# If we've moved past the end of the original buffer
|
||||
if (( $cursor_loc > $#original_buffer )); then
|
||||
# Set POSTDISPLAY to text right of the cursor
|
||||
POSTDISPLAY="${BUFFER[$(($cursor_loc + 1)),$#BUFFER]}"
|
||||
|
||||
# Clip the buffer at the cursor
|
||||
BUFFER="${BUFFER[1,$cursor_loc]}"
|
||||
else
|
||||
# Restore the original buffer
|
||||
BUFFER="$original_buffer"
|
||||
fi
|
||||
|
||||
return $retval
|
||||
}
|
||||
|
||||
() {
|
||||
typeset -ga _ZSH_AUTOSUGGEST_BUILTIN_ACTIONS
|
||||
|
||||
_ZSH_AUTOSUGGEST_BUILTIN_ACTIONS=(
|
||||
clear
|
||||
fetch
|
||||
suggest
|
||||
accept
|
||||
execute
|
||||
enable
|
||||
disable
|
||||
toggle
|
||||
)
|
||||
|
||||
local action
|
||||
for action in $_ZSH_AUTOSUGGEST_BUILTIN_ACTIONS modify partial_accept; do
|
||||
eval "_zsh_autosuggest_widget_$action() {
|
||||
local -i retval
|
||||
|
||||
_zsh_autosuggest_highlight_reset
|
||||
|
||||
_zsh_autosuggest_$action \$@
|
||||
retval=\$?
|
||||
|
||||
_zsh_autosuggest_highlight_apply
|
||||
|
||||
zle -R
|
||||
|
||||
return \$retval
|
||||
}"
|
||||
done
|
||||
|
||||
for action in $_ZSH_AUTOSUGGEST_BUILTIN_ACTIONS; do
|
||||
zle -N autosuggest-$action _zsh_autosuggest_widget_$action
|
||||
done
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
source ${0:A:h}/zsh-autosuggestions.zsh
|
||||
867
config/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
Normal file
867
config/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
Normal file
|
|
@ -0,0 +1,867 @@
|
|||
# Fish-like fast/unobtrusive autosuggestions for zsh.
|
||||
# https://github.com/zsh-users/zsh-autosuggestions
|
||||
# v0.7.1
|
||||
# Copyright (c) 2013 Thiago de Arruda
|
||||
# Copyright (c) 2016-2021 Eric Freese
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person
|
||||
# obtaining a copy of this software and associated documentation
|
||||
# files (the "Software"), to deal in the Software without
|
||||
# restriction, including without limitation the rights to use,
|
||||
# copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the
|
||||
# Software is furnished to do so, subject to the following
|
||||
# conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be
|
||||
# included in all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
# OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#--------------------------------------------------------------------#
|
||||
# Global Configuration Variables #
|
||||
#--------------------------------------------------------------------#
|
||||
|
||||
# Color to use when highlighting suggestion
|
||||
# Uses format of `region_highlight`
|
||||
# More info: http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Zle-Widgets
|
||||
(( ! ${+ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE} )) &&
|
||||
typeset -g ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=8'
|
||||
|
||||
# Prefix to use when saving original versions of bound widgets
|
||||
(( ! ${+ZSH_AUTOSUGGEST_ORIGINAL_WIDGET_PREFIX} )) &&
|
||||
typeset -g ZSH_AUTOSUGGEST_ORIGINAL_WIDGET_PREFIX=autosuggest-orig-
|
||||
|
||||
# Strategies to use to fetch a suggestion
|
||||
# Will try each strategy in order until a suggestion is returned
|
||||
(( ! ${+ZSH_AUTOSUGGEST_STRATEGY} )) && {
|
||||
typeset -ga ZSH_AUTOSUGGEST_STRATEGY
|
||||
ZSH_AUTOSUGGEST_STRATEGY=(history)
|
||||
}
|
||||
|
||||
# Widgets that clear the suggestion
|
||||
(( ! ${+ZSH_AUTOSUGGEST_CLEAR_WIDGETS} )) && {
|
||||
typeset -ga ZSH_AUTOSUGGEST_CLEAR_WIDGETS
|
||||
ZSH_AUTOSUGGEST_CLEAR_WIDGETS=(
|
||||
history-search-forward
|
||||
history-search-backward
|
||||
history-beginning-search-forward
|
||||
history-beginning-search-backward
|
||||
history-beginning-search-forward-end
|
||||
history-beginning-search-backward-end
|
||||
history-substring-search-up
|
||||
history-substring-search-down
|
||||
up-line-or-beginning-search
|
||||
down-line-or-beginning-search
|
||||
up-line-or-history
|
||||
down-line-or-history
|
||||
accept-line
|
||||
copy-earlier-word
|
||||
)
|
||||
}
|
||||
|
||||
# Widgets that accept the entire suggestion
|
||||
(( ! ${+ZSH_AUTOSUGGEST_ACCEPT_WIDGETS} )) && {
|
||||
typeset -ga ZSH_AUTOSUGGEST_ACCEPT_WIDGETS
|
||||
ZSH_AUTOSUGGEST_ACCEPT_WIDGETS=(
|
||||
forward-char
|
||||
end-of-line
|
||||
vi-forward-char
|
||||
vi-end-of-line
|
||||
vi-add-eol
|
||||
)
|
||||
}
|
||||
|
||||
# Widgets that accept the entire suggestion and execute it
|
||||
(( ! ${+ZSH_AUTOSUGGEST_EXECUTE_WIDGETS} )) && {
|
||||
typeset -ga ZSH_AUTOSUGGEST_EXECUTE_WIDGETS
|
||||
ZSH_AUTOSUGGEST_EXECUTE_WIDGETS=(
|
||||
)
|
||||
}
|
||||
|
||||
# Widgets that accept the suggestion as far as the cursor moves
|
||||
(( ! ${+ZSH_AUTOSUGGEST_PARTIAL_ACCEPT_WIDGETS} )) && {
|
||||
typeset -ga ZSH_AUTOSUGGEST_PARTIAL_ACCEPT_WIDGETS
|
||||
ZSH_AUTOSUGGEST_PARTIAL_ACCEPT_WIDGETS=(
|
||||
forward-word
|
||||
emacs-forward-word
|
||||
vi-forward-word
|
||||
vi-forward-word-end
|
||||
vi-forward-blank-word
|
||||
vi-forward-blank-word-end
|
||||
vi-find-next-char
|
||||
vi-find-next-char-skip
|
||||
)
|
||||
}
|
||||
|
||||
# Widgets that should be ignored (globbing supported but must be escaped)
|
||||
(( ! ${+ZSH_AUTOSUGGEST_IGNORE_WIDGETS} )) && {
|
||||
typeset -ga ZSH_AUTOSUGGEST_IGNORE_WIDGETS
|
||||
ZSH_AUTOSUGGEST_IGNORE_WIDGETS=(
|
||||
orig-\*
|
||||
beep
|
||||
run-help
|
||||
set-local-history
|
||||
which-command
|
||||
yank
|
||||
yank-pop
|
||||
zle-\*
|
||||
)
|
||||
}
|
||||
|
||||
# Pty name for capturing completions for completion suggestion strategy
|
||||
(( ! ${+ZSH_AUTOSUGGEST_COMPLETIONS_PTY_NAME} )) &&
|
||||
typeset -g ZSH_AUTOSUGGEST_COMPLETIONS_PTY_NAME=zsh_autosuggest_completion_pty
|
||||
|
||||
#--------------------------------------------------------------------#
|
||||
# Utility Functions #
|
||||
#--------------------------------------------------------------------#
|
||||
|
||||
_zsh_autosuggest_escape_command() {
|
||||
setopt localoptions EXTENDED_GLOB
|
||||
|
||||
# Escape special chars in the string (requires EXTENDED_GLOB)
|
||||
echo -E "${1//(#m)[\"\'\\()\[\]|*?~]/\\$MATCH}"
|
||||
}
|
||||
|
||||
#--------------------------------------------------------------------#
|
||||
# Widget Helpers #
|
||||
#--------------------------------------------------------------------#
|
||||
|
||||
_zsh_autosuggest_incr_bind_count() {
|
||||
typeset -gi bind_count=$((_ZSH_AUTOSUGGEST_BIND_COUNTS[$1]+1))
|
||||
_ZSH_AUTOSUGGEST_BIND_COUNTS[$1]=$bind_count
|
||||
}
|
||||
|
||||
# Bind a single widget to an autosuggest widget, saving a reference to the original widget
|
||||
_zsh_autosuggest_bind_widget() {
|
||||
typeset -gA _ZSH_AUTOSUGGEST_BIND_COUNTS
|
||||
|
||||
local widget=$1
|
||||
local autosuggest_action=$2
|
||||
local prefix=$ZSH_AUTOSUGGEST_ORIGINAL_WIDGET_PREFIX
|
||||
|
||||
local -i bind_count
|
||||
|
||||
# Save a reference to the original widget
|
||||
case $widgets[$widget] in
|
||||
# Already bound
|
||||
user:_zsh_autosuggest_(bound|orig)_*)
|
||||
bind_count=$((_ZSH_AUTOSUGGEST_BIND_COUNTS[$widget]))
|
||||
;;
|
||||
|
||||
# User-defined widget
|
||||
user:*)
|
||||
_zsh_autosuggest_incr_bind_count $widget
|
||||
zle -N $prefix$bind_count-$widget ${widgets[$widget]#*:}
|
||||
;;
|
||||
|
||||
# Built-in widget
|
||||
builtin)
|
||||
_zsh_autosuggest_incr_bind_count $widget
|
||||
eval "_zsh_autosuggest_orig_${(q)widget}() { zle .${(q)widget} }"
|
||||
zle -N $prefix$bind_count-$widget _zsh_autosuggest_orig_$widget
|
||||
;;
|
||||
|
||||
# Completion widget
|
||||
completion:*)
|
||||
_zsh_autosuggest_incr_bind_count $widget
|
||||
eval "zle -C $prefix$bind_count-${(q)widget} ${${(s.:.)widgets[$widget]}[2,3]}"
|
||||
;;
|
||||
esac
|
||||
|
||||
# Pass the original widget's name explicitly into the autosuggest
|
||||
# function. Use this passed in widget name to call the original
|
||||
# widget instead of relying on the $WIDGET variable being set
|
||||
# correctly. $WIDGET cannot be trusted because other plugins call
|
||||
# zle without the `-w` flag (e.g. `zle self-insert` instead of
|
||||
# `zle self-insert -w`).
|
||||
eval "_zsh_autosuggest_bound_${bind_count}_${(q)widget}() {
|
||||
_zsh_autosuggest_widget_$autosuggest_action $prefix$bind_count-${(q)widget} \$@
|
||||
}"
|
||||
|
||||
# Create the bound widget
|
||||
zle -N -- $widget _zsh_autosuggest_bound_${bind_count}_$widget
|
||||
}
|
||||
|
||||
# Map all configured widgets to the right autosuggest widgets
|
||||
_zsh_autosuggest_bind_widgets() {
|
||||
emulate -L zsh
|
||||
|
||||
local widget
|
||||
local ignore_widgets
|
||||
|
||||
ignore_widgets=(
|
||||
.\*
|
||||
_\*
|
||||
${_ZSH_AUTOSUGGEST_BUILTIN_ACTIONS/#/autosuggest-}
|
||||
$ZSH_AUTOSUGGEST_ORIGINAL_WIDGET_PREFIX\*
|
||||
$ZSH_AUTOSUGGEST_IGNORE_WIDGETS
|
||||
)
|
||||
|
||||
# Find every widget we might want to bind and bind it appropriately
|
||||
for widget in ${${(f)"$(builtin zle -la)"}:#${(j:|:)~ignore_widgets}}; do
|
||||
if [[ -n ${ZSH_AUTOSUGGEST_CLEAR_WIDGETS[(r)$widget]} ]]; then
|
||||
_zsh_autosuggest_bind_widget $widget clear
|
||||
elif [[ -n ${ZSH_AUTOSUGGEST_ACCEPT_WIDGETS[(r)$widget]} ]]; then
|
||||
_zsh_autosuggest_bind_widget $widget accept
|
||||
elif [[ -n ${ZSH_AUTOSUGGEST_EXECUTE_WIDGETS[(r)$widget]} ]]; then
|
||||
_zsh_autosuggest_bind_widget $widget execute
|
||||
elif [[ -n ${ZSH_AUTOSUGGEST_PARTIAL_ACCEPT_WIDGETS[(r)$widget]} ]]; then
|
||||
_zsh_autosuggest_bind_widget $widget partial_accept
|
||||
else
|
||||
# Assume any unspecified widget might modify the buffer
|
||||
_zsh_autosuggest_bind_widget $widget modify
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# Given the name of an original widget and args, invoke it, if it exists
|
||||
_zsh_autosuggest_invoke_original_widget() {
|
||||
# Do nothing unless called with at least one arg
|
||||
(( $# )) || return 0
|
||||
|
||||
local original_widget_name="$1"
|
||||
|
||||
shift
|
||||
|
||||
if (( ${+widgets[$original_widget_name]} )); then
|
||||
zle $original_widget_name -- $@
|
||||
fi
|
||||
}
|
||||
|
||||
#--------------------------------------------------------------------#
|
||||
# Highlighting #
|
||||
#--------------------------------------------------------------------#
|
||||
|
||||
# If there was a highlight, remove it
|
||||
_zsh_autosuggest_highlight_reset() {
|
||||
typeset -g _ZSH_AUTOSUGGEST_LAST_HIGHLIGHT
|
||||
|
||||
if [[ -n "$_ZSH_AUTOSUGGEST_LAST_HIGHLIGHT" ]]; then
|
||||
region_highlight=("${(@)region_highlight:#$_ZSH_AUTOSUGGEST_LAST_HIGHLIGHT}")
|
||||
unset _ZSH_AUTOSUGGEST_LAST_HIGHLIGHT
|
||||
fi
|
||||
}
|
||||
|
||||
# If there's a suggestion, highlight it
|
||||
_zsh_autosuggest_highlight_apply() {
|
||||
typeset -g _ZSH_AUTOSUGGEST_LAST_HIGHLIGHT
|
||||
|
||||
if (( $#POSTDISPLAY )); then
|
||||
typeset -g _ZSH_AUTOSUGGEST_LAST_HIGHLIGHT="$#BUFFER $(($#BUFFER + $#POSTDISPLAY)) $ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE"
|
||||
region_highlight+=("$_ZSH_AUTOSUGGEST_LAST_HIGHLIGHT")
|
||||
else
|
||||
unset _ZSH_AUTOSUGGEST_LAST_HIGHLIGHT
|
||||
fi
|
||||
}
|
||||
|
||||
#--------------------------------------------------------------------#
|
||||
# Autosuggest Widget Implementations #
|
||||
#--------------------------------------------------------------------#
|
||||
|
||||
# Disable suggestions
|
||||
_zsh_autosuggest_disable() {
|
||||
typeset -g _ZSH_AUTOSUGGEST_DISABLED
|
||||
_zsh_autosuggest_clear
|
||||
}
|
||||
|
||||
# Enable suggestions
|
||||
_zsh_autosuggest_enable() {
|
||||
unset _ZSH_AUTOSUGGEST_DISABLED
|
||||
|
||||
if (( $#BUFFER )); then
|
||||
_zsh_autosuggest_fetch
|
||||
fi
|
||||
}
|
||||
|
||||
# Toggle suggestions (enable/disable)
|
||||
_zsh_autosuggest_toggle() {
|
||||
if (( ${+_ZSH_AUTOSUGGEST_DISABLED} )); then
|
||||
_zsh_autosuggest_enable
|
||||
else
|
||||
_zsh_autosuggest_disable
|
||||
fi
|
||||
}
|
||||
|
||||
# Clear the suggestion
|
||||
_zsh_autosuggest_clear() {
|
||||
# Remove the suggestion
|
||||
POSTDISPLAY=
|
||||
|
||||
_zsh_autosuggest_invoke_original_widget $@
|
||||
}
|
||||
|
||||
# Modify the buffer and get a new suggestion
|
||||
_zsh_autosuggest_modify() {
|
||||
local -i retval
|
||||
|
||||
# Only available in zsh >= 5.4
|
||||
local -i KEYS_QUEUED_COUNT
|
||||
|
||||
# Save the contents of the buffer/postdisplay
|
||||
local orig_buffer="$BUFFER"
|
||||
local orig_postdisplay="$POSTDISPLAY"
|
||||
|
||||
# Clear suggestion while waiting for next one
|
||||
POSTDISPLAY=
|
||||
|
||||
# Original widget may modify the buffer
|
||||
_zsh_autosuggest_invoke_original_widget $@
|
||||
retval=$?
|
||||
|
||||
emulate -L zsh
|
||||
|
||||
# Don't fetch a new suggestion if there's more input to be read immediately
|
||||
if (( $PENDING > 0 || $KEYS_QUEUED_COUNT > 0 )); then
|
||||
POSTDISPLAY="$orig_postdisplay"
|
||||
return $retval
|
||||
fi
|
||||
|
||||
# Optimize if manually typing in the suggestion or if buffer hasn't changed
|
||||
if [[ "$BUFFER" = "$orig_buffer"* && "$orig_postdisplay" = "${BUFFER:$#orig_buffer}"* ]]; then
|
||||
POSTDISPLAY="${orig_postdisplay:$(($#BUFFER - $#orig_buffer))}"
|
||||
return $retval
|
||||
fi
|
||||
|
||||
# Bail out if suggestions are disabled
|
||||
if (( ${+_ZSH_AUTOSUGGEST_DISABLED} )); then
|
||||
return $?
|
||||
fi
|
||||
|
||||
# Get a new suggestion if the buffer is not empty after modification
|
||||
if (( $#BUFFER > 0 )); then
|
||||
if [[ -z "$ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE" ]] || (( $#BUFFER <= $ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE )); then
|
||||
_zsh_autosuggest_fetch
|
||||
fi
|
||||
fi
|
||||
|
||||
return $retval
|
||||
}
|
||||
|
||||
# Fetch a new suggestion based on what's currently in the buffer
|
||||
_zsh_autosuggest_fetch() {
|
||||
if (( ${+ZSH_AUTOSUGGEST_USE_ASYNC} )); then
|
||||
_zsh_autosuggest_async_request "$BUFFER"
|
||||
else
|
||||
local suggestion
|
||||
_zsh_autosuggest_fetch_suggestion "$BUFFER"
|
||||
_zsh_autosuggest_suggest "$suggestion"
|
||||
fi
|
||||
}
|
||||
|
||||
# Offer a suggestion
|
||||
_zsh_autosuggest_suggest() {
|
||||
emulate -L zsh
|
||||
|
||||
local suggestion="$1"
|
||||
|
||||
if [[ -n "$suggestion" ]] && (( $#BUFFER )); then
|
||||
POSTDISPLAY="${suggestion#$BUFFER}"
|
||||
else
|
||||
POSTDISPLAY=
|
||||
fi
|
||||
}
|
||||
|
||||
# Accept the entire suggestion
|
||||
_zsh_autosuggest_accept() {
|
||||
local -i retval max_cursor_pos=$#BUFFER
|
||||
|
||||
# When vicmd keymap is active, the cursor can't move all the way
|
||||
# to the end of the buffer
|
||||
if [[ "$KEYMAP" = "vicmd" ]]; then
|
||||
max_cursor_pos=$((max_cursor_pos - 1))
|
||||
fi
|
||||
|
||||
# If we're not in a valid state to accept a suggestion, just run the
|
||||
# original widget and bail out
|
||||
if (( $CURSOR != $max_cursor_pos || !$#POSTDISPLAY )); then
|
||||
_zsh_autosuggest_invoke_original_widget $@
|
||||
return
|
||||
fi
|
||||
|
||||
# Only accept if the cursor is at the end of the buffer
|
||||
# Add the suggestion to the buffer
|
||||
BUFFER="$BUFFER$POSTDISPLAY"
|
||||
|
||||
# Remove the suggestion
|
||||
POSTDISPLAY=
|
||||
|
||||
# Run the original widget before manually moving the cursor so that the
|
||||
# cursor movement doesn't make the widget do something unexpected
|
||||
_zsh_autosuggest_invoke_original_widget $@
|
||||
retval=$?
|
||||
|
||||
# Move the cursor to the end of the buffer
|
||||
if [[ "$KEYMAP" = "vicmd" ]]; then
|
||||
CURSOR=$(($#BUFFER - 1))
|
||||
else
|
||||
CURSOR=$#BUFFER
|
||||
fi
|
||||
|
||||
return $retval
|
||||
}
|
||||
|
||||
# Accept the entire suggestion and execute it
|
||||
_zsh_autosuggest_execute() {
|
||||
# Add the suggestion to the buffer
|
||||
BUFFER="$BUFFER$POSTDISPLAY"
|
||||
|
||||
# Remove the suggestion
|
||||
POSTDISPLAY=
|
||||
|
||||
# Call the original `accept-line` to handle syntax highlighting or
|
||||
# other potential custom behavior
|
||||
_zsh_autosuggest_invoke_original_widget "accept-line"
|
||||
}
|
||||
|
||||
# Partially accept the suggestion
|
||||
_zsh_autosuggest_partial_accept() {
|
||||
local -i retval cursor_loc
|
||||
|
||||
# Save the contents of the buffer so we can restore later if needed
|
||||
local original_buffer="$BUFFER"
|
||||
|
||||
# Temporarily accept the suggestion.
|
||||
BUFFER="$BUFFER$POSTDISPLAY"
|
||||
|
||||
# Original widget moves the cursor
|
||||
_zsh_autosuggest_invoke_original_widget $@
|
||||
retval=$?
|
||||
|
||||
# Normalize cursor location across vi/emacs modes
|
||||
cursor_loc=$CURSOR
|
||||
if [[ "$KEYMAP" = "vicmd" ]]; then
|
||||
cursor_loc=$((cursor_loc + 1))
|
||||
fi
|
||||
|
||||
# If we've moved past the end of the original buffer
|
||||
if (( $cursor_loc > $#original_buffer )); then
|
||||
# Set POSTDISPLAY to text right of the cursor
|
||||
POSTDISPLAY="${BUFFER[$(($cursor_loc + 1)),$#BUFFER]}"
|
||||
|
||||
# Clip the buffer at the cursor
|
||||
BUFFER="${BUFFER[1,$cursor_loc]}"
|
||||
else
|
||||
# Restore the original buffer
|
||||
BUFFER="$original_buffer"
|
||||
fi
|
||||
|
||||
return $retval
|
||||
}
|
||||
|
||||
() {
|
||||
typeset -ga _ZSH_AUTOSUGGEST_BUILTIN_ACTIONS
|
||||
|
||||
_ZSH_AUTOSUGGEST_BUILTIN_ACTIONS=(
|
||||
clear
|
||||
fetch
|
||||
suggest
|
||||
accept
|
||||
execute
|
||||
enable
|
||||
disable
|
||||
toggle
|
||||
)
|
||||
|
||||
local action
|
||||
for action in $_ZSH_AUTOSUGGEST_BUILTIN_ACTIONS modify partial_accept; do
|
||||
eval "_zsh_autosuggest_widget_$action() {
|
||||
local -i retval
|
||||
|
||||
_zsh_autosuggest_highlight_reset
|
||||
|
||||
_zsh_autosuggest_$action \$@
|
||||
retval=\$?
|
||||
|
||||
_zsh_autosuggest_highlight_apply
|
||||
|
||||
zle -R
|
||||
|
||||
return \$retval
|
||||
}"
|
||||
done
|
||||
|
||||
for action in $_ZSH_AUTOSUGGEST_BUILTIN_ACTIONS; do
|
||||
zle -N autosuggest-$action _zsh_autosuggest_widget_$action
|
||||
done
|
||||
}
|
||||
|
||||
#--------------------------------------------------------------------#
|
||||
# Completion Suggestion Strategy #
|
||||
#--------------------------------------------------------------------#
|
||||
# Fetches a suggestion from the completion engine
|
||||
#
|
||||
|
||||
_zsh_autosuggest_capture_postcompletion() {
|
||||
# Always insert the first completion into the buffer
|
||||
compstate[insert]=1
|
||||
|
||||
# Don't list completions
|
||||
unset 'compstate[list]'
|
||||
}
|
||||
|
||||
_zsh_autosuggest_capture_completion_widget() {
|
||||
# Add a post-completion hook to be called after all completions have been
|
||||
# gathered. The hook can modify compstate to affect what is done with the
|
||||
# gathered completions.
|
||||
local -a +h comppostfuncs
|
||||
comppostfuncs=(_zsh_autosuggest_capture_postcompletion)
|
||||
|
||||
# Only capture completions at the end of the buffer
|
||||
CURSOR=$#BUFFER
|
||||
|
||||
# Run the original widget wrapping `.complete-word` so we don't
|
||||
# recursively try to fetch suggestions, since our pty is forked
|
||||
# after autosuggestions is initialized.
|
||||
zle -- ${(k)widgets[(r)completion:.complete-word:_main_complete]}
|
||||
|
||||
if is-at-least 5.0.3; then
|
||||
# Don't do any cr/lf transformations. We need to do this immediately before
|
||||
# output because if we do it in setup, onlcr will be re-enabled when we enter
|
||||
# vared in the async code path. There is a bug in zpty module in older versions
|
||||
# where the tty is not properly attached to the pty slave, resulting in stty
|
||||
# getting stopped with a SIGTTOU. See zsh-workers thread 31660 and upstream
|
||||
# commit f75904a38
|
||||
stty -onlcr -ocrnl -F /dev/tty
|
||||
fi
|
||||
|
||||
# The completion has been added, print the buffer as the suggestion
|
||||
echo -nE - $'\0'$BUFFER$'\0'
|
||||
}
|
||||
|
||||
zle -N autosuggest-capture-completion _zsh_autosuggest_capture_completion_widget
|
||||
|
||||
_zsh_autosuggest_capture_setup() {
|
||||
# There is a bug in zpty module in older zsh versions by which a
|
||||
# zpty that exits will kill all zpty processes that were forked
|
||||
# before it. Here we set up a zsh exit hook to SIGKILL the zpty
|
||||
# process immediately, before it has a chance to kill any other
|
||||
# zpty processes.
|
||||
if ! is-at-least 5.4; then
|
||||
zshexit() {
|
||||
# The zsh builtin `kill` fails sometimes in older versions
|
||||
# https://unix.stackexchange.com/a/477647/156673
|
||||
kill -KILL $$ 2>&- || command kill -KILL $$
|
||||
|
||||
# Block for long enough for the signal to come through
|
||||
sleep 1
|
||||
}
|
||||
fi
|
||||
|
||||
# Try to avoid any suggestions that wouldn't match the prefix
|
||||
zstyle ':completion:*' matcher-list ''
|
||||
zstyle ':completion:*' path-completion false
|
||||
zstyle ':completion:*' max-errors 0 not-numeric
|
||||
|
||||
bindkey '^I' autosuggest-capture-completion
|
||||
}
|
||||
|
||||
_zsh_autosuggest_capture_completion_sync() {
|
||||
_zsh_autosuggest_capture_setup
|
||||
|
||||
zle autosuggest-capture-completion
|
||||
}
|
||||
|
||||
_zsh_autosuggest_capture_completion_async() {
|
||||
_zsh_autosuggest_capture_setup
|
||||
|
||||
zmodload zsh/parameter 2>/dev/null || return # For `$functions`
|
||||
|
||||
# Make vared completion work as if for a normal command line
|
||||
# https://stackoverflow.com/a/7057118/154703
|
||||
autoload +X _complete
|
||||
functions[_original_complete]=$functions[_complete]
|
||||
function _complete() {
|
||||
unset 'compstate[vared]'
|
||||
_original_complete "$@"
|
||||
}
|
||||
|
||||
# Open zle with buffer set so we can capture completions for it
|
||||
vared 1
|
||||
}
|
||||
|
||||
_zsh_autosuggest_strategy_completion() {
|
||||
# Reset options to defaults and enable LOCAL_OPTIONS
|
||||
emulate -L zsh
|
||||
|
||||
# Enable extended glob for completion ignore pattern
|
||||
setopt EXTENDED_GLOB
|
||||
|
||||
typeset -g suggestion
|
||||
local line REPLY
|
||||
|
||||
# Exit if we don't have completions
|
||||
whence compdef >/dev/null || return
|
||||
|
||||
# Exit if we don't have zpty
|
||||
zmodload zsh/zpty 2>/dev/null || return
|
||||
|
||||
# Exit if our search string matches the ignore pattern
|
||||
[[ -n "$ZSH_AUTOSUGGEST_COMPLETION_IGNORE" ]] && [[ "$1" == $~ZSH_AUTOSUGGEST_COMPLETION_IGNORE ]] && return
|
||||
|
||||
# Zle will be inactive if we are in async mode
|
||||
if zle; then
|
||||
zpty $ZSH_AUTOSUGGEST_COMPLETIONS_PTY_NAME _zsh_autosuggest_capture_completion_sync
|
||||
else
|
||||
zpty $ZSH_AUTOSUGGEST_COMPLETIONS_PTY_NAME _zsh_autosuggest_capture_completion_async "\$1"
|
||||
zpty -w $ZSH_AUTOSUGGEST_COMPLETIONS_PTY_NAME $'\t'
|
||||
fi
|
||||
|
||||
{
|
||||
# The completion result is surrounded by null bytes, so read the
|
||||
# content between the first two null bytes.
|
||||
zpty -r $ZSH_AUTOSUGGEST_COMPLETIONS_PTY_NAME line '*'$'\0''*'$'\0'
|
||||
|
||||
# Extract the suggestion from between the null bytes. On older
|
||||
# versions of zsh (older than 5.3), we sometimes get extra bytes after
|
||||
# the second null byte, so trim those off the end.
|
||||
# See http://www.zsh.org/mla/workers/2015/msg03290.html
|
||||
suggestion="${${(@0)line}[2]}"
|
||||
} always {
|
||||
# Destroy the pty
|
||||
zpty -d $ZSH_AUTOSUGGEST_COMPLETIONS_PTY_NAME
|
||||
}
|
||||
}
|
||||
|
||||
#--------------------------------------------------------------------#
|
||||
# History Suggestion Strategy #
|
||||
#--------------------------------------------------------------------#
|
||||
# Suggests the most recent history item that matches the given
|
||||
# prefix.
|
||||
#
|
||||
|
||||
_zsh_autosuggest_strategy_history() {
|
||||
# Reset options to defaults and enable LOCAL_OPTIONS
|
||||
emulate -L zsh
|
||||
|
||||
# Enable globbing flags so that we can use (#m) and (x~y) glob operator
|
||||
setopt EXTENDED_GLOB
|
||||
|
||||
# Escape backslashes and all of the glob operators so we can use
|
||||
# this string as a pattern to search the $history associative array.
|
||||
# - (#m) globbing flag enables setting references for match data
|
||||
# TODO: Use (b) flag when we can drop support for zsh older than v5.0.8
|
||||
local prefix="${1//(#m)[\\*?[\]<>()|^~#]/\\$MATCH}"
|
||||
|
||||
# Get the history items that match the prefix, excluding those that match
|
||||
# the ignore pattern
|
||||
local pattern="$prefix*"
|
||||
if [[ -n $ZSH_AUTOSUGGEST_HISTORY_IGNORE ]]; then
|
||||
pattern="($pattern)~($ZSH_AUTOSUGGEST_HISTORY_IGNORE)"
|
||||
fi
|
||||
|
||||
# Give the first history item matching the pattern as the suggestion
|
||||
# - (r) subscript flag makes the pattern match on values
|
||||
typeset -g suggestion="${history[(r)$pattern]}"
|
||||
}
|
||||
|
||||
#--------------------------------------------------------------------#
|
||||
# Match Previous Command Suggestion Strategy #
|
||||
#--------------------------------------------------------------------#
|
||||
# Suggests the most recent history item that matches the given
|
||||
# prefix and whose preceding history item also matches the most
|
||||
# recently executed command.
|
||||
#
|
||||
# For example, suppose your history has the following entries:
|
||||
# - pwd
|
||||
# - ls foo
|
||||
# - ls bar
|
||||
# - pwd
|
||||
#
|
||||
# Given the history list above, when you type 'ls', the suggestion
|
||||
# will be 'ls foo' rather than 'ls bar' because your most recently
|
||||
# executed command (pwd) was previously followed by 'ls foo'.
|
||||
#
|
||||
# Note that this strategy won't work as expected with ZSH options that don't
|
||||
# preserve the history order such as `HIST_IGNORE_ALL_DUPS` or
|
||||
# `HIST_EXPIRE_DUPS_FIRST`.
|
||||
|
||||
_zsh_autosuggest_strategy_match_prev_cmd() {
|
||||
# Reset options to defaults and enable LOCAL_OPTIONS
|
||||
emulate -L zsh
|
||||
|
||||
# Enable globbing flags so that we can use (#m) and (x~y) glob operator
|
||||
setopt EXTENDED_GLOB
|
||||
|
||||
# TODO: Use (b) flag when we can drop support for zsh older than v5.0.8
|
||||
local prefix="${1//(#m)[\\*?[\]<>()|^~#]/\\$MATCH}"
|
||||
|
||||
# Get the history items that match the prefix, excluding those that match
|
||||
# the ignore pattern
|
||||
local pattern="$prefix*"
|
||||
if [[ -n $ZSH_AUTOSUGGEST_HISTORY_IGNORE ]]; then
|
||||
pattern="($pattern)~($ZSH_AUTOSUGGEST_HISTORY_IGNORE)"
|
||||
fi
|
||||
|
||||
# Get all history event numbers that correspond to history
|
||||
# entries that match the pattern
|
||||
local history_match_keys
|
||||
history_match_keys=(${(k)history[(R)$~pattern]})
|
||||
|
||||
# By default we use the first history number (most recent history entry)
|
||||
local histkey="${history_match_keys[1]}"
|
||||
|
||||
# Get the previously executed command
|
||||
local prev_cmd="$(_zsh_autosuggest_escape_command "${history[$((HISTCMD-1))]}")"
|
||||
|
||||
# Iterate up to the first 200 history event numbers that match $prefix
|
||||
for key in "${(@)history_match_keys[1,200]}"; do
|
||||
# Stop if we ran out of history
|
||||
[[ $key -gt 1 ]] || break
|
||||
|
||||
# See if the history entry preceding the suggestion matches the
|
||||
# previous command, and use it if it does
|
||||
if [[ "${history[$((key - 1))]}" == "$prev_cmd" ]]; then
|
||||
histkey="$key"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
# Give back the matched history entry
|
||||
typeset -g suggestion="$history[$histkey]"
|
||||
}
|
||||
|
||||
#--------------------------------------------------------------------#
|
||||
# Fetch Suggestion #
|
||||
#--------------------------------------------------------------------#
|
||||
# Loops through all specified strategies and returns a suggestion
|
||||
# from the first strategy to provide one.
|
||||
#
|
||||
|
||||
_zsh_autosuggest_fetch_suggestion() {
|
||||
typeset -g suggestion
|
||||
local -a strategies
|
||||
local strategy
|
||||
|
||||
# Ensure we are working with an array
|
||||
strategies=(${=ZSH_AUTOSUGGEST_STRATEGY})
|
||||
|
||||
for strategy in $strategies; do
|
||||
# Try to get a suggestion from this strategy
|
||||
_zsh_autosuggest_strategy_$strategy "$1"
|
||||
|
||||
# Ensure the suggestion matches the prefix
|
||||
[[ "$suggestion" != "$1"* ]] && unset suggestion
|
||||
|
||||
# Break once we've found a valid suggestion
|
||||
[[ -n "$suggestion" ]] && break
|
||||
done
|
||||
}
|
||||
|
||||
#--------------------------------------------------------------------#
|
||||
# Async #
|
||||
#--------------------------------------------------------------------#
|
||||
|
||||
_zsh_autosuggest_async_request() {
|
||||
zmodload zsh/system 2>/dev/null # For `$sysparams`
|
||||
|
||||
typeset -g _ZSH_AUTOSUGGEST_ASYNC_FD _ZSH_AUTOSUGGEST_CHILD_PID
|
||||
|
||||
# If we've got a pending request, cancel it
|
||||
if [[ -n "$_ZSH_AUTOSUGGEST_ASYNC_FD" ]] && { true <&$_ZSH_AUTOSUGGEST_ASYNC_FD } 2>/dev/null; then
|
||||
# Close the file descriptor and remove the handler
|
||||
builtin exec {_ZSH_AUTOSUGGEST_ASYNC_FD}<&-
|
||||
zle -F $_ZSH_AUTOSUGGEST_ASYNC_FD
|
||||
|
||||
# We won't know the pid unless the user has zsh/system module installed
|
||||
if [[ -n "$_ZSH_AUTOSUGGEST_CHILD_PID" ]]; then
|
||||
# Zsh will make a new process group for the child process only if job
|
||||
# control is enabled (MONITOR option)
|
||||
if [[ -o MONITOR ]]; then
|
||||
# Send the signal to the process group to kill any processes that may
|
||||
# have been forked by the suggestion strategy
|
||||
kill -TERM -$_ZSH_AUTOSUGGEST_CHILD_PID 2>/dev/null
|
||||
else
|
||||
# Kill just the child process since it wasn't placed in a new process
|
||||
# group. If the suggestion strategy forked any child processes they may
|
||||
# be orphaned and left behind.
|
||||
kill -TERM $_ZSH_AUTOSUGGEST_CHILD_PID 2>/dev/null
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Fork a process to fetch a suggestion and open a pipe to read from it
|
||||
builtin exec {_ZSH_AUTOSUGGEST_ASYNC_FD}< <(
|
||||
# Tell parent process our pid
|
||||
echo $sysparams[pid]
|
||||
|
||||
# Fetch and print the suggestion
|
||||
local suggestion
|
||||
_zsh_autosuggest_fetch_suggestion "$1"
|
||||
echo -nE "$suggestion"
|
||||
)
|
||||
|
||||
# There's a weird bug here where ^C stops working unless we force a fork
|
||||
# See https://github.com/zsh-users/zsh-autosuggestions/issues/364
|
||||
autoload -Uz is-at-least
|
||||
is-at-least 5.8 || command true
|
||||
|
||||
# Read the pid from the child process
|
||||
read _ZSH_AUTOSUGGEST_CHILD_PID <&$_ZSH_AUTOSUGGEST_ASYNC_FD
|
||||
|
||||
# When the fd is readable, call the response handler
|
||||
zle -F "$_ZSH_AUTOSUGGEST_ASYNC_FD" _zsh_autosuggest_async_response
|
||||
}
|
||||
|
||||
# Called when new data is ready to be read from the pipe
|
||||
# First arg will be fd ready for reading
|
||||
# Second arg will be passed in case of error
|
||||
_zsh_autosuggest_async_response() {
|
||||
emulate -L zsh
|
||||
|
||||
local suggestion
|
||||
|
||||
if [[ -z "$2" || "$2" == "hup" ]]; then
|
||||
# Read everything from the fd and give it as a suggestion
|
||||
IFS='' read -rd '' -u $1 suggestion
|
||||
zle autosuggest-suggest -- "$suggestion"
|
||||
|
||||
# Close the fd
|
||||
builtin exec {1}<&-
|
||||
fi
|
||||
|
||||
# Always remove the handler
|
||||
zle -F "$1"
|
||||
_ZSH_AUTOSUGGEST_ASYNC_FD=
|
||||
}
|
||||
|
||||
#--------------------------------------------------------------------#
|
||||
# Start #
|
||||
#--------------------------------------------------------------------#
|
||||
|
||||
# Start the autosuggestion widgets
|
||||
_zsh_autosuggest_start() {
|
||||
# By default we re-bind widgets on every precmd to ensure we wrap other
|
||||
# wrappers. Specifically, highlighting breaks if our widgets are wrapped by
|
||||
# zsh-syntax-highlighting widgets. This also allows modifications to the
|
||||
# widget list variables to take effect on the next precmd. However this has
|
||||
# a decent performance hit, so users can set ZSH_AUTOSUGGEST_MANUAL_REBIND
|
||||
# to disable the automatic re-binding.
|
||||
if (( ${+ZSH_AUTOSUGGEST_MANUAL_REBIND} )); then
|
||||
add-zsh-hook -d precmd _zsh_autosuggest_start
|
||||
fi
|
||||
|
||||
_zsh_autosuggest_bind_widgets
|
||||
}
|
||||
|
||||
# Mark for auto-loading the functions that we use
|
||||
autoload -Uz add-zsh-hook is-at-least
|
||||
|
||||
# Automatically enable asynchronous mode in newer versions of zsh. Disable for
|
||||
# older versions because there is a bug when using async mode where ^C does not
|
||||
# work immediately after fetching a suggestion.
|
||||
# See https://github.com/zsh-users/zsh-autosuggestions/issues/364
|
||||
if is-at-least 5.0.8; then
|
||||
typeset -g ZSH_AUTOSUGGEST_USE_ASYNC=
|
||||
fi
|
||||
|
||||
# Start the autosuggestion widgets on the next precmd
|
||||
add-zsh-hook precmd _zsh_autosuggest_start
|
||||
21
config/zsh/plugins/zsh-bat/LICENSE
Normal file
21
config/zsh/plugins/zsh-bat/LICENSE
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2020 Fabian Dellwing
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
22
config/zsh/plugins/zsh-bat/README.md
Normal file
22
config/zsh/plugins/zsh-bat/README.md
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
# zsh-bat
|
||||
|
||||
[oh-my-zsh plugin](https://github.com/robbyrussell/oh-my-zsh) for easy integration with [bat](https://github.com/sharkdp/bat).
|
||||
|
||||
## Prerequisites
|
||||
|
||||
You should have `bat` installed, this plugin will do nothing otherwise.
|
||||
|
||||
## Install
|
||||
|
||||
Create a new directory in `$ZSH_CUSTOM/plugins` called `zsh-bat` and clone this repo into that directory.
|
||||
```
|
||||
git clone https://github.com/fdellwing/zsh-bat.git $ZSH_CUSTOM/plugins/zsh-bat
|
||||
```
|
||||
|
||||
Add `zsh-bat` to your plugin list in `~/.zshrc`.
|
||||
|
||||
## Usage
|
||||
|
||||
This plugin will replace `cat` with `bat`. To run the real `cat` command, you can use `rcat`. It will also enable syntax highlighting for the `man` command.
|
||||
|
||||
For usage help with `bat`, see [sharkdp/bat](https://github.com/sharkdp/bat).
|
||||
19
config/zsh/plugins/zsh-bat/zsh-bat.plugin.zsh
Normal file
19
config/zsh/plugins/zsh-bat/zsh-bat.plugin.zsh
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
|
||||
if command -v batcat >/dev/null 2>&1; then
|
||||
# Save the original system `cat` under `rcat`
|
||||
alias rcat="$(which cat)"
|
||||
|
||||
# For Ubuntu and Debian-based `bat` packages
|
||||
# the `bat` program is named `batcat` on these systems
|
||||
alias cat="$(which batcat)"
|
||||
export MANPAGER="sh -c 'col -bx | batcat -l man -p'"
|
||||
export MANROFFOPT="-c"
|
||||
elif command -v bat >/dev/null 2>&1; then
|
||||
# Save the original system `cat` under `rcat`
|
||||
alias rcat="$(which cat)"
|
||||
|
||||
# For all other systems
|
||||
alias cat="$(which bat)"
|
||||
export MANPAGER="sh -c 'col -bx | bat -l man -p'"
|
||||
export MANROFFOPT="-c"
|
||||
fi
|
||||
15
config/zsh/plugins/zsh-syntax-highlighting/.editorconfig
Normal file
15
config/zsh/plugins/zsh-syntax-highlighting/.editorconfig
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
# Top-most editorconfig file
|
||||
|
||||
root = true
|
||||
|
||||
[*]
|
||||
end_of_line = lf
|
||||
tab_width = 2
|
||||
indent_size = 2
|
||||
indent_style = space
|
||||
|
||||
[Makefile]
|
||||
tab_width = 8
|
||||
indent_size = 8
|
||||
indent_style = tab
|
||||
|
||||
1
config/zsh/plugins/zsh-syntax-highlighting/.gitattributes
vendored
Normal file
1
config/zsh/plugins/zsh-syntax-highlighting/.gitattributes
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
.revision-hash export-subst
|
||||
|
|
@ -0,0 +1 @@
|
|||
$Format:%H$
|
||||
1
config/zsh/plugins/zsh-syntax-highlighting/.version
Normal file
1
config/zsh/plugins/zsh-syntax-highlighting/.version
Normal file
|
|
@ -0,0 +1 @@
|
|||
0.8.1-dev
|
||||
23
config/zsh/plugins/zsh-syntax-highlighting/COPYING.md
Normal file
23
config/zsh/plugins/zsh-syntax-highlighting/COPYING.md
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
Copyright (c) 2010-2020 zsh-syntax-highlighting contributors
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted
|
||||
provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list of conditions
|
||||
and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this list of
|
||||
conditions and the following disclaimer in the documentation and/or other materials provided
|
||||
with the distribution.
|
||||
* Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
99
config/zsh/plugins/zsh-syntax-highlighting/HACKING.md
Normal file
99
config/zsh/plugins/zsh-syntax-highlighting/HACKING.md
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
Hacking on zsh-syntax-highlighting itself
|
||||
=========================================
|
||||
|
||||
This document includes information for people working on z-sy-h itself: on the
|
||||
core driver (`zsh-syntax-highlighting.zsh`), on the highlighters in the
|
||||
distribution, and on the test suite. It does not target third-party
|
||||
highlighter authors (although they may find it an interesting read).
|
||||
|
||||
The `main` highlighter
|
||||
----------------------
|
||||
|
||||
The following function `pz` is useful when working on the `main` highlighting:
|
||||
|
||||
```zsh
|
||||
pq() {
|
||||
(( $#argv )) || return 0
|
||||
print -r -l -- ${(qqqq)argv}
|
||||
}
|
||||
pz() {
|
||||
local arg
|
||||
for arg; do
|
||||
pq ${(z)arg}
|
||||
done
|
||||
}
|
||||
```
|
||||
|
||||
It prints, for each argument, its token breakdown, similar to how the main
|
||||
loop of the `main` highlighter sees it.
|
||||
|
||||
Testing the `brackets` highlighter
|
||||
----------------------------------
|
||||
|
||||
Since the test harness empties `ZSH_HIGHLIGHT_STYLES` and the `brackets`
|
||||
highlighter interrogates `ZSH_HIGHLIGHT_STYLES` to determine how to highlight,
|
||||
tests must set the `bracket-level-#` keys themselves. For example:
|
||||
|
||||
```zsh
|
||||
ZSH_HIGHLIGHT_STYLES[bracket-level-1]=
|
||||
ZSH_HIGHLIGHT_STYLES[bracket-level-2]=
|
||||
|
||||
BUFFER='echo ({x})'
|
||||
|
||||
expected_region_highlight=(
|
||||
"6 6 bracket-level-1" # (
|
||||
"7 7 bracket-level-2" # {
|
||||
"9 9 bracket-level-2" # }
|
||||
"10 10 bracket-level-1" # )
|
||||
)
|
||||
```
|
||||
|
||||
Testing the `pattern` and `regexp` highlighters
|
||||
-----------------------------------------------
|
||||
|
||||
Because the `pattern` and `regexp` highlighters modifies `region_highlight`
|
||||
directly instead of using `_zsh_highlight_add_highlight`, the test harness
|
||||
cannot get the `ZSH_HIGHLIGHT_STYLES` keys. Therefore, when writing tests, use
|
||||
the style itself as third word (cf. the
|
||||
[documentation for `expected_region_highlight`](docs/highlighters.md)). For example:
|
||||
|
||||
```zsh
|
||||
ZSH_HIGHLIGHT_PATTERNS+=('rm -rf *' 'fg=white,bold,bg=red')
|
||||
|
||||
BUFFER='rm -rf /'
|
||||
|
||||
expected_region_highlight=(
|
||||
"1 8 fg=white,bold,bg=red" # rm -rf /
|
||||
)
|
||||
```
|
||||
|
||||
Memos and commas
|
||||
----------------
|
||||
|
||||
We append to `region_highlight` as follows:
|
||||
|
||||
|
||||
```zsh
|
||||
region_highlight+=("$start $end $spec, memo=zsh-syntax-highlighting")
|
||||
```
|
||||
|
||||
That comma is required to cause zsh 5.8 and older to ignore the memo without
|
||||
ignoring the `$spec`. It's a hack, but given that no further 5.8.x patch
|
||||
releases are planned, it's been deemed acceptable. See issue #418 and the
|
||||
cross-referenced issues.
|
||||
|
||||
|
||||
Miscellany
|
||||
----------
|
||||
|
||||
If you work on the driver (`zsh-syntax-highlighting.zsh`), you may find the following zstyle useful:
|
||||
|
||||
```zsh
|
||||
zstyle ':completion:*:*:*:*:globbed-files' ignored-patterns {'*/',}zsh-syntax-highlighting.plugin.zsh
|
||||
```
|
||||
|
||||
IRC channel
|
||||
-----------
|
||||
|
||||
We're on #zsh-syntax-highlighting on Libera.Chat.
|
||||
|
||||
169
config/zsh/plugins/zsh-syntax-highlighting/INSTALL.md
Normal file
169
config/zsh/plugins/zsh-syntax-highlighting/INSTALL.md
Normal file
|
|
@ -0,0 +1,169 @@
|
|||
How to install
|
||||
--------------
|
||||
|
||||
### Using packages
|
||||
|
||||
First, install the package:
|
||||
|
||||
* Arch Linux: [community/zsh-syntax-highlighting][arch-package] / [AUR/zsh-syntax-highlighting-git][AUR-package]
|
||||
* Debian: `zsh-syntax-highlighting` package [in `stretch`][debian-package] (or in [OBS repository][obs-repository])
|
||||
* Fedora: [zsh-syntax-highlighting package][fedora-package-alt] in Fedora 24+ (or in [OBS repository][obs-repository])
|
||||
* FreeBSD: `pkg install zsh-syntax-highlighting` (port name: [`shells/zsh-syntax-highlighting`][freebsd-port])
|
||||
* Gentoo: [app-shells/zsh-syntax-highlighting][gentoo-repository]
|
||||
* Mac OS X / Homebrew: `brew install zsh-syntax-highlighting` ([formula][brew-package])
|
||||
* NetBSD: `pkg_add zsh-syntax-highlighting` (port name: [`shells/zsh-syntax-highlighting`][netbsd-port])
|
||||
* OpenBSD: `pkg_add zsh-syntax-highlighting` (port name: [`shells/zsh-syntax-highlighting`][openbsd-port])
|
||||
* openSUSE / SLE: `zsh-syntax-highlighting` package in [OBS repository][obs-repository]
|
||||
* RHEL / CentOS / Scientific Linux: `zsh-syntax-highlighting` package in [OBS repository][obs-repository]
|
||||
* Ubuntu: `zsh-syntax-highlighting` package [in Xenial][ubuntu-package] (or in [OBS repository][obs-repository])
|
||||
* Void Linux: `zsh-syntax-highlighting package` [in XBPS][void-package]
|
||||
|
||||
[arch-package]: https://www.archlinux.org/packages/zsh-syntax-highlighting
|
||||
[AUR-package]: https://aur.archlinux.org/packages/zsh-syntax-highlighting-git
|
||||
[brew-package]: https://github.com/Homebrew/homebrew-core/blob/master/Formula/z/zsh-syntax-highlighting.rb
|
||||
[debian-package]: https://packages.debian.org/zsh-syntax-highlighting
|
||||
[fedora-package]: https://apps.fedoraproject.org/packages/zsh-syntax-highlighting
|
||||
[fedora-package-alt]: https://bodhi.fedoraproject.org/updates/?packages=zsh-syntax-highlighting
|
||||
[freebsd-port]: https://www.freshports.org/textproc/zsh-syntax-highlighting/
|
||||
[gentoo-repository]: https://packages.gentoo.org/packages/app-shells/zsh-syntax-highlighting
|
||||
[netbsd-port]: http://cvsweb.netbsd.org/bsdweb.cgi/pkgsrc/shells/zsh-syntax-highlighting/
|
||||
[obs-repository]: https://software.opensuse.org/download.html?project=shells%3Azsh-users%3Azsh-syntax-highlighting&package=zsh-syntax-highlighting
|
||||
[openbsd-port]: https://cvsweb.openbsd.org/ports/shells/zsh-syntax-highlighting/
|
||||
[ubuntu-package]: https://launchpad.net/ubuntu/+source/zsh-syntax-highlighting
|
||||
[void-package]: https://github.com/void-linux/void-packages/tree/master/srcpkgs/zsh-syntax-highlighting
|
||||
|
||||
See also [repology's cross-distro index](https://repology.org/metapackage/zsh-syntax-highlighting/versions)
|
||||
|
||||
Second, enable zsh-syntax-highlighting by sourcing the script. Running this command on the terminal will add the source line to the end of your .zshrc:
|
||||
|
||||
* On most Linux distributions (except perhaps NixOS):
|
||||
|
||||
```zsh
|
||||
echo "source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ${ZDOTDIR:-$HOME}/.zshrc
|
||||
```
|
||||
|
||||
* NetBSD and OpenBSD:
|
||||
|
||||
```zsh
|
||||
echo "source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ${ZDOTDIR:-$HOME}/.zshrc
|
||||
```
|
||||
|
||||
* Mac OS X / Homebrew:
|
||||
|
||||
```zsh
|
||||
echo "source $(brew --prefix)/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ${ZDOTDIR:-$HOME}/.zshrc
|
||||
```
|
||||
|
||||
Then restart zsh (such as by opening a new instance of your terminal emulator).
|
||||
|
||||
Alternatively, add the `source` command manually **at the end** of your `.zshrc`:
|
||||
|
||||
* On most Linux distributions (except perhaps NixOS):
|
||||
`source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh`
|
||||
* NetBSD and OpenBSD:
|
||||
`source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh`
|
||||
|
||||
Then restart zsh.
|
||||
|
||||
### In your ~/.zshrc
|
||||
|
||||
Simply clone this repository and source the script:
|
||||
|
||||
```zsh
|
||||
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git
|
||||
echo "source ${(q-)PWD}/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ${ZDOTDIR:-$HOME}/.zshrc
|
||||
```
|
||||
|
||||
Then, enable syntax highlighting in the current interactive shell:
|
||||
|
||||
```zsh
|
||||
source ./zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
|
||||
```
|
||||
|
||||
If `git` is not installed, download and extract a snapshot of the latest
|
||||
development tree from:
|
||||
|
||||
```
|
||||
https://github.com/zsh-users/zsh-syntax-highlighting/archive/master.tar.gz
|
||||
```
|
||||
|
||||
Note the `source` command must be **at the end** of `~/.zshrc`.
|
||||
|
||||
|
||||
### With a plugin manager
|
||||
|
||||
Note that `zsh-syntax-highlighting` must be the last plugin sourced.
|
||||
|
||||
The zsh-syntax-highlighting authors recommend manual installation over the use
|
||||
of a framework or plugin manager.
|
||||
|
||||
This list is incomplete as there are too many
|
||||
[frameworks / plugin managers][framework-list] to list them all here.
|
||||
|
||||
[framework-list]: https://github.com/unixorn/awesome-zsh-plugins#frameworks
|
||||
|
||||
#### [Antigen](https://github.com/zsh-users/antigen)
|
||||
|
||||
Add `antigen bundle zsh-users/zsh-syntax-highlighting` as the last bundle in
|
||||
your `.zshrc`.
|
||||
|
||||
#### [Fig](https://fig.io)
|
||||
|
||||
Click the `Install Plugin` button on the [Fig plugin page][fig-plugin].
|
||||
|
||||
[fig-plugin]: https://fig.io/plugins/other/zsh-syntax-highlighting
|
||||
|
||||
#### [Oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh)
|
||||
|
||||
1. Clone this repository in oh-my-zsh's plugins directory:
|
||||
|
||||
```zsh
|
||||
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
|
||||
```
|
||||
|
||||
2. Activate the plugin in `~/.zshrc`:
|
||||
|
||||
```zsh
|
||||
plugins=( [plugins...] zsh-syntax-highlighting)
|
||||
```
|
||||
|
||||
3. Restart zsh (such as by opening a new instance of your terminal emulator).
|
||||
|
||||
#### [Prezto](https://github.com/sorin-ionescu/prezto)
|
||||
|
||||
Zsh-syntax-highlighting is included with Prezto. See the
|
||||
[Prezto documentation][prezto-docs] to enable and configure highlighters.
|
||||
|
||||
[prezto-docs]: https://github.com/sorin-ionescu/prezto/tree/master/modules/syntax-highlighting
|
||||
|
||||
#### [zgen](https://github.com/tarjoilija/zgen)
|
||||
|
||||
Add `zgen load zsh-users/zsh-syntax-highlighting` to the end of your `.zshrc`.
|
||||
|
||||
#### [zinit](https://github.com/zdharma-continuum/zinit)
|
||||
|
||||
Add `zinit light zsh-users/zsh-syntax-highlighting` to the end of your
|
||||
`.zshrc`.
|
||||
|
||||
#### [zplug](https://github.com/zplug/zplug)
|
||||
|
||||
Add `zplug "zsh-users/zsh-syntax-highlighting", defer:2` to your `.zshrc`.
|
||||
|
||||
|
||||
### System-wide installation
|
||||
|
||||
Any of the above methods is suitable for a single-user installation,
|
||||
which requires no special privileges. If, however, you desire to install
|
||||
zsh-syntax-highlighting system-wide, you may do so by running
|
||||
|
||||
```zsh
|
||||
make install
|
||||
```
|
||||
|
||||
and directing your users to add
|
||||
|
||||
```zsh
|
||||
source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
|
||||
```
|
||||
|
||||
to their `.zshrc`s.
|
||||
64
config/zsh/plugins/zsh-syntax-highlighting/Makefile
Normal file
64
config/zsh/plugins/zsh-syntax-highlighting/Makefile
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
NAME=zsh-syntax-highlighting
|
||||
|
||||
INSTALL?=install -c
|
||||
PREFIX?=/usr/local
|
||||
SHARE_DIR?=$(DESTDIR)$(PREFIX)/share/$(NAME)
|
||||
DOC_DIR?=$(DESTDIR)$(PREFIX)/share/doc/$(NAME)
|
||||
ZSH?=zsh # zsh binary to run tests with
|
||||
|
||||
all:
|
||||
cd docs && \
|
||||
cp highlighters.md all.md && \
|
||||
printf '\n\nIndividual highlighters documentation\n=====================================' >> all.md && \
|
||||
for doc in highlighters/*.md; do printf '\n\n'; cat "$$doc"; done >> all.md
|
||||
|
||||
install: all
|
||||
$(INSTALL) -d $(SHARE_DIR)
|
||||
$(INSTALL) -d $(DOC_DIR)
|
||||
cp .version zsh-syntax-highlighting.zsh $(SHARE_DIR)
|
||||
cp COPYING.md README.md changelog.md $(DOC_DIR)
|
||||
sed -e '1s/ .*//' -e '/^\[build-status-[a-z]*\]: /d' < README.md > $(DOC_DIR)/README.md
|
||||
if [ x"true" = x"`git rev-parse --is-inside-work-tree 2>/dev/null`" ]; then \
|
||||
git rev-parse HEAD; \
|
||||
else \
|
||||
cat .revision-hash; \
|
||||
fi > $(SHARE_DIR)/.revision-hash
|
||||
:
|
||||
# The [ -e ] check below is to because sh evaluates this with (the moral
|
||||
# equivalent of) NONOMATCH in effect, and highlighters/*.zsh has no matches.
|
||||
for dirname in highlighters highlighters/*/ ; do \
|
||||
$(INSTALL) -d $(SHARE_DIR)/"$$dirname"; \
|
||||
for fname in "$$dirname"/*.zsh ; do [ -e "$$fname" ] && cp "$$fname" $(SHARE_DIR)"/$$dirname"; done; \
|
||||
done
|
||||
cp -R docs/* $(DOC_DIR)
|
||||
|
||||
clean:
|
||||
rm -f docs/all.md
|
||||
|
||||
test:
|
||||
@$(ZSH) -fc 'echo ZSH_PATCHLEVEL=$$ZSH_PATCHLEVEL'
|
||||
@result=0; \
|
||||
for test in highlighters/*; do \
|
||||
if [ -d $$test/test-data ]; then \
|
||||
echo "Running test $${test##*/}"; \
|
||||
env -i QUIET=$$QUIET $${TERM:+"TERM=$$TERM"} $(ZSH) -f tests/test-highlighting.zsh "$${test##*/}"; \
|
||||
: $$(( result |= $$? )); \
|
||||
fi \
|
||||
done; \
|
||||
exit $$result
|
||||
|
||||
quiet-test:
|
||||
$(MAKE) test QUIET=y
|
||||
|
||||
perf:
|
||||
@result=0; \
|
||||
for test in highlighters/*; do \
|
||||
if [ -d $$test/test-data ]; then \
|
||||
echo "Running test $${test##*/}"; \
|
||||
$(ZSH) -f tests/test-perfs.zsh "$${test##*/}"; \
|
||||
: $$(( result |= $$? )); \
|
||||
fi \
|
||||
done; \
|
||||
exit $$result
|
||||
|
||||
.PHONY: all install clean test perf
|
||||
97
config/zsh/plugins/zsh-syntax-highlighting/README.md
Normal file
97
config/zsh/plugins/zsh-syntax-highlighting/README.md
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
zsh-syntax-highlighting [![Build Status][build-status-image]][build-status]
|
||||
=======================
|
||||
|
||||
**[Fish shell][fish]-like syntax highlighting for [Zsh][zsh].**
|
||||
|
||||
*Requirements: zsh 4.3.11+.*
|
||||
|
||||
[fish]: https://fishshell.com/
|
||||
[zsh]: https://www.zsh.org/
|
||||
|
||||
This package provides syntax highlighting for the shell zsh. It enables
|
||||
highlighting of commands whilst they are typed at a zsh prompt into an
|
||||
interactive terminal. This helps in reviewing commands before running
|
||||
them, particularly in catching syntax errors.
|
||||
|
||||
Some examples:
|
||||
|
||||
Before: [](images/before1.png)
|
||||
<br/>
|
||||
After: [](images/after1.png)
|
||||
|
||||
Before: [](images/before2.png)
|
||||
<br/>
|
||||
After: [](images/after2.png)
|
||||
|
||||
Before: [](images/before3.png)
|
||||
<br/>
|
||||
After: [](images/after3.png)
|
||||
|
||||
Before: [](images/before4-smaller.png)
|
||||
<br/>
|
||||
After: [](images/after4-smaller.png)
|
||||
|
||||
|
||||
|
||||
How to install
|
||||
--------------
|
||||
|
||||
See [INSTALL.md](INSTALL.md).
|
||||
|
||||
|
||||
FAQ
|
||||
---
|
||||
|
||||
### Why must `zsh-syntax-highlighting.zsh` be sourced at the end of the `.zshrc` file?
|
||||
|
||||
zsh-syntax-highlighting works by hooking into the Zsh Line Editor (ZLE) and
|
||||
computing syntax highlighting for the command-line buffer as it stands at the
|
||||
time z-sy-h's hook is invoked.
|
||||
|
||||
In zsh 5.2 and older,
|
||||
`zsh-syntax-highlighting.zsh` hooks into ZLE by wrapping ZLE widgets. It must
|
||||
be sourced after all custom widgets have been created (i.e., after all `zle -N`
|
||||
calls and after running `compinit`) in order to be able to wrap all of them.
|
||||
Widgets created after z-sy-h is sourced will work, but will not update the
|
||||
syntax highlighting.
|
||||
|
||||
In zsh newer than 5.8 (not including 5.8 itself),
|
||||
zsh-syntax-highlighting uses the `add-zle-hook-widget` facility to install
|
||||
a `zle-line-pre-redraw` hook. Hooks are run in order of registration,
|
||||
therefore, z-sy-h must be sourced (and register its hook) after anything else
|
||||
that adds hooks that modify the command-line buffer.
|
||||
|
||||
### Does syntax highlighting work during incremental history search?
|
||||
|
||||
Highlighting the command line during an incremental history search (by default bound to
|
||||
to <kbd>Ctrl+R</kbd> in zsh's emacs keymap) requires zsh 5.4 or newer.
|
||||
|
||||
Under zsh versions older than 5.4, the zsh-default [underlining][zshzle-Character-Highlighting]
|
||||
of the matched portion of the buffer remains available, but zsh-syntax-highlighting's
|
||||
additional highlighting is unavailable. (Those versions of zsh do not provide
|
||||
enough information to allow computing the highlighting correctly.)
|
||||
|
||||
See issues [#288][i288] and [#415][i415] for details.
|
||||
|
||||
[zshzle-Character-Highlighting]: https://zsh.sourceforge.io/Doc/Release/Zsh-Line-Editor.html#Character-Highlighting
|
||||
[i288]: https://github.com/zsh-users/zsh-syntax-highlighting/pull/288
|
||||
[i415]: https://github.com/zsh-users/zsh-syntax-highlighting/pull/415
|
||||
|
||||
### How are new releases announced?
|
||||
|
||||
There is currently no "push" announcements channel. However, the following
|
||||
alternatives exist:
|
||||
|
||||
- GitHub's RSS feed of releases: https://github.com/zsh-users/zsh-syntax-highlighting/releases.atom
|
||||
- An anitya entry: https://release-monitoring.org/project/7552/
|
||||
|
||||
|
||||
How to tweak
|
||||
------------
|
||||
|
||||
Syntax highlighting is done by pluggable highlighter scripts. See the
|
||||
[documentation on highlighters](docs/highlighters.md) for details and
|
||||
configuration settings.
|
||||
|
||||
[build-status]: https://github.com/zsh-users/zsh-syntax-highlighting/actions
|
||||
[build-status-image]: https://github.com/zsh-users/zsh-syntax-highlighting/workflows/Tests/badge.svg
|
||||
920
config/zsh/plugins/zsh-syntax-highlighting/changelog.md
Normal file
920
config/zsh/plugins/zsh-syntax-highlighting/changelog.md
Normal file
|
|
@ -0,0 +1,920 @@
|
|||
# Changes in HEAD
|
||||
|
||||
|
||||
- Highlight `&>` `>&|` `>&!` `&>|` and `&>!` as redirection.
|
||||
[#942]
|
||||
|
||||
|
||||
# Changes in 0.8.0
|
||||
|
||||
This is a stable bugfix and feature release. Major new features and changes include:
|
||||
|
||||
|
||||
## Changes fixed as part of the switch to zle-line-pre-redraw
|
||||
|
||||
The changes in this section were fixed by switching to a `zle-line-pre-redraw`-based
|
||||
implementation.
|
||||
|
||||
Note: The new implementation will only be used on future zsh releases,
|
||||
numbered 5.8.1.1 and newer, due to interoperability issues with other plugins
|
||||
(issues #418 and #579). The underlying zsh feature has been available since
|
||||
zsh 5.3.
|
||||
|
||||
Whilst under development, the new implementation was known as the
|
||||
"feature/redrawhook" topic branch.
|
||||
|
||||
- Fixed: Highlighting not triggered after popping a buffer from the buffer stack
|
||||
(using the `push-line` widget, default binding: `M-q`)
|
||||
[#40]
|
||||
|
||||
- Fixed: Invoking completion when there were no matches removed highlighting
|
||||
[#90, #470]
|
||||
|
||||
- Fixed: Two successive deletes followed by a yank only yanked the latest
|
||||
delete, rather than both of them
|
||||
[#150, #151, #160; cf. #183]
|
||||
|
||||
- Presumed fixed: Completing `$(xsel)` results in an error message from `xsel`,
|
||||
with pre-2017 versions of `xsel`. (For 2017 vintage and newer, see the issue
|
||||
for details.)
|
||||
[#154]
|
||||
|
||||
- Fixed: When the standard `bracketed-paste-magic` widget is in use, pastes were slow
|
||||
[#295]
|
||||
|
||||
- Fixed: No way to prevent a widget from being wrapped
|
||||
[#324]
|
||||
|
||||
- Fixed: No highlighting while cycling menu completion
|
||||
[#375]
|
||||
|
||||
- Fixed: Does not coexist with the `IGNORE_EOF` option
|
||||
[#377]
|
||||
|
||||
- Fixed: The `undefined-key` widget was wrapped
|
||||
[#421]
|
||||
|
||||
- Fixed: Does not coexist with the standard `surround` family of widgets
|
||||
[#520]
|
||||
|
||||
- Fixed: First completed filename doesn't get `path` highlighting
|
||||
[#632]
|
||||
|
||||
|
||||
## Other changes
|
||||
|
||||
- Add issue #712 to the previous release's changelog (hereinafter).
|
||||
|
||||
- Fix highlighting when using an alias twice inside another alias
|
||||
[#769, #775]
|
||||
|
||||
- Remove lint warning for `env` followed by a pipe
|
||||
[#797]
|
||||
|
||||
- Recognize `proxychains` as a precommand
|
||||
[#814, #914]
|
||||
|
||||
- Honor shwordsplit when expanding parameters
|
||||
[#687, #818]
|
||||
|
||||
- Skip highlighting when keys are still pending in more cases
|
||||
[#835]
|
||||
|
||||
- Recognize `grc` as a precommand
|
||||
|
||||
- Recognize `torsocks` and `torift` as precommands
|
||||
[#898]
|
||||
|
||||
- Recognize `cpulimit` as a precommand
|
||||
[#897]
|
||||
|
||||
- Recognize `ktrace` as a precommand
|
||||
|
||||
|
||||
# Changes in 0.8.0-alpha1-pre-redrawhook
|
||||
|
||||
## Notice about an improbable-but-not-impossible forward incompatibility
|
||||
|
||||
Everyone can probably skip this section.
|
||||
|
||||
The `master` branch of zsh-syntax-highlighting uses a zsh feature that has not
|
||||
yet appeared in a zsh release: the `memo=` feature, added to zsh in commit
|
||||
zsh-5.8-172-gdd6e702ee (after zsh 5.8, before zsh 5.9). In the unlikely event
|
||||
that this zsh feature should change in an incompatible way before the next
|
||||
stable zsh release, set `zsh_highlight__memo_feature=0` in your .zshrc files to
|
||||
disable use of the new feature.
|
||||
|
||||
z-sy-h dogfoods the new, unreleased zsh feature because that feature was
|
||||
added to zsh at z-sy-h's initiative. The new feature is used in the fix
|
||||
to issue #418.
|
||||
|
||||
|
||||
## Incompatible changes:
|
||||
|
||||
- An unsuccessful completion (a <kbd>⮀ Tab</kbd> press that doesn't change the
|
||||
command line) no longer causes highlighting to be lost. Visual feedback can
|
||||
alternatively be achieved by setting the `format` zstyle under the `warnings`
|
||||
tag, for example,
|
||||
|
||||
zstyle ':completion:*:warnings' format '%F{red}No matches%f'
|
||||
|
||||
Refer to the [description of the `format` style in `zshcompsys(1)`]
|
||||
[zshcompsys-Standard-Styles-format].
|
||||
|
||||
(#90, part of #245 (feature/redrawhook))
|
||||
|
||||
[zshcompsys-Standard-Styles]: https://zsh.sourceforge.io/Doc/Release/Completion-System.html#Standard-Styles
|
||||
[zshcompsys-Standard-Styles-format]: https://zsh.sourceforge.io/Doc/Release/Completion-System.html#index-format_002c-completion-style
|
||||
|
||||
|
||||
|
||||
## Other changes:
|
||||
|
||||
- Document `$ZSH_HIGHLIGHT_MAXLENGTH`.
|
||||
[#698]
|
||||
|
||||
- Optimize highlighting unquoted words (words that are not in single quotes, double quotes, backticks, or dollar-single-quotes)
|
||||
[#730]
|
||||
|
||||
- Redirection operators (e.g., `<` and `>`) are now highlighted by default
|
||||
[#646]
|
||||
|
||||
- Propertly terminate `noglob` scope in try/always blocks
|
||||
[#577]
|
||||
|
||||
- Don't error out when `KSH_ARRAYS` is set in the calling scope
|
||||
[#622, #689]
|
||||
|
||||
- Literal semicolons in array assignments (`foo=( bar ; baz )`) are now
|
||||
highlighted as errors.
|
||||
[3ca93f864fb6]
|
||||
|
||||
- Command separators in array assignments (`foo=( bar | baz )`) are now
|
||||
highlighted as errors.
|
||||
[#651, 81267ca3130c]
|
||||
|
||||
- Support parameter elision in command position (e.g., `$foo ls` where `$foo` is unset or empty)
|
||||
[#667]
|
||||
|
||||
- Don't consider the filename in `sudo -e /path/to/file` to be a command position
|
||||
[#678]
|
||||
|
||||
- Don't look up absolute directory names in $cdpath
|
||||
[2cc2583f8f12, part of #669]
|
||||
|
||||
- Fix `exec 2>&1;` being highlighted as an error.
|
||||
[#676]
|
||||
|
||||
- Fix `: $(<*)` being highlighted as globbing.
|
||||
[#582]
|
||||
|
||||
- Fix `cat < *` being highlighting as globbing when the `MULTIOS` option is unset.
|
||||
[#583]
|
||||
|
||||
- Fix `echo >&2` highlighting the `2` as a filename if a file by that name happened to exist
|
||||
[#694, part of #645]
|
||||
|
||||
- Fix `echo >&-` highlighting the `-` as a filename if a file by that name happened to exist
|
||||
[part of #645]
|
||||
|
||||
- Fix `echo >&p` highlighting the `p` as a filename if a file by that name happened to exist
|
||||
[part of #645]
|
||||
|
||||
- Fix wrong highlighting of unquoted parameter expansions under zsh 5.2 and older
|
||||
[e165f18c758e]
|
||||
|
||||
- Highlight global aliases
|
||||
[#700]
|
||||
|
||||
- Highlight `: =nosuchcommand' as an error (when the `EQUALS` option hasn't been unset).
|
||||
[#430]
|
||||
|
||||
- Highlight reserved word after assignments as errors (e.g., `foo=bar (ls;)`)
|
||||
[#461]
|
||||
|
||||
- Correctly highlight `[[ foo && bar || baz ]]`.
|
||||
|
||||
- Highlight non-executable files in command position correctly (e.g., `% /etc/passwd`)
|
||||
[#202, #669]
|
||||
|
||||
- Highlight directories in command position correctly, including `AUTO_CD` support
|
||||
[#669]
|
||||
|
||||
- Recognize `env` as a precommand (e.g., `env FOO=bar ls`)
|
||||
|
||||
- Recognize `ionice` as a precommand
|
||||
|
||||
- Recognize `strace` as a precommand
|
||||
|
||||
- Fix an error message on stderr before every prompt when the `WARN_NESTED_VAR` zsh option is set:
|
||||
`_zsh_highlight_main__precmd_hook:1: array parameter _zsh_highlight_main__command_type_cache set in enclosing scope in function _zsh_highlight_main__precmd_hook`
|
||||
[#727, #731, #732, #733]
|
||||
|
||||
- Fix highlighting of alias whose definitions use a simple command terminator
|
||||
(such as `;`, `|`, `&&`) before a newline
|
||||
[#677; had regressed in 0.7.0]
|
||||
|
||||
- Highlight arithmetic expansions (e.g., `$(( 42 ))`)
|
||||
[#607 #649 #704]
|
||||
|
||||
- Highlight the parentheses of array assignments as reserved words (`foo=( bar )`).
|
||||
The `assign` style remains supported and has precedence.
|
||||
[#585]
|
||||
|
||||
- Fix interoperability issue with other plugins that use highlighting. The fix
|
||||
requires zsh 5.8.0.3 or newer. (zsh 5.8.0.2-dev from the `master` branch,
|
||||
revision zsh-5.8-172-gdd6e702ee or newer is also fine.)
|
||||
[#418, https://github.com/okapia/zsh-viexchange/issues/1]
|
||||
|
||||
- Improve performance of the `brackets` highlighter.
|
||||
|
||||
- Fix highlighting of pre-command redirections (e.g., the `$fn` in `<$fn cat`)
|
||||
[#712]
|
||||
|
||||
|
||||
# Changes in version 0.7.1
|
||||
|
||||
- Remove out-of-date information from the 0.7.0 changelog.
|
||||
|
||||
|
||||
# Changes in version 0.7.0
|
||||
|
||||
This is a stable bugfix and feature release. Major new features and changes include:
|
||||
|
||||
- Add `ZSH_HIGHLIGHT_DIRS_BLACKLIST` to disable "path" and "path prefix"
|
||||
highlighting for specific directories
|
||||
[#379]
|
||||
|
||||
- Add the "regexp" highlighter, modelled after the pattern highlighter
|
||||
[4e6f60063f1c]
|
||||
|
||||
- When a word uses globbing, only the globbing metacharacters will be highlighted as globbing:
|
||||
in `: foo*bar`, only the `*` will be blue.
|
||||
[e48af357532c]
|
||||
|
||||
- Highlight pasted quotes (e.g., `: foo"bar"`)
|
||||
[dc1b2f6fa4bb]
|
||||
|
||||
- Highlight command substitutions (`` : `ls` ``, `: $(ls)`)
|
||||
[c0e64fe13178 and parents, e86f75a840e7, et al]
|
||||
|
||||
- Highlight process substitutions (`: >(nl)`, `: <(pwd)`, `: =(git diff)`)
|
||||
[c0e64fe13178 and parents, e86f75a840e7, et al]
|
||||
|
||||
- Highlight command substitutions inside double quotes (``: "`foo`"``)
|
||||
[f16e858f0c83]
|
||||
|
||||
- Highlight many precommands (e.g., `nice`, `stdbuf`, `eatmydata`;
|
||||
see `$precommand_options` in the source)
|
||||
|
||||
- Highlight numeric globs (e.g., `echo /lib<->`)
|
||||
|
||||
- Assorted improvements to aliases highlighting
|
||||
(e.g.,
|
||||
`alias sudo_u='sudo -u'; sudo_u jrandom ls`,
|
||||
`alias x=y y=z z=nosuchcommand; x`,
|
||||
`alias ls='ls -l'; \ls`)
|
||||
[f3410c5862fc, 57386f30aec8, #544, and many others]
|
||||
|
||||
- Highlight some more syntax errors
|
||||
[dea05e44e671, 298ef6a2fa30]
|
||||
|
||||
- New styles: named file descriptors, `RC_QUOTES`, and unclosed quotes (e.g., `echo "foo<CURSOR>`)
|
||||
[38c794a978cd, 25ae1c01216c, 967335dfc5fd]
|
||||
|
||||
- The 'brackets' highlighting no longer treats quotes specially.
|
||||
[ecdda36ef56f]
|
||||
|
||||
|
||||
Selected bugfixes include:
|
||||
|
||||
- Highlight `sudo` correctly when it's not installed
|
||||
[26a82113b08b]
|
||||
|
||||
- Handle some non-default options being set in zshrc
|
||||
[b07ada1255b7, a2a899b41b8, 972ad197c13d, b3f66fc8748f]
|
||||
|
||||
- Fix off-by-one highlighting in vi "visual" mode (vicmd keymap)
|
||||
[be3882aeb054]
|
||||
|
||||
- The 'yank-pop' widget is not wrapped
|
||||
[#183]
|
||||
|
||||
|
||||
Known issues include:
|
||||
|
||||
- A multiline alias that uses a simple command terminator (such as `;`, `|`, `&&`)
|
||||
before a newline will incorrectly be highlighted as an error. See issue #677
|
||||
for examples and workarounds.
|
||||
[#677]
|
||||
[UPDATE: Fixed in 0.8.0]
|
||||
|
||||
|
||||
# Changes in version 0.6.0
|
||||
|
||||
This is a stable release, featuring bugfixes and minor improvements.
|
||||
|
||||
|
||||
## Performance improvements:
|
||||
|
||||
(none)
|
||||
|
||||
|
||||
## Added highlighting of:
|
||||
|
||||
- The `isearch` and `suffix` [`$zle_highlight` settings][zshzle-Character-Highlighting].
|
||||
(79e4d3d12405, 15db71abd0cc, b56ee542d619; requires zsh 5.3 for `$ISEARCHMATCH_ACTIVE` / `$SUFFIX_ACTIVE` support)
|
||||
|
||||
[zshzle-Character-Highlighting]: https://zsh.sourceforge.io/Doc/Release/Zsh-Line-Editor.html#Character-Highlighting
|
||||
|
||||
- Possible history expansions in double-quoted strings.
|
||||
(76ea9e1df316)
|
||||
|
||||
- Mismatched `if`/`then`/`elif`/`else`/`fi`.
|
||||
(73cb83270262)
|
||||
|
||||
|
||||
## Fixed highlighting of:
|
||||
|
||||
- A comment line followed by a non-comment line.
|
||||
(#385, 9396ad5c5f9c)
|
||||
|
||||
- An unquoted `$*` (expands to the positional parameters).
|
||||
(237f89ad629f)
|
||||
|
||||
- history-incremental-pattern-search-backward under zsh 5.3.1.
|
||||
(#407, #415, 462779629a0c)
|
||||
|
||||
|
||||
## API changes (for highlighter authors):
|
||||
|
||||
(none)
|
||||
|
||||
|
||||
## Developer-visible changes:
|
||||
|
||||
- tests: Set the `ALIAS_FUNC_DEF` option for zsh 5.4 compatibility.
|
||||
(9523d6d49cb3)
|
||||
|
||||
|
||||
## Other changes:
|
||||
|
||||
- docs: Added before/after screenshots.
|
||||
(cd9ec14a65ec..b7e277106b49)
|
||||
|
||||
- docs: Link Fedora package.
|
||||
(3d74aa47e4a7, 5feed23962df)
|
||||
|
||||
- docs: Link FreeBSD port.
|
||||
(626c034c68d7)
|
||||
|
||||
- docs: Link OpenSUSE Build Service packages
|
||||
(#419, dea1fedc7358)
|
||||
|
||||
- Prevent user-defined aliases from taking effect in z-sy-h's own code.
|
||||
(#390, 2dce602727d7, 8d5afe47f774; and #392, #395, b8fa1b9dc954)
|
||||
|
||||
- docs: Update zplug installation instructions.
|
||||
(#399, 4f49c4a35f17)
|
||||
|
||||
- Improve "unhandled ZLE widget 'foo'" error message.
|
||||
(#409, be083d7f3710)
|
||||
|
||||
- Fix printing of "failed loading highlighters" error message.
|
||||
(#426, ad522a091429)
|
||||
|
||||
|
||||
# Changes in version 0.5.0
|
||||
|
||||
|
||||
## Performance improvements:
|
||||
|
||||
We thank Sebastian Gniazdowski and "m0viefreak" for significant contributions
|
||||
in this area.
|
||||
|
||||
- Optimize string operations in the `main` (default) highlighter.
|
||||
(#372/3cb58fd7d7b9, 02229ebd6328, ef4bfe5bcc14, #372/c6b6513ac0d6, #374/15461e7d21c3)
|
||||
|
||||
- Command word highlighting: Use the `zsh/parameter` module to avoid forks.
|
||||
Memoize (cache) the results.
|
||||
(#298, 3ce01076b521, 2f18ba64e397, 12b879caf7a6; #320, 3b67e656bff5)
|
||||
|
||||
- Avoid forks in the driver and in the `root` highlighter.
|
||||
(b9112aec798a, 38c8fbea2dd2)
|
||||
|
||||
|
||||
## Added highlighting of:
|
||||
|
||||
- `pkexec` (a precommand).
|
||||
(#248, 4f3910cbbaa5)
|
||||
|
||||
- Aliases that cannot be defined normally nor invoked normally (highlighted as an error).
|
||||
(#263 (in part), 28932316cca6)
|
||||
|
||||
- Path separators (`/`) — the default behaviour remains to highlight path separators
|
||||
and path components the same way.
|
||||
(#136, #260, 6cd39e7c70d3, 9a934d291e7c, f3d3aaa00cc4)
|
||||
|
||||
- Assignments to individual positional arguments (`42=foo` to assign to `$42`).
|
||||
(f4036a09cee3)
|
||||
|
||||
- Linewise region (the `visual-line-mode` widget, bound to `V` in zsh's `vi` keymap).
|
||||
(#267, a7a7f8b42280, ee07588cfd9b)
|
||||
|
||||
- Command-lines recalled by `isearch` mode; requires zsh≥5.3.
|
||||
(#261 (in part); #257; 4ad311ec0a68)
|
||||
|
||||
- Command-lines whilst the `IGNORE_BRACES` or `IGNORE_CLOSE_BRACES` option is in effect.
|
||||
(a8a6384356af, 02807f1826a5)
|
||||
|
||||
- Mismatched parentheses and braces (in the `main` highlighter).
|
||||
(51b9d79c3bb6, 2fabf7ca64b7, a4196eda5e6f, and others)
|
||||
|
||||
- Mismatched `do`/`done` keywords.
|
||||
(b2733a64da93)
|
||||
|
||||
- Mismatched `foreach`/`end` keywords.
|
||||
(#96, 2bb8f0703d8f)
|
||||
|
||||
- In Bourne-style function definitions, when the `MULTI_FUNC_DEF` option is set
|
||||
(which is the default), highlight the first word in the function body as
|
||||
a command word: `f() { g "$@" }`.
|
||||
(6f91850a01e1)
|
||||
|
||||
- `always` blocks.
|
||||
(#335, e5782e4ddfb6)
|
||||
|
||||
- Command substitutions inside double quotes, `"$(echo foo)"`.
|
||||
(#139 (in part), c3913e0d8ead)
|
||||
|
||||
- Non-alphabetic parameters inside double quotes (`"$$"`, `"$#"`, `"$*"`, `"$@"`, `"$?"`, `"$-"`).
|
||||
(4afe670f7a1b, 44ef6e38e5a7)
|
||||
|
||||
- Command words from future versions of zsh (forward compatibly).
|
||||
This also adds an `arg0` style that all other command word styles fall back to.
|
||||
(b4537a972eed, bccc3dc26943)
|
||||
|
||||
- Escaped history expansions inside double quotes: `: "\!"`
|
||||
(28d7056a7a06, et seq)
|
||||
|
||||
|
||||
## Fixed highlighting of:
|
||||
|
||||
- Command separator tokens in syntactically-invalid positions.
|
||||
(09c4114eb980)
|
||||
|
||||
- Redirections with a file descriptor number at command word.
|
||||
(#238 (in part), 73ee7c1f6c4a)
|
||||
|
||||
- The `select` prompt, `$PS3`.
|
||||
(#268, 451665cb2a8b)
|
||||
|
||||
- Values of variables in `vared`.
|
||||
(e500ca246286)
|
||||
|
||||
- `!` as an argument (neither a history expansion nor a reserved word).
|
||||
(4c23a2fd1b90)
|
||||
|
||||
- "division by zero" error under the `brackets` highlighter when `$ZSH_HIGHLIGHT_STYLES` is empty.
|
||||
(f73f3d53d3a6)
|
||||
|
||||
- Process substitutions, `<(pwd)` and `>(wc -l)`.
|
||||
(#302, 6889ff6bd2ad, bfabffbf975c, fc9c892a3f15)
|
||||
|
||||
- The non-`SHORT_LOOPS` form of `repeat` loops: `repeat 42; do true; done`.
|
||||
(#290, 4832f18c50a5, ef68f50c048f, 6362c757b6f7)
|
||||
|
||||
- Broken symlinks (are now highlighted as files).
|
||||
(#342, 95f7206a9373, 53083da8215e)
|
||||
|
||||
- Lines accepted from `isearch` mode.
|
||||
(#284; #257, #259, #288; 5bae6219008b, a8fe22d42251)
|
||||
|
||||
- Work around upstream bug that triggered when the command word was a relative
|
||||
path, that when interpreted relative to a $PATH directory denoted a command;
|
||||
the effect of that upstream bug was that the relative path was cached as
|
||||
a "valid external command name".
|
||||
(#354, #355, 51614ca2c994, fdaeec45146b, 7d38d07255e4;
|
||||
upstream fix slated to be released in 5.3 (workers/39104))
|
||||
|
||||
- After accepting a line with the cursor on a bracket, the matching bracket
|
||||
of the bracket under the cursor no longer remains highlighted (with the
|
||||
`brackets` highlighter).
|
||||
(4c4baede519a)
|
||||
|
||||
- The first word on a new line within an array assignment or initialization is no
|
||||
longer considered a command position.
|
||||
(8bf423d16d46)
|
||||
|
||||
- Subshells that end at command position, `(A=42)`, `(true;)`.
|
||||
(#231, 7fb6f9979121; #344, 4fc35362ee5a)
|
||||
|
||||
- Command word after array assignment, `a=(lorem ipsum) pwd`.
|
||||
(#330, 7fb6f9979121)
|
||||
|
||||
|
||||
## API changes (for highlighter authors):
|
||||
|
||||
- New interface `_zsh_highlight_add_highlight`.
|
||||
(341a3ae1f015, c346f6eb6fb6)
|
||||
|
||||
- tests: Specify the style key, not its value, in test expectations.
|
||||
(a830613467af, fd061b5730bf, eaa4335c3441, among others)
|
||||
|
||||
- Module author documentation improvements.
|
||||
(#306 (in part), 217669270418, 0ff354b44b6e, 80148f6c8402, 364f206a547f, and others)
|
||||
|
||||
- The driver no longer defines a `_zsh_highlight_${highlighter}_highlighter_cache`
|
||||
variable, which is in the highlighters' namespace.
|
||||
(3e59ab41b6b8, 80148f6c8402, f91a7b885e7d)
|
||||
|
||||
- Rename highlighter entry points. The old names remain supported for
|
||||
backwards compatibility.
|
||||
(a3d5dfcbdae9, c793e0dceab1)
|
||||
|
||||
- tests: Add the "NONE" expectation.
|
||||
(4da9889d1545, 13018f3dd735, d37c55c788cd)
|
||||
|
||||
- tests: consider a test that writes to stderr to have failed.
|
||||
(#291, 1082067f9315)
|
||||
|
||||
|
||||
## Developer-visible changes:
|
||||
|
||||
- Add `make quiet-test`.
|
||||
(9b64ad750f35)
|
||||
|
||||
- test harness: Better quote replaceables in error messages.
|
||||
(30d8f92df225)
|
||||
|
||||
- test harness: Fix exit code for XPASS.
|
||||
(bb8d325c0cbd)
|
||||
|
||||
- Create [HACKING.md](HACKING.md).
|
||||
(cef49752fd0e)
|
||||
|
||||
- tests: Emit a description for PASS test points.
|
||||
(6aa57d60aa64, f0bae44b76dd)
|
||||
|
||||
- tests: Create a script that generates a test file.
|
||||
(8013dc3b8db6, et seq; `tests/generate.zsh`)
|
||||
|
||||
|
||||
## Other changes:
|
||||
|
||||
- Under zsh≤5.2, widgets whose names start with a `_` are no longer excluded
|
||||
from highlighting.
|
||||
(ed33d2cb1388; reverts part of 186d80054a40 which was for #65)
|
||||
|
||||
- Under zsh≤5.2, widgets implemented by a function named after the widget are
|
||||
no longer excluded from highlighting.
|
||||
(487b122c480d; reverts part of 776453cb5b69)
|
||||
|
||||
- Under zsh≤5.2, shell-unsafe widget names can now be wrapped.
|
||||
(#278, 6a634fac9fb9, et seq)
|
||||
|
||||
- Correct some test expectations.
|
||||
(78290e043bc5)
|
||||
|
||||
- `zsh-syntax-highlighting.plugin.zsh`: Convert from symlink to plain file
|
||||
for msys2 compatibility.
|
||||
(#292, d4f8edc9f3ad)
|
||||
|
||||
- Document installation under some plugin managers.
|
||||
(e635f766bef9, 9cab566f539b)
|
||||
|
||||
- Don't leak the `PATH_DIRS` option.
|
||||
(7b82b88a7166)
|
||||
|
||||
- Don't require the `FUNCTION_ARGZERO` option to be set.
|
||||
(#338, 750aebc553f2)
|
||||
|
||||
- Under zsh≤5.2, support binding incomplete/nonexistent widgets.
|
||||
(9e569bb0fe04, part of #288)
|
||||
|
||||
- Make the driver reentrant, fixing possibility of infinite recursion
|
||||
under zsh≤5.2 under interaction with theoretical third-party code.
|
||||
(#305, d711563fe1bf, 295d62ec888d, f3242cbd6aba)
|
||||
|
||||
- Fix warnings when `WARN_CREATE_GLOBAL` is set prior to sourcing zsh-syntax-highlighting.
|
||||
(z-sy-h already sets `WARN_CREATE_GLOBAL` internally.)
|
||||
(da60234fb236)
|
||||
|
||||
- Warn only once, rather than once per keypress, when a highlighter is unavailable.
|
||||
(0a9b347483ae)
|
||||
|
||||
|
||||
# Changes in version 0.4.1
|
||||
|
||||
## Fixes:
|
||||
|
||||
- Arguments to widgets were not properly dash-escaped. Only matters for widgets
|
||||
that take arguments (i.e., that are invoked as `zle ${widget} -- ${args}`).
|
||||
(282c7134e8ac, reverts c808d2187a73)
|
||||
|
||||
|
||||
# Changes in version 0.4.0
|
||||
|
||||
|
||||
## Added highlighting of:
|
||||
|
||||
- incomplete sudo commands
|
||||
(a3047a912100, 2f05620b19ae)
|
||||
|
||||
```zsh
|
||||
sudo;
|
||||
sudo -u;
|
||||
```
|
||||
|
||||
- command words following reserved words
|
||||
(#207, #222, b397b12ac139 et seq, 6fbd2aa9579b et seq, 8b4adbd991b0)
|
||||
|
||||
```zsh
|
||||
if ls; then ls; else ls; fi
|
||||
repeat 10 do ls; done
|
||||
```
|
||||
|
||||
(The `ls` are now highlighted as a command.)
|
||||
|
||||
- comments (when `INTERACTIVE_COMMENTS` is set)
|
||||
(#163, #167, 693de99a9030)
|
||||
|
||||
```zsh
|
||||
echo Hello # comment
|
||||
```
|
||||
|
||||
- closing brackets of arithmetic expansion, subshells, and blocks
|
||||
(#226, a59f442d2d34, et seq)
|
||||
|
||||
```zsh
|
||||
(( foo ))
|
||||
( foo )
|
||||
{ foo }
|
||||
```
|
||||
|
||||
- command names enabled by the `PATH_DIRS` option
|
||||
(#228, 96ee5116b182)
|
||||
|
||||
```zsh
|
||||
# When ~/bin/foo/bar exists, is executable, ~/bin is in $PATH,
|
||||
# and 'setopt PATH_DIRS' is in effect
|
||||
foo/bar
|
||||
```
|
||||
|
||||
- parameter expansions with braces inside double quotes
|
||||
(#186, 6e3720f39d84)
|
||||
|
||||
```zsh
|
||||
echo "${foo}"
|
||||
```
|
||||
|
||||
- parameter expansions in command word
|
||||
(#101, 4fcfb15913a2)
|
||||
|
||||
```zsh
|
||||
x=/bin/ls
|
||||
$x -l
|
||||
```
|
||||
|
||||
- the command separators '\|&', '&!', '&\|'
|
||||
|
||||
```zsh
|
||||
view file.pdf &! ls
|
||||
```
|
||||
|
||||
|
||||
## Fixed highlighting of:
|
||||
|
||||
- precommand modifiers at non-command-word position
|
||||
(#209, 2c9f8c8c95fa)
|
||||
|
||||
```zsh
|
||||
ls command foo
|
||||
```
|
||||
|
||||
- sudo commands with infix redirections
|
||||
(#221, be006aded590, 86e924970911)
|
||||
|
||||
```zsh
|
||||
sudo -u >/tmp/foo.out user ls
|
||||
```
|
||||
|
||||
- subshells; anonymous functions
|
||||
(#166, #194, 0d1bfbcbfa67, 9e178f9f3948)
|
||||
|
||||
```zsh
|
||||
(true)
|
||||
() { true }
|
||||
```
|
||||
|
||||
- parameter assignment statements with no command
|
||||
(#205, 01d7eeb3c713)
|
||||
|
||||
```zsh
|
||||
A=1;
|
||||
```
|
||||
|
||||
(The semicolon used to be highlighted as a mistake)
|
||||
|
||||
- cursor highlighter: Remove the cursor highlighting when accepting a line.
|
||||
(#109, 4f0c293fdef0)
|
||||
|
||||
|
||||
## Removed features:
|
||||
|
||||
- Removed highlighting of approximate paths (`path_approx`).
|
||||
(#187, 98aee7f8b9a3)
|
||||
|
||||
|
||||
## Other changes:
|
||||
|
||||
- main highlighter refactored to use states rather than booleans.
|
||||
(2080a441ac49, et seq)
|
||||
|
||||
- Fix initialization when sourcing `zsh-syntax-highlighting.zsh` via a symlink
|
||||
(083c47b00707)
|
||||
|
||||
- docs: Add screenshot.
|
||||
(57624bb9f64b)
|
||||
|
||||
- widgets wrapping: Don't add '--' when invoking widgets.
|
||||
(c808d2187a73) [_reverted in 0.4.1_]
|
||||
|
||||
- Refresh highlighting upon `accept-*` widgets (`accept-line` et al).
|
||||
(59fbdda64c21)
|
||||
|
||||
- Stop leaking match/mbegin/mend to global scope (thanks to upstream
|
||||
`WARN_CREATE_GLOBAL` improvements).
|
||||
(d3deffbf46a4)
|
||||
|
||||
- 'make install': Permit setting `$(SHARE_DIR)` from the environment.
|
||||
(e1078a8b4cf1)
|
||||
|
||||
- driver: Tolerate KSH_ARRAYS being set in the calling context.
|
||||
(#162, 8f19af6b319d)
|
||||
|
||||
- 'make install': Install documentation fully and properly.
|
||||
(#219, b1619c001390, et seq)
|
||||
|
||||
- docs: Improve 'main' highlighter's documentation.
|
||||
(00de155063f5, 7d4252f5f596)
|
||||
|
||||
- docs: Moved to a new docs/ tree; assorted minor updates
|
||||
(c575f8f37567, 5b34c23cfad5, et seq)
|
||||
|
||||
- docs: Split README.md into INSTALL.md
|
||||
(0b3183f6cb9a)
|
||||
|
||||
- driver: Report `$ZSH_HIGHLIGHT_REVISION` when running from git
|
||||
(84734ba95026)
|
||||
|
||||
|
||||
## Developer-visible changes:
|
||||
|
||||
- Test harness converted to [TAP](https://testanything.org/tap-specification.html) format
|
||||
(d99aa58aaaef, et seq)
|
||||
|
||||
- Run each test in a separate subprocess, isolating them from each other
|
||||
(d99aa58aaaef, et seq)
|
||||
|
||||
- Fix test failure with nonexisting $HOME
|
||||
(#216, b2ac98b98150)
|
||||
|
||||
- Test output is now colorized.
|
||||
(4d3da30f8b72, 6fe07c096109)
|
||||
|
||||
- Document `make install`
|
||||
(a18a7427fd2c)
|
||||
|
||||
- tests: Allow specifying the zsh binary to use.
|
||||
(557bb7e0c6a0)
|
||||
|
||||
- tests: Add 'make perf' target
|
||||
(4513eaea71d7)
|
||||
|
||||
- tests: Run each test in a sandbox directory
|
||||
(c01533920245)
|
||||
|
||||
|
||||
# Changes in version 0.3.0
|
||||
|
||||
|
||||
## Added highlighting of:
|
||||
|
||||
- suffix aliases (requires zsh 5.1.1 or newer):
|
||||
|
||||
```zsh
|
||||
alias -s png=display
|
||||
foo.png
|
||||
```
|
||||
|
||||
- prefix redirections:
|
||||
|
||||
```zsh
|
||||
<foo.txt cat
|
||||
```
|
||||
|
||||
- redirection operators:
|
||||
|
||||
```zsh
|
||||
echo > foo.txt
|
||||
```
|
||||
|
||||
- arithmetic evaluations:
|
||||
|
||||
```zsh
|
||||
(( 42 ))
|
||||
```
|
||||
|
||||
- $'' strings, including \x/\octal/\u/\U escapes
|
||||
|
||||
```zsh
|
||||
: $'foo\u0040bar'
|
||||
```
|
||||
|
||||
- multiline strings:
|
||||
|
||||
```zsh
|
||||
% echo "line 1
|
||||
line 2"
|
||||
```
|
||||
|
||||
- string literals that haven't been finished:
|
||||
|
||||
```zsh
|
||||
% echo "Hello, world
|
||||
```
|
||||
- command words that involve tilde expansion:
|
||||
|
||||
```zsh
|
||||
% ~/bin/foo
|
||||
```
|
||||
|
||||
## Fixed highlighting of:
|
||||
|
||||
- quoted command words:
|
||||
|
||||
```zsh
|
||||
% \ls
|
||||
```
|
||||
|
||||
- backslash escapes in "" strings:
|
||||
|
||||
```zsh
|
||||
% echo "\x41"
|
||||
```
|
||||
|
||||
- noglob after command separator:
|
||||
|
||||
```zsh
|
||||
% :; noglob echo *
|
||||
```
|
||||
|
||||
- glob after command separator, when the first command starts with 'noglob':
|
||||
|
||||
```zsh
|
||||
% noglob true; echo *
|
||||
```
|
||||
|
||||
- the region (vi visual mode / set-mark-command) (issue #165)
|
||||
|
||||
- redirection and command separators that would be highlighted as `path_approx`
|
||||
|
||||
```zsh
|
||||
% echo foo;‸
|
||||
% echo <‸
|
||||
```
|
||||
|
||||
(where `‸` represents the cursor location)
|
||||
|
||||
- escaped globbing (outside quotes)
|
||||
|
||||
```zsh
|
||||
% echo \*
|
||||
```
|
||||
|
||||
|
||||
## Other changes:
|
||||
|
||||
- implemented compatibility with zsh's paste highlighting (issue #175)
|
||||
|
||||
- `$?` propagated correctly to wrapped widgets
|
||||
|
||||
- don't leak $REPLY into global scope
|
||||
|
||||
|
||||
## Developer-visible changes:
|
||||
|
||||
- added makefile with `install` and `test` targets
|
||||
|
||||
- set `warn_create_global` internally
|
||||
|
||||
- document release process
|
||||
|
||||
|
||||
|
||||
|
||||
# Version 0.2.1
|
||||
|
||||
(Start of changelog.)
|
||||
|
||||
132
config/zsh/plugins/zsh-syntax-highlighting/docs/highlighters.md
Normal file
132
config/zsh/plugins/zsh-syntax-highlighting/docs/highlighters.md
Normal file
|
|
@ -0,0 +1,132 @@
|
|||
zsh-syntax-highlighting / highlighters
|
||||
======================================
|
||||
|
||||
Syntax highlighting is done by pluggable highlighters:
|
||||
|
||||
* `main` - the base highlighter, and the only one [active by default][main].
|
||||
* `brackets` - [matches brackets][brackets] and parenthesis.
|
||||
* `pattern` - matches [user-defined patterns][pattern].
|
||||
* `regexp` - matches [user-defined regular expressions][regexp].
|
||||
* `cursor` - matches [the cursor position][cursor].
|
||||
* `root` - highlights the whole command line [if the current user is root][root].
|
||||
* `line` - applied to [the whole command line][line].
|
||||
|
||||
[main]: highlighters/main.md
|
||||
[brackets]: highlighters/brackets.md
|
||||
[pattern]: highlighters/pattern.md
|
||||
[regexp]: highlighters/regexp.md
|
||||
[cursor]: highlighters/cursor.md
|
||||
[root]: highlighters/root.md
|
||||
[line]: highlighters/line.md
|
||||
|
||||
|
||||
Highlighter-independent settings
|
||||
--------------------------------
|
||||
|
||||
By default, all command lines are highlighted. However, it is possible to
|
||||
prevent command lines longer than a fixed number of characters from being
|
||||
highlighted by setting the variable `${ZSH_HIGHLIGHT_MAXLENGTH}` to the maximum
|
||||
length (in characters) of command lines to be highlighter. This is useful when
|
||||
editing very long command lines (for example, with the [`fned`][fned] utility
|
||||
function). Example:
|
||||
|
||||
[fned]: https://zsh.sourceforge.io/Doc/Release/User-Contributions.html#index-zed
|
||||
|
||||
```zsh
|
||||
ZSH_HIGHLIGHT_MAXLENGTH=512
|
||||
```
|
||||
|
||||
|
||||
How to activate highlighters
|
||||
----------------------------
|
||||
|
||||
To activate an highlighter, add it to the `ZSH_HIGHLIGHT_HIGHLIGHTERS` array.
|
||||
By default `ZSH_HIGHLIGHT_HIGHLIGHTERS` is `(main)`. For example to activate
|
||||
`brackets`, `pattern`, and `cursor` highlighters, in `~/.zshrc` do:
|
||||
|
||||
```zsh
|
||||
ZSH_HIGHLIGHT_HIGHLIGHTERS+=(brackets pattern cursor)
|
||||
```
|
||||
|
||||
|
||||
How to tweak highlighters
|
||||
-------------------------
|
||||
|
||||
Highlighters look up styles from the `ZSH_HIGHLIGHT_STYLES` associative array.
|
||||
Navigate into the [individual highlighters' documentation](highlighters/) to
|
||||
see what styles (keys) each highlighter defines; the syntax for values is the
|
||||
same as the syntax of "types of highlighting" of the zsh builtin
|
||||
`$zle_highlight` array, which is documented in [the `zshzle(1)` manual
|
||||
page][zshzle-Character-Highlighting].
|
||||
|
||||
[zshzle-Character-Highlighting]: https://zsh.sourceforge.io/Doc/Release/Zsh-Line-Editor.html#Character-Highlighting
|
||||
|
||||
Some highlighters support additional configuration parameters; see each
|
||||
highlighter's documentation for details and examples.
|
||||
|
||||
|
||||
How to implement a new highlighter
|
||||
----------------------------------
|
||||
|
||||
To create your own `acme` highlighter:
|
||||
|
||||
* Create your script at
|
||||
`highlighters/acme/acme-highlighter.zsh`.
|
||||
|
||||
* Implement the `_zsh_highlight_highlighter_acme_predicate` function.
|
||||
This function must return 0 when the highlighter needs to be called and
|
||||
non-zero otherwise, for example:
|
||||
|
||||
```zsh
|
||||
_zsh_highlight_highlighter_acme_predicate() {
|
||||
# Call this highlighter in SVN working copies
|
||||
[[ -d .svn ]]
|
||||
}
|
||||
```
|
||||
|
||||
* Implement the `_zsh_highlight_highlighter_acme_paint` function.
|
||||
This function does the actual syntax highlighting, by calling
|
||||
`_zsh_highlight_add_highlight` with the start and end of the region to
|
||||
be highlighted and the `ZSH_HIGHLIGHT_STYLES` key to use. Define the default
|
||||
style for that key in the highlighter script outside of any function with
|
||||
`: ${ZSH_HIGHLIGHT_STYLES[key]:=value}`, being sure to prefix
|
||||
the key with your highlighter name and a colon. For example:
|
||||
|
||||
```zsh
|
||||
: ${ZSH_HIGHLIGHT_STYLES[acme:aurora]:=fg=green}
|
||||
|
||||
_zsh_highlight_highlighter_acme_paint() {
|
||||
# Colorize the whole buffer with the 'aurora' style
|
||||
_zsh_highlight_add_highlight 0 $#BUFFER acme:aurora
|
||||
}
|
||||
```
|
||||
|
||||
If you need to test which options the user has set, test `zsyh_user_options`
|
||||
with a sensible default if the option is not present in supported zsh
|
||||
versions. For example:
|
||||
|
||||
```zsh
|
||||
[[ ${zsyh_user_options[ignoreclosebraces]:-off} == on ]]
|
||||
```
|
||||
|
||||
The option name must be all lowercase with no underscores and not an alias.
|
||||
|
||||
* Name your own functions and global variables `_zsh_highlight_acme_*`.
|
||||
|
||||
- In zsh-syntax-highlighting 0.4.0 and earlier, the entrypoints
|
||||
`_zsh_highlight_highlighter_acme_predicate` and
|
||||
`_zsh_highlight_highlighter_acme_paint`
|
||||
were named
|
||||
`_zsh_highlight_acme_highlighter_predicate` and
|
||||
`_zsh_highlight_highlighter_acme_paint` respectively.
|
||||
|
||||
These names are still supported for backwards compatibility;
|
||||
however, support for them will be removed in a future major or minor release (v0.x.0 or v1.0.0).
|
||||
|
||||
* Activate your highlighter in `~/.zshrc`:
|
||||
|
||||
```zsh
|
||||
ZSH_HIGHLIGHT_HIGHLIGHTERS+=(acme)
|
||||
```
|
||||
|
||||
* [Write tests](../tests/README.md).
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
zsh-syntax-highlighting / highlighters / brackets
|
||||
-------------------------------------------------
|
||||
|
||||
This is the `brackets` highlighter, that highlights brackets and parentheses, and
|
||||
matches them.
|
||||
|
||||
|
||||
### How to tweak it
|
||||
|
||||
This highlighter defines the following styles:
|
||||
|
||||
* `bracket-error` - unmatched brackets
|
||||
* `bracket-level-N` - brackets with nest level N
|
||||
* `cursor-matchingbracket` - the matching bracket, if cursor is on a bracket
|
||||
|
||||
To override one of those styles, change its entry in `ZSH_HIGHLIGHT_STYLES`,
|
||||
for example in `~/.zshrc`:
|
||||
|
||||
```zsh
|
||||
# To define styles for nested brackets up to level 4
|
||||
ZSH_HIGHLIGHT_STYLES[bracket-level-1]='fg=blue,bold'
|
||||
ZSH_HIGHLIGHT_STYLES[bracket-level-2]='fg=red,bold'
|
||||
ZSH_HIGHLIGHT_STYLES[bracket-level-3]='fg=yellow,bold'
|
||||
ZSH_HIGHLIGHT_STYLES[bracket-level-4]='fg=magenta,bold'
|
||||
```
|
||||
|
||||
The syntax for values is the same as the syntax of "types of highlighting" of
|
||||
the zsh builtin `$zle_highlight` array, which is documented in [the `zshzle(1)`
|
||||
manual page][zshzle-Character-Highlighting].
|
||||
|
||||
[zshzle-Character-Highlighting]: https://zsh.sourceforge.io/Doc/Release/Zsh-Line-Editor.html#Character-Highlighting
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
zsh-syntax-highlighting / highlighters / cursor
|
||||
-----------------------------------------------
|
||||
|
||||
This is the `cursor` highlighter, that highlights the cursor.
|
||||
|
||||
|
||||
### How to tweak it
|
||||
|
||||
This highlighter defines the following styles:
|
||||
|
||||
* `cursor` - the style for the current cursor position
|
||||
|
||||
To override one of those styles, change its entry in `ZSH_HIGHLIGHT_STYLES`,
|
||||
for example in `~/.zshrc`:
|
||||
|
||||
```zsh
|
||||
ZSH_HIGHLIGHT_STYLES[cursor]='bg=blue'
|
||||
```
|
||||
|
||||
The syntax for values is the same as the syntax of "types of highlighting" of
|
||||
the zsh builtin `$zle_highlight` array, which is documented in [the `zshzle(1)`
|
||||
manual page][zshzle-Character-Highlighting].
|
||||
|
||||
[zshzle-Character-Highlighting]: https://zsh.sourceforge.io/Doc/Release/Zsh-Line-Editor.html#Character-Highlighting
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
zsh-syntax-highlighting / highlighters / line
|
||||
---------------------------------------------
|
||||
|
||||
This is the `line` highlighter, that highlights the whole line.
|
||||
|
||||
|
||||
### How to tweak it
|
||||
|
||||
This highlighter defines the following styles:
|
||||
|
||||
* `line` - the style for the whole line
|
||||
|
||||
To override one of those styles, change its entry in `ZSH_HIGHLIGHT_STYLES`,
|
||||
for example in `~/.zshrc`:
|
||||
|
||||
```zsh
|
||||
ZSH_HIGHLIGHT_STYLES[line]='bold'
|
||||
```
|
||||
|
||||
The syntax for values is the same as the syntax of "types of highlighting" of
|
||||
the zsh builtin `$zle_highlight` array, which is documented in [the `zshzle(1)`
|
||||
manual page][zshzle-Character-Highlighting].
|
||||
|
||||
[zshzle-Character-Highlighting]: https://zsh.sourceforge.io/Doc/Release/Zsh-Line-Editor.html#Character-Highlighting
|
||||
|
|
@ -0,0 +1,121 @@
|
|||
zsh-syntax-highlighting / highlighters / main
|
||||
---------------------------------------------
|
||||
|
||||
This is the `main` highlighter, that highlights:
|
||||
|
||||
* Commands
|
||||
* Options
|
||||
* Arguments
|
||||
* Paths
|
||||
* Strings
|
||||
|
||||
This highlighter is active by default.
|
||||
|
||||
|
||||
### How to tweak it
|
||||
|
||||
This highlighter defines the following styles:
|
||||
|
||||
* `unknown-token` - unknown tokens / errors
|
||||
* `reserved-word` - shell reserved words (`if`, `for`)
|
||||
* `alias` - aliases
|
||||
* `suffix-alias` - suffix aliases (requires zsh 5.1.1 or newer)
|
||||
* `global-alias` - global aliases
|
||||
* `builtin` - shell builtin commands (`shift`, `pwd`, `zstyle`)
|
||||
* `function` - function names
|
||||
* `command` - command names
|
||||
* `precommand` - precommand modifiers (e.g., `noglob`, `builtin`)
|
||||
* `commandseparator` - command separation tokens (`;`, `&&`)
|
||||
* `hashed-command` - hashed commands
|
||||
* `autodirectory` - a directory name in command position when the `AUTO_CD` option is set
|
||||
* `path` - existing filenames
|
||||
* `path_pathseparator` - path separators in filenames (`/`); if unset, `path` is used (default)
|
||||
* `path_prefix` - prefixes of existing filenames
|
||||
* `path_prefix_pathseparator` - path separators in prefixes of existing filenames (`/`); if unset, `path_prefix` is used (default)
|
||||
* `globbing` - globbing expressions (`*.txt`)
|
||||
* `history-expansion` - history expansion expressions (`!foo` and `^foo^bar`)
|
||||
* `command-substitution` - command substitutions (`$(echo foo)`)
|
||||
* `command-substitution-unquoted` - an unquoted command substitution (`$(echo foo)`)
|
||||
* `command-substitution-quoted` - a quoted command substitution (`"$(echo foo)"`)
|
||||
* `command-substitution-delimiter` - command substitution delimiters (`$(` and `)`)
|
||||
* `command-substitution-delimiter-unquoted` - an unquoted command substitution delimiters (`$(` and `)`)
|
||||
* `command-substitution-delimiter-quoted` - a quoted command substitution delimiters (`"$(` and `)"`)
|
||||
* `process-substitution` - process substitutions (`<(echo foo)`)
|
||||
* `process-substitution-delimiter` - process substitution delimiters (`<(` and `)`)
|
||||
* `arithmetic-expansion` - arithmetic expansion `$(( 42 ))`)
|
||||
* `single-hyphen-option` - single-hyphen options (`-o`)
|
||||
* `double-hyphen-option` - double-hyphen options (`--option`)
|
||||
* `back-quoted-argument` - backtick command substitution (`` `foo` ``)
|
||||
* `back-quoted-argument-unclosed` - unclosed backtick command substitution (`` `foo ``)
|
||||
* `back-quoted-argument-delimiter` - backtick command substitution delimiters (`` ` ``)
|
||||
* `single-quoted-argument` - single-quoted arguments (`` 'foo' ``)
|
||||
* `single-quoted-argument-unclosed` - unclosed single-quoted arguments (`` 'foo ``)
|
||||
* `double-quoted-argument` - double-quoted arguments (`` "foo" ``)
|
||||
* `double-quoted-argument-unclosed` - unclosed double-quoted arguments (`` "foo ``)
|
||||
* `dollar-quoted-argument` - dollar-quoted arguments (`` $'foo' ``)
|
||||
* `dollar-quoted-argument-unclosed` - unclosed dollar-quoted arguments (`` $'foo ``)
|
||||
* `rc-quote` - two single quotes inside single quotes when the `RC_QUOTES` option is set (`` 'foo''bar' ``)
|
||||
* `dollar-double-quoted-argument` - parameter expansion inside double quotes (`$foo` inside `""`)
|
||||
* `back-double-quoted-argument` - backslash escape sequences inside double-quoted arguments (`\"` in `"foo\"bar"`)
|
||||
* `back-dollar-quoted-argument` - backslash escape sequences inside dollar-quoted arguments (`\x` in `$'\x48'`)
|
||||
* `assign` - parameter assignments (`x=foo` and `x=( )`)
|
||||
* `redirection` - redirection operators (`<`, `>`, etc)
|
||||
* `comment` - comments, when `setopt INTERACTIVE_COMMENTS` is in effect (`echo # foo`)
|
||||
* `comment` - elided parameters in command position (`$x ls` when `$x` is unset or empty)
|
||||
* `named-fd` - named file descriptor (the `fd` in `echo foo {fd}>&2`)
|
||||
* `numeric-fd` - numeric file descriptor (the `2` in `echo foo {fd}>&2`)
|
||||
* `arg0` - a command word other than one of those enumerated above (other than a command, precommand, alias, function, or shell builtin command).
|
||||
* `default` - everything else
|
||||
|
||||
To override one of those styles, change its entry in `ZSH_HIGHLIGHT_STYLES`,
|
||||
for example in `~/.zshrc`:
|
||||
|
||||
```zsh
|
||||
# Declare the variable
|
||||
typeset -A ZSH_HIGHLIGHT_STYLES
|
||||
|
||||
# To differentiate aliases from other command types
|
||||
ZSH_HIGHLIGHT_STYLES[alias]='fg=magenta,bold'
|
||||
|
||||
# To have paths colored instead of underlined
|
||||
ZSH_HIGHLIGHT_STYLES[path]='fg=cyan'
|
||||
|
||||
# To disable highlighting of globbing expressions
|
||||
ZSH_HIGHLIGHT_STYLES[globbing]='none'
|
||||
```
|
||||
|
||||
The syntax for values is the same as the syntax of "types of highlighting" of
|
||||
the zsh builtin `$zle_highlight` array, which is documented in [the `zshzle(1)`
|
||||
manual page][zshzle-Character-Highlighting].
|
||||
|
||||
#### Parameters
|
||||
|
||||
To avoid partial path lookups on a path, add the path to the `ZSH_HIGHLIGHT_DIRS_BLACKLIST` array.
|
||||
|
||||
```zsh
|
||||
ZSH_HIGHLIGHT_DIRS_BLACKLIST+=(/mnt/slow_share)
|
||||
```
|
||||
|
||||
### Useless trivia
|
||||
|
||||
#### Forward compatibility.
|
||||
|
||||
zsh-syntax-highlighting attempts to be forward-compatible with zsh.
|
||||
Specifically, we attempt to facilitate highlighting _command word_ types that
|
||||
had not yet been invented when this version of zsh-syntax-highlighting was
|
||||
released.
|
||||
|
||||
A _command word_ is something like a function name, external command name, et
|
||||
cetera. (See
|
||||
[Simple Commands & Pipelines in `zshmisc(1)`][zshmisc-Simple-Commands-And-Pipelines]
|
||||
for a formal definition.)
|
||||
|
||||
If a new _kind_ of command word is ever added to zsh — something conceptually
|
||||
different than "function" and "alias" and "external command" — then command words
|
||||
of that (new) kind will be highlighted by the style `arg0_$kind`,
|
||||
where `$kind` is the output of `type -w` on the new kind of command word. If that
|
||||
style is not defined, then the style `arg0` will be used instead.
|
||||
|
||||
[zshmisc-Simple-Commands-And-Pipelines]: https://zsh.sourceforge.io/Doc/Release/Shell-Grammar.html#Simple-Commands-_0026-Pipelines
|
||||
|
||||
[zshzle-Character-Highlighting]: https://zsh.sourceforge.io/Doc/Release/Zsh-Line-Editor.html#Character-Highlighting
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
zsh-syntax-highlighting / highlighters / pattern
|
||||
------------------------------------------------
|
||||
|
||||
This is the `pattern` highlighter, that highlights user-defined patterns.
|
||||
|
||||
|
||||
### How to tweak it
|
||||
|
||||
To use this highlighter, associate patterns with styles in the
|
||||
`ZSH_HIGHLIGHT_PATTERNS` associative array, for example in `~/.zshrc`:
|
||||
|
||||
```zsh
|
||||
# Declare the variable
|
||||
typeset -A ZSH_HIGHLIGHT_PATTERNS
|
||||
|
||||
# To have commands starting with `rm -rf` in red:
|
||||
ZSH_HIGHLIGHT_PATTERNS+=('rm -rf *' 'fg=white,bold,bg=red')
|
||||
```
|
||||
|
||||
The syntax for values is the same as the syntax of "types of highlighting" of
|
||||
the zsh builtin `$zle_highlight` array, which is documented in [the `zshzle(1)`
|
||||
manual page][zshzle-Character-Highlighting].
|
||||
|
||||
[zshzle-Character-Highlighting]: https://zsh.sourceforge.io/Doc/Release/Zsh-Line-Editor.html#Character-Highlighting
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
zsh-syntax-highlighting / highlighters / regexp
|
||||
------------------------------------------------
|
||||
|
||||
This is the `regexp` highlighter, that highlights user-defined regular
|
||||
expressions. It's similar to the `pattern` highlighter, but allows more complex
|
||||
patterns.
|
||||
|
||||
### How to tweak it
|
||||
|
||||
To use this highlighter, associate regular expressions with styles in the
|
||||
`ZSH_HIGHLIGHT_REGEXP` associative array, for example in `~/.zshrc`:
|
||||
|
||||
```zsh
|
||||
typeset -A ZSH_HIGHLIGHT_REGEXP
|
||||
ZSH_HIGHLIGHT_REGEXP+=('^rm .*' fg=red,bold)
|
||||
```
|
||||
|
||||
This will highlight lines that start with a call to the `rm` command.
|
||||
|
||||
The regular expressions flavour used is [PCRE][pcresyntax] when the
|
||||
`RE_MATCH_PCRE` option is set and POSIX Extended Regular Expressions (ERE),
|
||||
as implemented by the platform's C library, otherwise. For details on the
|
||||
latter, see [the `zsh/regex` module's documentation][MAN_ZSH_REGEX] and the
|
||||
`regcomp(3)` and `re_format(7)` manual pages on your system.
|
||||
|
||||
For instance, to highlight `sudo` only as a complete word, i.e., `sudo cmd`,
|
||||
but not `sudoedit`, one might use:
|
||||
|
||||
* When the `RE_MATCH_PCRE` is set:
|
||||
|
||||
```zsh
|
||||
typeset -A ZSH_HIGHLIGHT_REGEXP
|
||||
ZSH_HIGHLIGHT_REGEXP+=('\bsudo\b' fg=123,bold)
|
||||
```
|
||||
|
||||
* When the `RE_MATCH_PCRE` is unset, on platforms with GNU `libc` (e.g., many GNU/Linux distributions):
|
||||
|
||||
```zsh
|
||||
typeset -A ZSH_HIGHLIGHT_REGEXP
|
||||
ZSH_HIGHLIGHT_REGEXP+=('\<sudo\>' fg=123,bold)
|
||||
```
|
||||
|
||||
* When the `RE_MATCH_PCRE` is unset, on BSD-based platforms (e.g., macOS):
|
||||
|
||||
```zsh
|
||||
typeset -A ZSH_HIGHLIGHT_REGEXP
|
||||
ZSH_HIGHLIGHT_REGEXP+=('[[:<:]]sudo[[:>:]]' fg=123,bold)
|
||||
```
|
||||
|
||||
Note, however, that PCRE and POSIX ERE have a large common subset:
|
||||
for instance, the regular expressions `[abc]`, `a*`, and `(a|b)` have the same
|
||||
meaning in both flavours.
|
||||
|
||||
The syntax for values is the same as the syntax of "types of highlighting" of
|
||||
the zsh builtin `$zle_highlight` array, which is documented in [the `zshzle(1)`
|
||||
manual page][zshzle-Character-Highlighting].
|
||||
|
||||
See also: [regular expressions tutorial][perlretut], zsh regexp operator `=~`
|
||||
in [the `zshmisc(1)` manual page][zshmisc-Conditional-Expressions]
|
||||
|
||||
[zshzle-Character-Highlighting]: https://zsh.sourceforge.io/Doc/Release/Zsh-Line-Editor.html#Character-Highlighting
|
||||
[perlretut]: https://perldoc.perl.org/perlretut
|
||||
[zshmisc-Conditional-Expressions]: https://zsh.sourceforge.io/Doc/Release/Conditional-Expressions.html#Conditional-Expressions
|
||||
[MAN_ZSH_REGEX]: https://zsh.sourceforge.io/Doc/Release/Zsh-Modules.html#The-zsh_002fregex-Module
|
||||
[pcresyntax]: https://www.pcre.org/original/doc/html/pcresyntax.html
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
zsh-syntax-highlighting / highlighters / root
|
||||
---------------------------------------------
|
||||
|
||||
This is the `root` highlighter, that highlights the whole line if the current
|
||||
user is root.
|
||||
|
||||
|
||||
### How to tweak it
|
||||
|
||||
This highlighter defines the following styles:
|
||||
|
||||
* `root` - the style for the whole line if the current user is root.
|
||||
|
||||
To override one of those styles, change its entry in `ZSH_HIGHLIGHT_STYLES`,
|
||||
for example in `~/.zshrc`:
|
||||
|
||||
```zsh
|
||||
ZSH_HIGHLIGHT_STYLES[root]='bg=red'
|
||||
```
|
||||
|
||||
The syntax for values is the same as the syntax of "types of highlighting" of
|
||||
the zsh builtin `$zle_highlight` array, which is documented in [the `zshzle(1)`
|
||||
manual page][zshzle-Character-Highlighting].
|
||||
|
||||
[zshzle-Character-Highlighting]: https://zsh.sourceforge.io/Doc/Release/Zsh-Line-Editor.html#Character-Highlighting
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
zsh-syntax-highlighting / highlighters
|
||||
======================================
|
||||
|
||||
Navigate into the individual highlighters' documentation to see
|
||||
what styles (`$ZSH_HIGHLIGHT_STYLES` keys) each highlighter defines.
|
||||
|
||||
Refer to the [documentation on highlighters](../docs/highlighters.md) for further
|
||||
information.
|
||||
|
|
@ -0,0 +1,107 @@
|
|||
# -------------------------------------------------------------------------------------------------
|
||||
# Copyright (c) 2010-2017 zsh-syntax-highlighting contributors
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification, are permitted
|
||||
# provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice, this list of conditions
|
||||
# and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright notice, this list of
|
||||
# conditions and the following disclaimer in the documentation and/or other materials provided
|
||||
# with the distribution.
|
||||
# * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software without specific prior
|
||||
# written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
||||
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
|
||||
# vim: ft=zsh sw=2 ts=2 et
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
# Define default styles.
|
||||
: ${ZSH_HIGHLIGHT_STYLES[bracket-error]:=fg=red,bold}
|
||||
: ${ZSH_HIGHLIGHT_STYLES[bracket-level-1]:=fg=blue,bold}
|
||||
: ${ZSH_HIGHLIGHT_STYLES[bracket-level-2]:=fg=green,bold}
|
||||
: ${ZSH_HIGHLIGHT_STYLES[bracket-level-3]:=fg=magenta,bold}
|
||||
: ${ZSH_HIGHLIGHT_STYLES[bracket-level-4]:=fg=yellow,bold}
|
||||
: ${ZSH_HIGHLIGHT_STYLES[bracket-level-5]:=fg=cyan,bold}
|
||||
: ${ZSH_HIGHLIGHT_STYLES[cursor-matchingbracket]:=standout}
|
||||
|
||||
# Whether the brackets highlighter should be called or not.
|
||||
_zsh_highlight_highlighter_brackets_predicate()
|
||||
{
|
||||
[[ $WIDGET == zle-line-finish ]] || _zsh_highlight_cursor_moved || _zsh_highlight_buffer_modified
|
||||
}
|
||||
|
||||
# Brackets highlighting function.
|
||||
_zsh_highlight_highlighter_brackets_paint()
|
||||
{
|
||||
local char style
|
||||
local -i bracket_color_size=${#ZSH_HIGHLIGHT_STYLES[(I)bracket-level-*]} buflen=${#BUFFER} level=0 matchingpos pos
|
||||
local -A levelpos lastoflevel matching
|
||||
|
||||
# Find all brackets and remember which one is matching
|
||||
pos=0
|
||||
for char in ${(s..)BUFFER} ; do
|
||||
(( ++pos ))
|
||||
case $char in
|
||||
["([{"])
|
||||
levelpos[$pos]=$((++level))
|
||||
lastoflevel[$level]=$pos
|
||||
;;
|
||||
[")]}"])
|
||||
if (( level > 0 )); then
|
||||
matchingpos=$lastoflevel[$level]
|
||||
levelpos[$pos]=$((level--))
|
||||
if _zsh_highlight_brackets_match $matchingpos $pos; then
|
||||
matching[$matchingpos]=$pos
|
||||
matching[$pos]=$matchingpos
|
||||
fi
|
||||
else
|
||||
levelpos[$pos]=-1
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Now highlight all found brackets
|
||||
for pos in ${(k)levelpos}; do
|
||||
if (( $+matching[$pos] )); then
|
||||
if (( bracket_color_size )); then
|
||||
_zsh_highlight_add_highlight $((pos - 1)) $pos bracket-level-$(( (levelpos[$pos] - 1) % bracket_color_size + 1 ))
|
||||
fi
|
||||
else
|
||||
_zsh_highlight_add_highlight $((pos - 1)) $pos bracket-error
|
||||
fi
|
||||
done
|
||||
|
||||
# If cursor is on a bracket, then highlight corresponding bracket, if any.
|
||||
if [[ $WIDGET != zle-line-finish ]]; then
|
||||
pos=$((CURSOR + 1))
|
||||
if (( $+levelpos[$pos] )) && (( $+matching[$pos] )); then
|
||||
local -i otherpos=$matching[$pos]
|
||||
_zsh_highlight_add_highlight $((otherpos - 1)) $otherpos cursor-matchingbracket
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Helper function to differentiate type
|
||||
_zsh_highlight_brackets_match()
|
||||
{
|
||||
case $BUFFER[$1] in
|
||||
\() [[ $BUFFER[$2] == \) ]];;
|
||||
\[) [[ $BUFFER[$2] == \] ]];;
|
||||
\{) [[ $BUFFER[$2] == \} ]];;
|
||||
*) false;;
|
||||
esac
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
# -------------------------------------------------------------------------------------------------
|
||||
# Copyright (c) 2016 zsh-syntax-highlighting contributors
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification, are permitted
|
||||
# provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice, this list of conditions
|
||||
# and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright notice, this list of
|
||||
# conditions and the following disclaimer in the documentation and/or other materials provided
|
||||
# with the distribution.
|
||||
# * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software without specific prior
|
||||
# written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
||||
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
|
||||
# vim: ft=zsh sw=2 ts=2 et
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
|
||||
WIDGET=zle-line-finish
|
||||
|
||||
BUFFER=': $foo[bar]'
|
||||
CURSOR=6 # cursor is zero-based
|
||||
|
||||
expected_region_highlight=(
|
||||
)
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
# -------------------------------------------------------------------------------------------------
|
||||
# Copyright (c) 2016 zsh-syntax-highlighting contributors
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification, are permitted
|
||||
# provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice, this list of conditions
|
||||
# and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright notice, this list of
|
||||
# conditions and the following disclaimer in the documentation and/or other materials provided
|
||||
# with the distribution.
|
||||
# * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software without specific prior
|
||||
# written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
||||
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
|
||||
# vim: ft=zsh sw=2 ts=2 et
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
|
||||
unsorted=1
|
||||
|
||||
ZSH_HIGHLIGHT_STYLES[bracket-level-1]=
|
||||
ZSH_HIGHLIGHT_STYLES[bracket-level-2]=
|
||||
ZSH_HIGHLIGHT_STYLES[bracket-level-3]=
|
||||
|
||||
BUFFER=': ((( )))'
|
||||
CURSOR=2 # cursor is zero-based
|
||||
|
||||
expected_region_highlight=(
|
||||
"3 3 bracket-level-1"
|
||||
"4 4 bracket-level-2"
|
||||
"5 5 bracket-level-3"
|
||||
"7 7 bracket-level-3"
|
||||
"8 8 bracket-level-2"
|
||||
"9 9 bracket-level-1"
|
||||
"9 9 cursor-matchingbracket"
|
||||
)
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
# -------------------------------------------------------------------------------------------------
|
||||
# Copyright (c) 2016 zsh-syntax-highlighting contributors
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification, are permitted
|
||||
# provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice, this list of conditions
|
||||
# and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright notice, this list of
|
||||
# conditions and the following disclaimer in the documentation and/or other materials provided
|
||||
# with the distribution.
|
||||
# * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software without specific prior
|
||||
# written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
||||
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
|
||||
# vim: ft=zsh sw=2 ts=2 et
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
|
||||
BUFFER=': (x)'
|
||||
|
||||
expected_region_highlight=(
|
||||
)
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
# -------------------------------------------------------------------------------------------------
|
||||
# Copyright (c) 2016 zsh-syntax-highlighting contributors
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification, are permitted
|
||||
# provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice, this list of conditions
|
||||
# and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright notice, this list of
|
||||
# conditions and the following disclaimer in the documentation and/or other materials provided
|
||||
# with the distribution.
|
||||
# * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software without specific prior
|
||||
# written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
||||
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
|
||||
# vim: ft=zsh sw=2 ts=2 et
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
|
||||
unsorted=1
|
||||
|
||||
ZSH_HIGHLIGHT_STYLES[bracket-level-1]=
|
||||
ZSH_HIGHLIGHT_STYLES[bracket-level-2]=
|
||||
ZSH_HIGHLIGHT_STYLES[bracket-level-3]=
|
||||
|
||||
BUFFER=': ({[({[(x)]})]})'
|
||||
|
||||
expected_region_highlight=(
|
||||
"3 3 bracket-level-1"
|
||||
"4 4 bracket-level-2"
|
||||
"5 5 bracket-level-3"
|
||||
"6 6 bracket-level-1"
|
||||
"7 7 bracket-level-2"
|
||||
"8 8 bracket-level-3"
|
||||
"9 9 bracket-level-1"
|
||||
"11 11 bracket-level-1"
|
||||
"12 12 bracket-level-3"
|
||||
"13 13 bracket-level-2"
|
||||
"14 14 bracket-level-1"
|
||||
"15 15 bracket-level-3"
|
||||
"16 16 bracket-level-2"
|
||||
"17 17 bracket-level-1"
|
||||
)
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
# -------------------------------------------------------------------------------------------------
|
||||
# Copyright (c) 2015 zsh-syntax-highlighting contributors
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification, are permitted
|
||||
# provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice, this list of conditions
|
||||
# and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright notice, this list of
|
||||
# conditions and the following disclaimer in the documentation and/or other materials provided
|
||||
# with the distribution.
|
||||
# * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software without specific prior
|
||||
# written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
||||
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
|
||||
# vim: ft=zsh sw=2 ts=2 et
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
|
||||
unsorted=1
|
||||
|
||||
ZSH_HIGHLIGHT_STYLES[bracket-level-1]=
|
||||
ZSH_HIGHLIGHT_STYLES[bracket-level-2]=
|
||||
|
||||
BUFFER='echo ({x}]'
|
||||
|
||||
expected_region_highlight=(
|
||||
"6 6 bracket-error" # (
|
||||
"7 7 bracket-level-2" # {
|
||||
"9 9 bracket-level-2" # }
|
||||
"10 10 bracket-error" # )
|
||||
)
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
# -------------------------------------------------------------------------------------------------
|
||||
# Copyright (c) 2016 zsh-syntax-highlighting contributors
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification, are permitted
|
||||
# provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice, this list of conditions
|
||||
# and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright notice, this list of
|
||||
# conditions and the following disclaimer in the documentation and/or other materials provided
|
||||
# with the distribution.
|
||||
# * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software without specific prior
|
||||
# written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
||||
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
|
||||
# vim: ft=zsh sw=2 ts=2 et
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
|
||||
unsorted=1
|
||||
|
||||
ZSH_HIGHLIGHT_STYLES[bracket-level-1]=
|
||||
ZSH_HIGHLIGHT_STYLES[bracket-level-2]=
|
||||
|
||||
BUFFER=': {"{x}"}'
|
||||
|
||||
expected_region_highlight=(
|
||||
"3 3 bracket-level-1"
|
||||
"5 5 bracket-level-2"
|
||||
"7 7 bracket-level-2"
|
||||
"9 9 bracket-level-1"
|
||||
)
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
# -------------------------------------------------------------------------------------------------
|
||||
# Copyright (c) 2015 zsh-syntax-highlighting contributors
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification, are permitted
|
||||
# provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice, this list of conditions
|
||||
# and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright notice, this list of
|
||||
# conditions and the following disclaimer in the documentation and/or other materials provided
|
||||
# with the distribution.
|
||||
# * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software without specific prior
|
||||
# written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
||||
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
|
||||
# vim: ft=zsh sw=2 ts=2 et
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
|
||||
unsorted=1
|
||||
|
||||
ZSH_HIGHLIGHT_STYLES[bracket-level-1]=
|
||||
ZSH_HIGHLIGHT_STYLES[bracket-level-2]=
|
||||
ZSH_HIGHLIGHT_STYLES[bracket-level-3]=
|
||||
|
||||
BUFFER='echo $(echo ${(z)array})'
|
||||
|
||||
expected_region_highlight=(
|
||||
"7 7 bracket-level-1" # (
|
||||
"14 14 bracket-level-2" # {
|
||||
"15 15 bracket-level-3" # (
|
||||
"17 17 bracket-level-3" # )
|
||||
"23 23 bracket-level-2" # }
|
||||
"24 24 bracket-level-1" # )
|
||||
)
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
# -------------------------------------------------------------------------------------------------
|
||||
# Copyright (c) 2017 zsh-syntax-highlighting contributors
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification, are permitted
|
||||
# provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice, this list of conditions
|
||||
# and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright notice, this list of
|
||||
# conditions and the following disclaimer in the documentation and/or other materials provided
|
||||
# with the distribution.
|
||||
# * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software without specific prior
|
||||
# written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
||||
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
|
||||
# vim: ft=zsh sw=2 ts=2 et
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
|
||||
BUFFER=': x)'
|
||||
|
||||
expected_region_highlight=(
|
||||
"4 4 bracket-error" # )
|
||||
)
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
# -------------------------------------------------------------------------------------------------
|
||||
# Copyright (c) 2015 zsh-syntax-highlighting contributors
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification, are permitted
|
||||
# provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice, this list of conditions
|
||||
# and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright notice, this list of
|
||||
# conditions and the following disclaimer in the documentation and/or other materials provided
|
||||
# with the distribution.
|
||||
# * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software without specific prior
|
||||
# written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
||||
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
|
||||
# vim: ft=zsh sw=2 ts=2 et
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
|
||||
BUFFER='echo "foo ( bar"'
|
||||
|
||||
expected_region_highlight=(
|
||||
"11 11 bracket-error"
|
||||
)
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
# -------------------------------------------------------------------------------------------------
|
||||
# Copyright (c) 2015 zsh-syntax-highlighting contributors
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification, are permitted
|
||||
# provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice, this list of conditions
|
||||
# and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright notice, this list of
|
||||
# conditions and the following disclaimer in the documentation and/or other materials provided
|
||||
# with the distribution.
|
||||
# * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software without specific prior
|
||||
# written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
||||
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
|
||||
# vim: ft=zsh sw=2 ts=2 et
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
|
||||
unsorted=1
|
||||
|
||||
ZSH_HIGHLIGHT_STYLES[bracket-level-1]=
|
||||
ZSH_HIGHLIGHT_STYLES[bracket-level-2]=
|
||||
|
||||
BUFFER='echo ({x})'
|
||||
|
||||
expected_region_highlight=(
|
||||
"6 6 bracket-level-1" # (
|
||||
"7 7 bracket-level-2" # {
|
||||
"9 9 bracket-level-2" # }
|
||||
"10 10 bracket-level-1" # )
|
||||
)
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
# -------------------------------------------------------------------------------------------------
|
||||
# Copyright (c) 2015 zsh-syntax-highlighting contributors
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification, are permitted
|
||||
# provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice, this list of conditions
|
||||
# and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright notice, this list of
|
||||
# conditions and the following disclaimer in the documentation and/or other materials provided
|
||||
# with the distribution.
|
||||
# * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software without specific prior
|
||||
# written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
||||
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
|
||||
# vim: ft=zsh sw=2 ts=2 et
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
|
||||
unsorted=1
|
||||
|
||||
ZSH_HIGHLIGHT_STYLES[bracket-level-1]=
|
||||
ZSH_HIGHLIGHT_STYLES[bracket-level-2]=
|
||||
|
||||
BUFFER='echo ({x}'
|
||||
|
||||
expected_region_highlight=(
|
||||
"6 6 bracket-error" # (
|
||||
"7 7 bracket-level-2" # {
|
||||
"9 9 bracket-level-2" # }
|
||||
)
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue