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

@mrhassell
Copy link

or complimenting?

@matijaoe
Copy link

@mrhassell I do not know, that's why I'm asking 🙂 I'm all for them complimenting each other.

@chojuninengu
Copy link

this is so amazing

@Eboubaker
Copy link

Eboubaker commented Nov 7, 2024

in the end of .zshrc add these lines to stop zsh-autocomplete from overriding <- and -> keys to make the menu cursor move

bindkey -M menuselect "^[OD"   .backward-char # ←
bindkey -M menuselect "^[OC"    .forward-char # →
bindkey -M menuselect "^[b"    .backward-word # ⌥ + ←
bindkey -M menuselect "^[f"     .forward-word # ⌥ + →
bindkey -M menuselect "^A" .beginning-of-line # ⌘ + ←
bindkey -M menuselect "^E"       .end-of-line # ⌘ + →

now it will move inside the command itself, hope this helps!

@SterlingReeves
Copy link

Thank you so much for your help.

@scardracs
Copy link

This is the most useful gist I've seen in a while! Ty!

@slevysh
Copy link

slevysh commented Nov 19, 2024

For what use both plugins zsh-syntax-highlighting and fast-syntax-highlighting instead one of them?

@Sh4dowKaix64
Copy link

Woww thanks

@LeAnhTuan12101994
Copy link

Thanks <3

@gloatoriginal
Copy link

Thank you for the write-up and easy to install commands, I have installed this on all my linux machines and each time it's cut-and-dry copy-and-paste commands, thank you!

@seungjulee
Copy link

I find fzf-tab to be better than zsh-autocomplete. You can't use both as it collides.

refer to this gist if you wanna use fzf for autocomplete

https://gist.github.com/seungjulee/d72883c193ac630aac77e0602cb18270

@hgspch
Copy link

hgspch commented Feb 2, 2025

no tedious web search and works instantly, thank you

@nawarkhede
Copy link

Nice, but it's slowing down the system, and I'm not sure why. There's a lag when I enter commands in the terminal. By the way, thanks for accommodating this in one gist.

@MNMaqsood
Copy link

I have created a script to automate this process, check here
https://github.com/MNMaqsood/oh-my-zsh-installer/

@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!!

@material-kish
Copy link

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!

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