Configurando autocomplete e history no zsh

28 Jan 2026 · rogeriolima · linux · 12 visualizações

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)

Configure history unique for all zsh sessions.

  • Adicionar ao topo do arquivo .zshrc
# =====================================
# History compartilhado
# =====================================
HISTFILE=~/.zsh_history
HISTSIZE=100000
SAVEHIST=100000

setopt SHARE_HISTORY
setopt INC_APPEND_HISTORY
setopt EXTENDED_HISTORY
setopt HIST_IGNORE_DUPS
setopt HIST_IGNORE_ALL_DUPS
setopt HIST_REDUCE_BLANKS
setopt HIST_VERIFY
setopt HIST_EXPIRE_DUPS_FIRST

# =====================================
# Sync history entre terminais
# =====================================
autoload -Uz add-zsh-hook

sync_history() {
  fc -R
}
add-zsh-hook precmd sync_history

# =====================================
# Oh My Zsh
# =====================================
export ZSH="$HOME/.oh-my-zsh"

plugins=(
  git
  zsh-autosuggestions
  zsh-syntax-highlighting
  history
)

source $ZSH/oh-my-zsh.sh

 

Pesquisar

Sobre o autor

Professor de programacao e desenvolvedor de software. Escrevo sobre tecnologia, algoritmos e boas praticas com exemplos e tutoriais.

Categorias

  1. linux (1)
  2. report (1)
  3. segurança (1)

Arquivos

  1. Fevereiro 2026 (1)
  2. Janeiro 2026 (2)

Comentários

Seja o primeiro a comentar.

Deixe seu comentário