Bash completions don't seem to be working #79
-
I just installed However I don't get completions for the Click to expand#!/usr/bin/env zsh
# Znap! The lightweight plugin manager that's easy to grok.
# Get it from https://github.com/marlonrichert/zsh-snap
source ~/zsh/zsh-snap/znap.zsh
znap source powerlevel10k
# completions or other functions to your
fpath=(
~/.local/completions
~/.asdf/completions
~[asdf-community/asdf-direnv]/completions
~[zsh-users/zsh-completions]/src
# /usr/local/etc/bash_completion.d
$fpath
)
# Load the aliases and custon functions and some:
for file in ~/dotfiles/zsh/{zaliases,zfunctions}; do
[ -r "$file" ] && [ -f "$file" ] && source "$file";
done
unset file
################ zsh options
## https://linux.die.net/man/1/zshoptions
# Expansion and Globbing
setopt numericglobsort # Sort filenames numerically when it makes sense
setopt nocaseglob # Make globbing (filename generation) insensitive to case
setopt extendedglob # Treat the '#', '~' and '^' characters as part of patterns for filename generation
setopt globdots # Do not require a leading '.' in a filename to be matched explicitly
setopt globstarshort # Enable shorter patterns for recursive globbing
setopt nullglob # Delete unmatched filename pattern from list instead of reporting an error
# Input/Output
setopt rcquotes # Allow the character sequence '''' to signify a single quote within singly quoted strings.
setopt interactivecomments # allow comments, even in interactive shells
setopt noflowcontrol # disable start (C-s) and stop (C-q) characters
setopt correct # command auto-correction
#setopt correctall # argument auto-correction
# History
setopt extended_history
setopt hist_expire_dups_first # delete duplicates first when HISTFILE size exceeds HISTSIZE
setopt hist_ignore_dups # do not store duplications
setopt hist_find_no_dups # ignore duplicates when searching
setopt hist_ignore_space # Remove command lines from the history list when the first character on the line is a space,
setopt hist_reduce_blanks # removes blank lines from history
setopt hist_save_no_dups # Don't to save duplicated lines more than once
setopt share_history # share history across multiple zsh sessions
setopt hist_verify # show command with history expansion to user before running it
# Changing directories
setopt auto_cd # If a command is issued that can't be executed as a normal command, and the command is the name of a directory, perform the cd command to that directory.
setopt auto_pushd # Make cd push the old directory onto the directory stack.
setopt pushd_ignore_dups # Don't push multiple copies of the same directory onto the directory stack.
# Completion
setopt auto_list # automatically list choices on ambiguous completion
setopt always_to_end # move cursor to end if word had one match
setopt complete_in_word # Complete from both ends of word instead of from end only
setopt menu_complete # On an ambiguous completion, instead of listing possibilities or beeping, insert the first match immediately.
setopt list_types # When listing files that are possible completions, show the type of each file with a trailing identifying mark.
setopt auto_param_keys # If a parameter name was completed and the next character typed is one of those that have to come directly after the name (like }, :, etc.), they are placed there automatically.
setopt auto_param_slash # If a parameter is completed whose content is the name of a directory, then add a trailing slash.
setopt nolistbeep # Don't beep on an ambiguous completion.
# Prompt
# setopt prompt_subst # parameter expansion, command substitution and arithmetic expansion are performed in prompts
# Zle
setopt nobeep # Don't beep on error in ZLE.
zstyle ':autocomplete:*' default-context ''
zstyle ':autocomplete:*' min-delay 0.0 # number of seconds (float)
zstyle ':autocomplete:*' min-input 0 # number of characters (integer)
zstyle ':autocomplete:tab:*' fzf-completion no
# When completions don't fit on screen, show up to this many lines:
zstyle ':autocomplete:*' list-lines 16 # (integer)
# If any of the following are shown at the same time, list them in the order given:
zstyle ':completion:*:' group-order \
expansions history-words options \
aliases functions builtins reserved-words \
executables local-directories directories suffix-aliases
# NOTE: This is NOT the order in which they are generated.
# Zstyles
zstyle ':autocomplete:tab:*' insert-unambiguous no
zstyle ':autocomplete:tab:*' widget-style complete-word
# Add a space after these completions:
zstyle ':autocomplete:*' add-space executables aliases functions builtins reserved-words commands
znap source zsh-autocomplete
# In-line suggestions
znap source zsh-autosuggestions
ZSH_AUTOSUGGEST_ACCEPT_WIDGETS=( "${ZSH_AUTOSUGGEST_ACCEPT_WIDGETS[@]:#*forward-char}" )
znap source zsh-you-should-use
znap source zsh-edit
WORDCHARS='*?\'
# Emacs binding
bindkey -e
bindkey $key[Up] up-line-or-search
bindkey $key[Down] down-line-or-select
bindkey $key[Control-Space] list-expand
bindkey -M menuselect $key[Return] .accept-line
# Enable alt-h help function.
unalias run-help
autoload -Uz run-help run-help-git run-help-ip run-help-openssl \
run-help-p4 run-help-sudo run-help-svk run-help-svn
################ # Add external commands
# Better cding like z.lua but faster
znap eval zoxide 'zoxide init zsh'
# direnv hooked into asdf
znap eval asdf-community/asdf-direnv "asdf exec $(asdf which direnv) hook zsh"
# pip completions
znap eval pip-completion 'pip completion --zsh'
znap eval pipx-completion 'register-python-argcomplete pipx'
znap eval pipenv-completion 'pipenv --completion'
# Use `znap compdef` to add generated completion functions:
znap compdef _rustup 'rustup completions zsh'
znap compdef _cargo 'rustup completions zsh cargo'
# thefuck
znap eval thefuck 'thefuck --alias sugar'
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.config/zsh/.p10k.zsh ]] || source ~/.config/zsh/.p10k.zsh
# Command-line syntax highlighting
export ZSH_HIGHLIGHT_HIGHLIGHTERS=( main brackets )
znap source zsh-syntax-highlighting
# znap source fast-syntax-highlighting
znap source marlonrichert/zcolors
znap eval zcolors "zcolors ${(q)LS_COLORS}"
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Unlike |
Beta Was this translation helpful? Give feedback.
Unlike
zsh
completions,bash
completions are not functions; they are scripts. Therefore, you need tosource
them. 🙂