You are not logged in.

#1 2017-03-21 17:49:40

labotsirc
Member
Registered: 2013-08-21
Posts: 108

[SOLVED] auto-completion 'screen -r + tab' not working in oh-my-zsh

Dear community,

I am having an auto-completion issue when trying to make the 'screen -r' + tab show me all my sessions that can be attached.
Under bash the autocompletion for screen -r works fine, but under zsh it does not and instead it offers me out of context options
such as in the example below.

➜  ~ screen -S hello
[detached from 2525.hello]
➜  ~ screen -ls
There is a screen on:
	2525.hello	(Detached)
1 Socket in /run/screens/S-xxx.
➜  ~ screen -r (pressing tab)
bin@         dev/         home/        lib64@       mnt/         proc/        run/         srv/         tmp/         var/                                          
boot/        etc/         lib@         lost+found/  opt/         root/        sbin@        sys/         usr/

As a comparison, bash offers me the correct auto-completion

[xxx@carbon ~]$ screen -ls
There are screens on:
	2657.bye	(Detached)
	2621.hello2	(Detached)
	2525.hello	(Detached)
3 Sockets in /run/screens/S-xxx.
[xxx@carbon ~]$ screen -r (pressing tab)
bye     hello   hello2 

Any idea how to make zsh auto-complete correctly?  I am using the default oh-my-zsh configuration.

EDIT:
using the default zsh (no oh-my-zsh) also reproduces the problem, but showing my home folders

There are screens on:
	2657.bye	(Detached)
	2621.hello2	(Detached)
	2525.hello	(Detached)
3 Sockets in /run/screens/S-xxx.
carbon% screen -r
amaroseba/                        Documents/                        lin_xeon64.txt                    Pictures/                         test/
DELAUNAY/                         Downloads/                        Music/                            Folders.conf.example*      testio/
Desktop/                          Dropbox/                          octave-workspace                  Public/                           Videos/
dnn-acustica/                     generator/                        Online-Judge-Solutions/           Templates/ 

Last edited by labotsirc (2017-03-22 14:02:27)

Offline

#2 2017-03-21 17:58:35

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: [SOLVED] auto-completion 'screen -r + tab' not working in oh-my-zsh

labotsirc wrote:

I am using the default oh-my-zsh configuration.

And does it work without using OMZ?


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2017-03-21 18:04:28

labotsirc
Member
Registered: 2013-08-21
Posts: 108

Re: [SOLVED] auto-completion 'screen -r + tab' not working in oh-my-zsh

jasonwryan wrote:
labotsirc wrote:

I am using the default oh-my-zsh configuration.

And does it work without using OMZ?

just tried now. Does not work. Post updated.

Offline

#4 2017-03-21 21:56:55

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 74,307

Re: [SOLVED] auto-completion 'screen -r + tab' not working in oh-my-zsh

run "strace zsh 2>&1 | grep _screen | grep open" and see which completion script is ultimately used when attempting to complete screen, check whether it's provided by zsh ("pacman -Qo /path/to/_screen") and whether it's sane ("pacman -Qkk zsh")

Offline

#5 2017-03-22 13:37:48

labotsirc
Member
Registered: 2013-08-21
Posts: 108

Re: [SOLVED] auto-completion 'screen -r + tab' not working in oh-my-zsh

seth wrote:

run "strace zsh 2>&1 | grep _screen | grep open" and see which completion script is ultimately used when attempting to complete screen, check whether it's provided by zsh ("pacman -Qo /path/to/_screen") and whether it's sane ("pacman -Qkk zsh")

Hi seth,

here is the output, i am not sure if I did it correctly (Opened a straced zsh session as you indicated and reproduced the act of tabbing the "screen -r" command, then exited and got that message).

➜  ~ strace zsh 2>&1 | grep _screen | grep open
➜  ~ screen -r      
➜  ~ exit
open("/usr/share/zsh/site-functions/_screen", O_RDONLY|O_NOCTTY) = 3

then,

➜  ~ sudo pacman -Qo /usr/share/zsh/site-functions/_screen           
[sudo] password for cristobal: 
/usr/share/zsh/site-functions/_screen is owned by screen 4.5.1-2

then

➜  ~ sudo pacman -Qkk zsh  
zsh: 1077 total files, 0 altered files

I also noticed this file

sudo pacman -Qo /usr/share/zsh/functions/Completion/Unix/_screen
/usr/share/zsh/functions/Completion/Unix/_screen is owned by zsh 5.3.1-2

What is not clear for me, if another person installs zsh and tries to tab-complete the screen -r command, does it work properly?

Last edited by labotsirc (2017-03-22 13:38:26)

Offline

#6 2017-03-22 13:56:21

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 74,307

Re: [SOLVED] auto-completion 'screen -r + tab' not working in oh-my-zsh

/usr/share/zsh/site-functions/_screen  will not do what you want (it's an autogenerated basic thing), /usr/share/zsh/functions/Completion/Unix/_screen should.
Try to move the former aside, start a new zsh, see what happens.
You could file against the screen package (arch bugtracker, not gnu) to skip the completion file provided by screen because the one provided by zsh is much more sophisticated.

Offline

#7 2017-03-22 14:02:05

labotsirc
Member
Registered: 2013-08-21
Posts: 108

Re: [SOLVED] auto-completion 'screen -r + tab' not working in oh-my-zsh

seth wrote:

/usr/share/zsh/site-functions/_screen  will not do what you want (it's an autogenerated basic thing), /usr/share/zsh/functions/Completion/Unix/_screen should.
Try to move the former aside, start a new zsh, see what happens.
You could file against the screen package (arch bugtracker, not gnu) to skip the completion file provided by screen because the one provided by zsh is much more sophisticated.

Just tried, it works!.
Moved /usr/share/zsh/site-functions/_screen to /usr/share/zsh/site-functions/backup-_screen and the problem was fixed.  Marking as solved and many thanks for the help smile. Ill see how to file against the screen package too.

Last edited by labotsirc (2017-03-22 14:03:13)

Offline

#8 2017-03-22 14:17:40

labotsirc
Member
Registered: 2013-08-21
Posts: 108

Re: [SOLVED] auto-completion 'screen -r + tab' not working in oh-my-zsh

In case someone is interested
task submitted to the bugtracker.
https://bugs.archlinux.org/task/53417

Last edited by labotsirc (2017-03-22 18:02:28)

Offline

Board footer

Powered by FluxBB