Update dotfiles/.bashrc, dotfiles/.zshrc, dotfiles/.config/zsh-autocomplete.sh

This commit is contained in:
Brian Zalewski 2022-11-02 13:08:29 +00:00
parent f51eb2cc46
commit 4258fde668
3 changed files with 117 additions and 0 deletions

View file

@ -66,6 +66,11 @@ if [ "$0" = 'bash' ] || [ "$0" = '/bin/bash' ]; then
. "$HOME/.local/asdf/plugins/java/set-java-home.bash"
fi
### zoxide
if command -v zoxide > /dev/null; then
eval "$(zoxide init --cmd cd zsh)"
fi
### Fig
if [ -f "$HOME/.fig/shell/bashrc.post.bash" ]; then
. "$HOME/.fig/shell/bashrc.post.bash"

View file

@ -0,0 +1,99 @@
#!/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.

View file

@ -321,10 +321,18 @@ if command -v antigen > /dev/null; then
antigen bundle ProfessorManhattan/zsh-completions src
antigen bundle zsh-users/zsh-autosuggestions
antigen bundle zsh-users/zsh-syntax-highlighting
antigen bundle marlonrichert/zsh-autocomplete
antigen theme romkatv/powerlevel10k
antigen apply
fi
### ZSH Autocomplete
zstyle ':autocomplete:*' list-lines 14
zstyle ':autocomplete:history-search:*' list-lines 14
zstyle ':autocomplete:history-incremental-search-*:*' list-lines 14
zstyle ':autocomplete:*' fzf-completion yes
zstyle ':autocomplete:recent-dirs' backend zoxide
# oh-my-zsh might be overwriting the ls command so placing it here as well as fix
command -v lsd > /dev/null && alias ls='lsd --group-dirs first' && \
alias tree='lsd --tree'
@ -380,6 +388,11 @@ if command -v volta > /dev/null; then
eval $(volta completions zsh)
fi
### zoxide
if command -v zoxide > /dev/null; then
eval "$(zoxide init --cmd cd zsh)"
fi
### Fig
if [ -f "$HOME/.fig/shell/zshrc.post.zsh" ]; then
source "$HOME/.fig/shell/zshrc.post.zsh"