Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save n1snt/454b879b8f0b7995740ae04c5fb5b7df to your computer and use it in GitHub Desktop.
Save n1snt/454b879b8f0b7995740ae04c5fb5b7df to your computer and use it in GitHub Desktop.
Oh my ZSH with zsh-autosuggestions zsh-syntax-highlighting zsh-fast-syntax-highlighting and zsh-autocomplete.md

Oh my zsh.

Oh My Zsh

Install ZSH.

sudo apt install zsh-autosuggestions zsh-syntax-highlighting zsh

Install Oh my ZSH.

sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

Install plugins.

  • autosuggesions plugin

    git clone https://github.com/zsh-users/zsh-autosuggestions.git $ZSH_CUSTOM/plugins/zsh-autosuggestions

  • zsh-syntax-highlighting plugin

    git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $ZSH_CUSTOM/plugins/zsh-syntax-highlighting

  • zsh-fast-syntax-highlighting plugin

    git clone https://github.com/zdharma-continuum/fast-syntax-highlighting.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/fast-syntax-highlighting

  • zsh-autocomplete plugin

    git clone --depth 1 -- https://github.com/marlonrichert/zsh-autocomplete.git $ZSH_CUSTOM/plugins/zsh-autocomplete

Enable plugins by adding them to .zshrc.

  • Open .zshrc

    nvim ~/.zshrc

  • Find the line which says plugins=(git).

  • Replace that line with plugins=(git zsh-autosuggestions zsh-syntax-highlighting fast-syntax-highlighting zsh-autocomplete)

References

@remitoudic
Copy link

Again ! It has never been so uncomplicated. Congratulations to you, n1snt

@anderson-pids
Copy link

great!!

@C9b3rD3vi1
Copy link

This is just amazing!!

@jacob-fm
Copy link

jacob-fm commented Mar 5, 2025

When I go to my previous command by pressing the up arrow key, a semicolon is added to the end of the line. Does anyone know why this happens, or how to disable it?

@PhilipLutley
Copy link

+1 for the semicolon ; being appended when using the up arrow key.

@AmenB
Copy link

AmenB commented Mar 12, 2025

Thanks!

@marlonrichert
Copy link

@jacob-fm @PhilipLutley Zsh Autocomplete does that so that you can press Ctrl-Space to insert multiple history lines. It goes away automatically when you type something.

@jacob-fm
Copy link

@marlonrichert is there an easy way to disable that?

@linkonabe
Copy link

Bravo

@fadilsflow
Copy link

KELAS KING - atmin

@GiaKhangLuu
Copy link

Words cannot describe my gratitude!!!

@Tjkent88
Copy link

great write up and plugin combination, thanks!

@evsar3
Copy link

evsar3 commented Jun 19, 2025

🔥

@yaozzzhao
Copy link

I asked AI to write a script for me to do the tricks above. :) It works well in my environment.

#!/bin/bash

# install ZSH and related packages
echo "Installing ZSH and related packages..."
sudo apt install zsh-autosuggestions zsh-syntax-highlighting zsh -y

# Install Oh My ZSH
echo "Installing Oh My ZSH..."
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended

# Install plugins
echo "Installing ZSH plugins..."

# autosuggestions
git clone https://github.com/zsh-users/zsh-autosuggestions.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

# syntax-highlighting
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

# fast-syntax-highlighting
git clone https://github.com/zdharma-continuum/fast-syntax-highlighting.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/fast-syntax-highlighting

# autocomplete
git clone --depth 1 -- https://github.com/marlonrichert/zsh-autocomplete.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-autocomplete

# Change .zshrc file
echo "Configuring .zshrc..."
sed -i 's/plugins=(git)/plugins=(git zsh-autosuggestions zsh-syntax-highlighting fast-syntax-highlighting zsh-autocomplete)/' ~/.zshrc

# switch to zsh as default shell
echo "Changing default shell to ZSH..."
chsh -s $(which zsh)

echo "Installation completed! Please restart your terminal or run 'source ~/.zshrc' to apply changes."

@marlonrichert
Copy link

@jacob-fm

is there an easy way to disable that?

Not at the moment, but feel free to submit a pull request. It's not hard to implement. You'll need to change only a small part of the code

@sPalmiro
Copy link

I should have listened to "Do we want to mix all of those? Aren't some of them competing?"... zsh-autocomplete won't play ball with fast-syntax-highlighting. Many thanks for the gist.

@vanduc2708
Copy link

Thanks for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment