zimfw / asdf

Sets up asdf, with auto install and optimized usage of the direnv plugin.
MIT License
9 stars 8 forks source link

initialise completions with ZSH's compinit #1

Closed jqhr closed 2 years ago

jqhr commented 2 years ago

My asdf has no completions. see asdf zsh&git I must execute this

autoload -Uz compinit && compinit

Has any other solutions? @ericbn

ericbn commented 2 years ago

Hi @jqhr. You definetly need to initialize the Zsh completion system for completion to work. And there are two ways to do it:

  1. Add autoload -Uz compinit && compinit to your .zshr file.
  2. OR add zmodule completion to your .zimrc file. This Zim module will call compinit for you.
jqhr commented 2 years ago

Hi @jqhr. You definetly need to initialize the Zsh completion system for completion to work. And there are two ways to do it:

1. Add `autoload -Uz compinit && compinit` to your .zshr file.

2. **OR** add `zmodule completion` to your .zimrc file. This Zim module will call compinit for you.

I have addedzmodule completion to my zimrc file ,but it doesnot work

ericbn commented 2 years ago

The completion module must come after the asdf module.

jqhr commented 2 years ago

Yes.my zimrc is

# Start configuration added by Zim install {{{
# -------
# Modules
# -------

# Sets sane Zsh built-in environment options.
zmodule environment
# Provides handy git aliases and functions.
zmodule git
# Applies correct bindkeys for input events.
zmodule input
# Sets a custom terminal title.
zmodule termtitle
# Utility aliases and functions. Adds colour to ls, grep and less.
zmodule utility
# archieve
zmodule archive
# asdf
# 读取asdf后必须执行,否则没补全
zmodule asdf

#
# Prompt
#
# Exposes to prompts how long the last command took to execute, used by asciiship.
zmodule duration-info
# Exposes git repository status information to prompts, used by asciiship.
zmodule git-info
# A heavily reduced, ASCII-only version of the Spaceship and Starship prompts.
zmodule asciiship
# Aloxaf/fzf-tab
zmodule Aloxaf/fzf-tab

# Enables and configures smart and extensive tab completion.
# completion must be sourced after zsh-users/zsh-completions
zmodule completion
# Additional completion definitions for Zsh.
zmodule zsh-users/zsh-completions
# Fish-like syntax highlighting for Zsh.
# zsh-users/zsh-syntax-highlighting must be sourced after completion
zmodule zsh-users/zsh-syntax-highlighting
# Fish-like history search (up arrow) for Zsh.
# zsh-users/zsh-history-substring-search must be sourced after zsh-users/zsh-syntax-highlighting
zmodule zsh-users/zsh-history-substring-search
# Fish-like autosuggestions for Zsh.
zmodule zsh-users/zsh-autosuggestions
# custom modules
zmodule jeffreytse/zsh-vi-mode
# zmodule ohmyzsh/ohmyzsh -s plugins/vi-mode/vi-mode.plugin.zsh
zmodule b4b4r07/emoji-cli
zmodule wfxr/forgit
zmodule agkozak/zsh-z
zmodule pabloariasal/zfm
zmodule supercrabtree/k
zmodule zpm-zsh/clipboard
zmodule chriskempson/base16-shell --cmd 'eval "$("{}/profile_helper.sh")"'
zmodule mollifier/cd-gitroot
zmodule casonadams/alacritty-shell
zmodule MichaelAquilina/zsh-you-should-use --name "you-should-use"

# }}} End configuration added by Zim install

I add 'autoload -Uz compinit && compinit' in my zshrc, and it works

jqhr commented 2 years ago

I uncommented "zstyle ':zim:completion' dumpfile "${ZDOTDIR:-${HOME}}/.zcompdump-${ZSH_VERSION}" in my zshrc. and it works.

appilon commented 2 years ago

This issue still persists for me, completion module coming after asdf module. I will attempt the workarounds.

ericbn commented 2 years ago

Hi @appilon. Check https://github.com/zimfw/zimfw/wiki/Troubleshooting

appilon commented 2 years ago

Hi @ericbn thanks for the help troubleshooting. Turns out ubuntu autoloads compinit in /etc/zsh/zshrc. The fix is to add skip_global_compinit=1 in ~/.zshenv. I might suggest mentioning this somewhere in the readme for https://github.com/zimfw/completion since it would be common problem, seems like a weird decision by the ubuntu release of zsh...

EDIT: I also had to rebuild the completions with zimfw clean and a restart.