From 3fb0731d4ee02f15ef1b235a0a1622df7727b386 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Av=C3=A9?= Date: Fri, 23 Jun 2023 15:42:41 +0200 Subject: [PATCH] Add autosuggestions --- .gitmodules | 3 +++ install.sh | 2 +- zsh/.zshrc | 13 ++++++------- zsh/zsh-autocomplete | 1 + 4 files changed, 11 insertions(+), 8 deletions(-) create mode 160000 zsh/zsh-autocomplete diff --git a/.gitmodules b/.gitmodules index e3164f3..917e2c1 100644 --- a/.gitmodules +++ b/.gitmodules @@ -7,3 +7,6 @@ [submodule "zsh/powerlevel10k"] path = zsh/powerlevel10k url = https://github.com/romkatv/powerlevel10k.git +[submodule "zsh/zsh-autocomplete"] + path = zsh/zsh-autocomplete + url = https://github.com/marlonrichert/zsh-autocomplete.git diff --git a/install.sh b/install.sh index a0c536d..c3f2b5e 100755 --- a/install.sh +++ b/install.sh @@ -61,7 +61,7 @@ if $ZSH; then PROFILE=true dependencies="fzf zsh curl" if [[ $OS == "NAME=\"Arch Linux\"" ]]; then - $SUDO pacman -Sy --needed --noconfirm $dependencies + $SUDO pacman -Sy --needed --noconfirm $dependencies zsh-autosuggestions echo "Please manually install yay and autojump-rs" elif [[ $OS == "NAME=\"Ubuntu\"" ]]; then $SUDO apt update diff --git a/zsh/.zshrc b/zsh/.zshrc index 6438357..96c1ec7 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -68,7 +68,7 @@ zle -N down-line-or-beginning-search zstyle ':completion:*' matcher-list '' 'm:{a-zA-Z}={A-Za-z}' 'r:|=*' 'l:|=* r:|=*' zstyle ':completion::complete:*' gain-privileges 1 -autoload -Uz compinit && compinit +zstyle ':completion:*' rehash true if [ -f "/usr/share/doc/pkgfile/command-not-found.zsh" ]; then @@ -84,6 +84,11 @@ elif [ -f "/usr/share/fzf/key-bindings.zsh" ]; then source /usr/share/fzf/completion.zsh fi +# Autosuggestions +if [ -f "/usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh" ]; then + source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh +fi + autoload -Uz compinit compinit -d "$XDG_CACHE_HOME"/zsh/zcompdump-"$ZSH_VERSION" @@ -96,12 +101,6 @@ source $XDG_CONFIG_HOME/zsh/powerlevel10k/powerlevel10k.zsh-theme # To customize prompt, run `p10k configure` or edit ~/.config/zsh/.p10k.zsh. [[ ! -f ~/.config/zsh/.p10k.zsh ]] || source ~/.config/zsh/.p10k.zsh -# Preferred editor for local and remote sessions -# if [[ -n $SSH_CONNECTION ]]; then -# else -# export EDITOR='mvim' -# fi - unsetopt share_history # Compilation flags diff --git a/zsh/zsh-autocomplete b/zsh/zsh-autocomplete new file mode 160000 index 0000000..e327674 --- /dev/null +++ b/zsh/zsh-autocomplete @@ -0,0 +1 @@ +Subproject commit e327674284e753c16021976fcbdd178eef2bcdcf