install.fairie/dotfiles/.config/zsh-autocomplete.sh

99 lines
3.6 KiB
Bash

#!/bin/zsh
# The code below sets all of Autocomplete's settings to their default values. To
# change a setting, copy it into your `.zshrc` file and modify it there.
zstyle ':autocomplete:*' default-context ''
# '': Start each new command line with normal autocompletion.
# history-incremental-search-backward: Start in live history search mode.
zstyle ':autocomplete:*' min-delay 0.05 # seconds (float)
# Wait this many seconds for typing to stop, before showing completions.
zstyle ':autocomplete:*' min-input 0 # characters (int)
# Wait until this many characters have been typed, before showing completions.
zstyle ':autocomplete:*' ignored-input '' # extended glob pattern
# '': Always show completions.
# '..##': Don't show completions for the current word, if it consists of two
# or more dots.
zstyle ':autocomplete:*' list-lines 14 # int
# If there are fewer than this many lines below the prompt, move the prompt up
# to make room for showing this many lines of completions (approximately).
zstyle ':autocomplete:history-search:*' list-lines 14 # int
# Show this many history lines when pressing ↑.
zstyle ':autocomplete:history-incremental-search-*:*' list-lines 14 # int
# Show this many history lines when pressing ⌃R or ⌃S.
zstyle ':autocomplete:*' insert-unambiguous no
# no: Tab inserts the top completion.
# yes: Tab first inserts a substring common to all listed completions, if any.
zstyle ':autocomplete:*' fzf-completion yes
# no: Tab uses Zsh's completion system only.
# yes: Tab first tries Fzf's completion, then falls back to Zsh's.
# ⚠️ NOTE: This setting can NOT be changed at runtime and requires that you
# have installed Fzf's shell extensions.
# Add a space after these completions:
zstyle ':autocomplete:*' add-space \
executables aliases functions builtins reserved-words commands
##
# Config in this section should come BEFORE sourcing Autocomplete and cannot be
# changed at runtime.
#
# Autocomplete automatically selects a backend for its recent dirs completions.
# So, normally you won't need to change this.
# However, you can set it if you find that the wrong backend is being used.
zstyle ':autocomplete:recent-dirs' backend cdr
# cdr: Use Zsh's `cdr` function to show recent directories as completions.
# no: Don't show recent directories.
# zsh-z|zoxide|z.lua|z.sh|autojump|fasd: Use this instead (if installed).
# ⚠️ NOTE: This setting can NOT be changed at runtime.
zstyle ':autocomplete:*' widget-style complete-word
# complete-word: (Shift-)Tab inserts the top (bottom) completion.
# menu-complete: Press again to cycle to next (previous) completion.
# menu-select: Same as `menu-complete`, but updates selection in menu.
# ⚠️ NOTE: This setting can NOT be changed at runtime.
source /path/to/zsh-autocomplete.plugin.zsh
##
# Config in this section should come AFTER sourcing Autocomplete.
#
# Up arrow:
bindkey '\e[A' up-line-or-search
bindkey '\eOA' up-line-or-search
# up-line-or-search: Open history menu.
# up-line-or-history: Cycle to previous history line.
# Down arrow:
bindkey '\e[B' down-line-or-select
bindkey '\eOB' down-line-or-select
# down-line-or-select: Open completion menu.
# down-line-or-history: Cycle to next history line.
# Control-Space:
bindkey '\0' list-expand
# list-expand: Reveal hidden completions.
# set-mark-command: Activate text selection.
# Uncomment the following lines to disable live history search:
# zle -A {.,}history-incremental-search-forward
# zle -A {.,}history-incremental-search-backward
# Return key in completion menu & history menu:
bindkey -M menuselect '\r' .accept-line
# .accept-line: Accept command line.
# accept-line: Accept selection and exit menu.