You are not logged in.

#1 2021-01-24 06:27:27

laichiaheng
Member
Registered: 2017-02-12
Posts: 193

[resolved ]zsh-completions never works.

Before installing zsh-completions, I have installed oh-my-zsh and powerlevel10k theme.

I have followed the ArchWiki page to do it: https://wiki.archlinux.org/index.php/Zs … completion

I have added all of them to .zshrc, but when I type "sudo pacman -Rs f" and press TAB, it returns nothing.

Last edited by laichiaheng (2021-01-26 13:39:57)

Offline

#2 2021-01-24 08:14:16

seth
Member
Registered: 2012-09-03
Posts: 49,982

Re: [resolved ]zsh-completions never works.

zsh doesn't require zsh-completions for basic completions and /usr/share/zsh/site-functions/_pacman is provided by pacman.

post your .zshrc but I'll just blame

I have installed oh-my-zsh

because that's the usual way for users to break their zsh.
Does the completion work w/o "sudo"?

Offline

#3 2021-01-24 08:17:02

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,595
Website

Re: [resolved ]zsh-completions never works.

seth wrote:

post your .zshrc but I'll just blame

I have installed oh-my-zsh

because that's the usual way for users to break their zsh.

Yes, agreed.  Remove that shit.  If you want some nice zsh stuff, install grml-zsh-config which plays nice with stuff.


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#4 2021-01-24 10:38:00

laichiaheng
Member
Registered: 2017-02-12
Posts: 193

Re: [resolved ]zsh-completions never works.

seth wrote:

zsh doesn't require zsh-completions for basic completions and /usr/share/zsh/site-functions/_pacman is provided by pacman.

post your .zshrc but I'll just blame

I have installed oh-my-zsh

because that's the usual way for users to break their zsh.
Does the completion work w/o "sudo"?

No, it doesn't work without sudo


Here is my .zshrc
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
  source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi

ZSH=/usr/share/oh-my-zsh/
ZSH_THEME="powerlevel10k/powerlevel10k"

DISABLE_AUTO_UPDATE="true"

ZSH_CUSTOM=/usr/share/zsh
plugins=(
        git
        zsh-syntax-highlighting
        zsh-autosuggestions
        zsh-completions
        history-substring-search
)


ZSH_CACHE_DIR=$HOME/.cache/oh-my-zsh
if [[ ! -d $ZSH_CACHE_DIR ]]; then
  mkdir $ZSH_CACHE_DIR
fi

source $ZSH/oh-my-zsh.sh

# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh

Last edited by laichiaheng (2021-01-24 10:51:16)

Offline

#5 2021-01-24 10:43:15

laichiaheng
Member
Registered: 2017-02-12
Posts: 193

Re: [resolved ]zsh-completions never works.

graysky wrote:
seth wrote:

post your .zshrc but I'll just blame

I have installed oh-my-zsh

because that's the usual way for users to break their zsh.

Yes, agreed.  Remove that shit.  If you want some nice zsh stuff, install grml-zsh-config which plays nice with stuff.

I don't see a tutorial or manual for that.
By the way, I accidentally reported you just because I was trying to click reply.

Last edited by laichiaheng (2021-01-24 10:44:10)

Offline

#6 2021-01-24 12:39:07

seth
Member
Registered: 2012-09-03
Posts: 49,982

Re: [resolved ]zsh-completions never works.

Please use code tags for shell IO and file contents,  https://bbs.archlinux.org/help.php#bbcode

Your zshrc doesn't compinit at all, but just revolves around a lot of OMZ stuff that, while I don't know, looks wrong™

https://grml.org/zsh/grmlzshrc.html
It also comes w/ a bunch of help functions for its styling capacity.

nb. that OMZ is NOT required to have a powerline promt at all.
If the bbs doesn't eat the UTF-8, this will get you some powerline prompt on top of the grmlrc (using only private codepoints that are covered by several unpatched fonts incl. SourceCodePro)

zstyle ':prompt:grml:*:items:user' pre '%F{cyan}'

zstyle ':prompt:grml:*:items:path' pre '%F{6}┃%K{6}%F{black} '
zstyle ':prompt:grml:*:items:path' post '%k%b%F{6}│%f '

zstyle ':prompt:grml:*:items:vcs' pre '%F{13}%f%K{13}'

zstyle ':prompt:grml:*:items:time' pre '%F{3}%F{black}%K{3}'

zstyle ':prompt:grml:*:items:host' pre '%F{6}%F{black}%K{6}'
zstyle ':prompt:grml:*:items:host' post '%k%F{6}┃%f%b'

zstyle ':prompt:grml:left:setup' items change-root path
zstyle ':prompt:grml:right:setup' items rc vcs time host

But to be very clear: not even that is required and the more elaborate powerline features come w/ a daemon.
See https://wiki.archlinux.org/index.php/Powerline

Offline

#7 2021-01-24 14:32:32

laichiaheng
Member
Registered: 2017-02-12
Posts: 193

Re: [resolved ]zsh-completions never works.

It seems like the completion works for other applications, except pacman.
Why is it?

Offline

#8 2021-01-24 14:36:16

seth
Member
Registered: 2012-09-03
Posts: 49,982

Re: [resolved ]zsh-completions never works.

OMZ…

pacman -Qo /usr/share/zsh/site-functions/_pacman
pacman -Qikk pacman

Offline

#9 2021-01-24 14:57:00

laichiaheng
Member
Registered: 2017-02-12
Posts: 193

Re: [resolved ]zsh-completions never works.

seth wrote:

OMZ…

pacman -Qo /usr/share/zsh/site-functions/_pacman
pacman -Qikk pacman

How do you know to do this?

Offline

#10 2021-01-24 15:00:45

laichiaheng
Member
Registered: 2017-02-12
Posts: 193

Re: [resolved ]zsh-completions never works.

laichiaheng wrote:
seth wrote:

OMZ…

pacman -Qo /usr/share/zsh/site-functions/_pacman
pacman -Qikk pacman

How do you know to do this?

Why is it missing?

Do we need to manually add it for every program?

Last edited by laichiaheng (2021-01-24 15:15:49)

Offline

#11 2021-01-24 15:04:05

seth
Member
Registered: 2012-09-03
Posts: 49,982

Re: [resolved ]zsh-completions never works.

I know this because it's always OMZ.
Please post the required output and don't bump - just edit your post is nobody has replied so far.

Offline

#12 2021-01-24 15:25:32

laichiaheng
Member
Registered: 2017-02-12
Posts: 193

Re: [resolved ]zsh-completions never works.

seth wrote:

I know this because it's always OMZ.
Please post the required output and don't bump - just edit your post is nobody has replied so far.

I did try to remove everything about zsh and the OMZ stuff, then install zsh again, but there is no such file by default.

Offline

#13 2021-01-24 15:26:40

seth
Member
Registered: 2012-09-03
Posts: 49,982

Re: [resolved ]zsh-completions never works.

no what file?
Please post the required output.

Offline

#14 2021-01-24 15:29:36

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,463

Re: [resolved ]zsh-completions never works.

You were asked for specific output and seem to be refusing to provide it. What are you trying to hide?

Offline

#15 2021-01-24 15:40:01

laichiaheng
Member
Registered: 2017-02-12
Posts: 193

Re: [resolved ]zsh-completions never works.

Scimmia wrote:

You were asked for specific output and seem to be refusing to provide it. What are you trying to hide?

You mean my command?
I remember I did these commands.

sudo pacman -Rs oh-my-zhs-git zsh <and all packages related to zsh>
sudo rm -rf /usr/share/oh-my-zsh /usr/share/zsh
sudo pacman -S zsh
git clone git://github.com/zsh-users/zsh-completions.git
sudo vim .zshrc
<insert  fpath=(path/to/zsh-completions/src $fpath) in it>
 rm -f ~/.zcompdump; compinit
zsh

Last edited by laichiaheng (2021-01-24 15:41:02)

Offline

#16 2021-01-24 15:42:11

seth
Member
Registered: 2012-09-03
Posts: 49,982

Re: [resolved ]zsh-completions never works.

seth wrote:
pacman -Qo /usr/share/zsh/site-functions/_pacman
pacman -Qikk pacman

Offline

#17 2021-01-24 15:44:38

laichiaheng
Member
Registered: 2017-02-12
Posts: 193

Re: [resolved ]zsh-completions never works.

seth wrote:
seth wrote:
pacman -Qo /usr/share/zsh/site-functions/_pacman
pacman -Qikk pacman
❯ LANG=C pacman -Qo /usr/share/zsh/site-functions/_pacman
/usr/share/zsh/site-functions/_pacman is owned by pacman 5.2.2-1
❯ LANG=C pacman -Qikk pacman
Name            : pacman
Version         : 5.2.2-1
Description     : A library-based package manager with dependency support
Architecture    : x86_64
URL             : https://www.archlinux.org/pacman/
Licenses        : GPL
Groups          : base-devel
Provides        : libalpm.so=12-64
Depends On      : bash  glibc  libarchive  curl  gpgme  pacman-mirrorlist  archlinux-keyring
Optional Deps   : perl-locale-gettext: translation support in makepkg-template
Required By     : appstream-glib  base  pamac-all  pkgfile  yay-bin
Optional For    : None
Conflicts With  : None
Replaces        : None
Installed Size  : 4.43 MiB
Packager        : Allan McRae <allan@archlinux.org>
Build Date      : Wed Jul 1 09:52:38 2020
Install Date    : Sun Jan 24 23:00:05 2021
Install Reason  : Installed as a dependency for another package
Install Script  : No
Validated By    : Signature

backup file: pacman: /etc/makepkg.conf (Modification time mismatch)
backup file: pacman: /etc/pacman.conf (Modification time mismatch)
backup file: pacman: /etc/pacman.conf (Size mismatch)
pacman: 369 total files, 0 altered files

I have manually added that file, so I'm not sure if you can see where the problem is.

I did it because this guy told me this way.
https://github.com/zsh-users/zsh-comple … -766343627

Last edited by laichiaheng (2021-01-24 15:46:37)

Offline

#18 2021-01-24 15:47:33

seth
Member
Registered: 2012-09-03
Posts: 49,982

Re: [resolved ]zsh-completions never works.

How did you "manually" add that file??
It's owned by the pacman package and that package is intact.
If you had tampered w/ it, the -Qikk output would reveal that.

Please post your current zshrc.

Edit: also, are we talking abotu "pacman" or "yay" here? That's not the same.

Last edited by seth (2021-01-24 15:48:50)

Offline

#19 2021-01-24 15:54:46

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,463

Re: [resolved ]zsh-completions never works.

And is this still Antergos?

Offline

#20 2021-01-24 16:10:15

laichiaheng
Member
Registered: 2017-02-12
Posts: 193

Re: [resolved ]zsh-completions never works.

seth wrote:

How did you "manually" add that file??
It's owned by the pacman package and that package is intact.
If you had tampered w/ it, the -Qikk output would reveal that.

Please post your current zshrc.

Edit: also, are we talking abotu "pacman" or "yay" here? That's not the same.

Just copy the raw zsh_completion.in in that link, and use vim to paste it in /usr/share/zsh/site-functions/_pacman

My pacman and yay have the same problem.

# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
  source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi

# Start configuration added by Zim install {{{
#
# User configuration sourced by interactive shells
#

# -----------------
# Zsh configuration
# -----------------

#
# History
#

# Remove older command from the history if a duplicate is to be added.
setopt HIST_IGNORE_ALL_DUPS

#
# Input/output
#

# Set editor default keymap to emacs (`-e`) or vi (`-v`)
bindkey -e

# Prompt for spelling correction of commands.
setopt CORRECT

# Customize spelling correction prompt.
#SPROMPT='zsh: correct %F{red}%R%f to %F{green}%r%f [nyae]? '

# Remove path separator from WORDCHARS.
WORDCHARS=${WORDCHARS//[\/]}


# --------------------
# Module configuration
# --------------------

#
# completion
#

# Set a custom path for the completion dump file.
# If none is provided, the default ${ZDOTDIR:-${HOME}}/.zcompdump is used.
#zstyle ':zim:completion' dumpfile "${ZDOTDIR:-${HOME}}/.zcompdump-${ZSH_VERSION}"

#
# git
#

# Set a custom prefix for the generated aliases. The default prefix is 'G'.
#zstyle ':zim:git' aliases-prefix 'g'

#
# input
#

# Append `../` to your input for each `.` you type after an initial `..`
#zstyle ':zim:input' double-dot-expand yes

#
# termtitle
#

# Set a custom terminal title format using prompt expansion escape sequences.
# See http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html#Simple-Prompt-Escapes
# If none is provided, the default '%n@%m: %~' is used.
#zstyle ':zim:termtitle' format '%1~'

#
# zsh-autosuggestions
#

# Customize the style that the suggestions are shown with.
# See https://github.com/zsh-users/zsh-autosuggestions/blob/master/README.md#suggestion-highlight-style
#ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=10'

#
# zsh-syntax-highlighting
#

# Set what highlighters will be used.
# See https://github.com/zsh-users/zsh-syntax-highlighting/blob/master/docs/highlighters.md
ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets)

# Customize the main highlighter styles.
# See https://github.com/zsh-users/zsh-syntax-highlighting/blob/master/docs/highlighters/main.md#how-to-tweak-it
#typeset -A ZSH_HIGHLIGHT_STYLES
#ZSH_HIGHLIGHT_STYLES[comment]='fg=10'

# ------------------
# Initialize modules
# ------------------

if [[ ! ${ZIM_HOME}/init.zsh -nt ${ZDOTDIR:-${HOME}}/.zimrc ]]; then
  # Update static initialization script if it does not exist or it's outdated, before sourcing it
  source ${ZIM_HOME}/zimfw.zsh init -q
fi
source ${ZIM_HOME}/init.zsh

# ------------------------------
# Post-init module configuration
# ------------------------------

#
# zsh-history-substring-search
#

# Bind ^[[A/^[[B manually so up/down works both before and after zle-line-init
bindkey '^[[A' history-substring-search-up
bindkey '^[[B' history-substring-search-down

# Bind up and down keys
zmodload -F zsh/terminfo +p:terminfo
if [[ -n ${terminfo[kcuu1]} && -n ${terminfo[kcud1]} ]]; then
  bindkey ${terminfo[kcuu1]} history-substring-search-up
  bindkey ${terminfo[kcud1]} history-substring-search-down
fi

bindkey '^P' history-substring-search-up
bindkey '^N' history-substring-search-down
bindkey -M vicmd 'k' history-substring-search-up
bindkey -M vicmd 'j' history-substring-search-down
# }}} End configuration added by Zim install

# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh

alias lowlatency='lowlatency'

function lowlatency(){
	streamlink --player mpv --twitch-low-latency --hls-live-edge=1 $1 best &exit
}

By the way, it has been working since I added that file.
There are only 2 files in the directory now

❯ ls /usr/share/zsh/site-functions
_pacman  _yay

Last edited by laichiaheng (2021-01-24 16:13:49)

Offline

#21 2021-01-24 16:10:50

laichiaheng
Member
Registered: 2017-02-12
Posts: 193

Re: [resolved ]zsh-completions never works.

Scimmia wrote:

And is this still Antergos?

Hasn't Antergos died for a long time?

Offline

#22 2021-01-24 16:14:54

seth
Member
Registered: 2012-09-03
Posts: 49,982

Re: [resolved ]zsh-completions never works.

There's no compinit in that zshrc…

Writing /usr/share/zsh/site-functions/_pacman should cause a timestamp warning?
(Maybe it doesn't, but the action was at best idempotent)

To be sure:

md5sum /usr/share/zsh/site-functions/_pacman

Offline

#23 2021-01-24 16:19:14

laichiaheng
Member
Registered: 2017-02-12
Posts: 193

Re: [resolved ]zsh-completions never works.

seth wrote:

There's no compinit in that zshrc…

Writing /usr/share/zsh/site-functions/_pacman should cause a timestamp warning?
(Maybe it doesn't, but the action was at best idempotent)

To be sure:

md5sum /usr/share/zsh/site-functions/_pacman

It did cause timestamp warning before, or not, I forgot.

❯ md5sum /usr/share/zsh/site-functions/_pacman
85c32287a91ba1b4c677a7bff0005cf3  /usr/share/zsh/site-functions/_pacman

Last edited by laichiaheng (2021-01-24 16:20:33)

Offline

#24 2021-01-24 16:26:00

seth
Member
Registered: 2012-09-03
Posts: 49,982

Re: [resolved ]zsh-completions never works.

Did you understand

seth wrote:

There's no compinit in that zshrc…

As of now, no extended autocompletion should™ work for you.

Offline

#25 2021-01-24 16:37:23

laichiaheng
Member
Registered: 2017-02-12
Posts: 193

Re: [resolved ]zsh-completions never works.

seth wrote:

Did you understand

seth wrote:

There's no compinit in that zshrc…

As of now, no extended autocompletion should™ work for you.

So all I need is to add compinit in my zshrc?

Offline

Board footer

Powered by FluxBB