You are not logged in.

#1 2012-12-15 18:39:18

maggie
Member
Registered: 2011-02-12
Posts: 253

Arrow keys do not work from tty to auto complete [SOLVED]

I have to manually source my ~/.zshrc to make my up and down arrow keys work when I am searching through commands in my history from a tty outside of X. Keys work as expected from a shell in X. Something else I noticed when logging in from the tty outside of X is that it drops me to / not to ~ which is also weird.

I am using grayskys .zsh configs so maybe he will help.

Last edited by maggie (2013-01-26 11:25:01)

Offline

#2 2012-12-31 21:16:59

maggie
Member
Registered: 2011-02-12
Posts: 253

Re: Arrow keys do not work from tty to auto complete [SOLVED]

This only happens when I am in a tty outside of X. I can't find a solution to this hmm

Offline

#3 2012-12-31 21:23:37

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 20,114
Website

Re: Arrow keys do not work from tty to auto complete [SOLVED]

It would probably be more helpful if you pastebinned your configs for .zsh, including .zshenv, .zprofile (or however you initilaize your session), and some details about your environment.

History works fine for me in TTY using the cursor arrows.


Arch + dwm   •   Mercurial repos  •   Github

Registered Linux User #482438

Online

#4 2013-01-01 02:48:41

graysky
Member
From: The worse toilet in Scotland
Registered: 2008-12-01
Posts: 8,824
Website

Re: Arrow keys do not work from tty to auto complete [SOLVED]

Actually, what Maggie described is true on my system as well.  You can see the configs at my github link in my sig.


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

Offline

#5 2013-01-01 03:03:33

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 20,114
Website

Re: Arrow keys do not work from tty to auto complete [SOLVED]

I have only just started using zsh, so I am not particularly familiar with it, but in your github repo your keys file doesn't include the arrow keys, so I am not sure how they work in X, unless your WM handles that. In my .zshrc, I have:

# keybinds
bindkey "^[[A" history-beginning-search-backward
bindkey "^[[B" history-beginning-search-forward

as per the wiki and those keys work in X and TTY.


Arch + dwm   •   Mercurial repos  •   Github

Registered Linux User #482438

Online

#6 2013-01-01 03:11:09

graysky
Member
From: The worse toilet in Scotland
Registered: 2008-12-01
Posts: 8,824
Website

Re: Arrow keys do not work from tty to auto complete [SOLVED]

https://github.com/graysky2/configs/blo … b/keys.zsh

First few lines... Have to try your suggestion tomorrow.


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

Offline

#7 2013-01-01 11:21:29

graysky
Member
From: The worse toilet in Scotland
Registered: 2008-12-01
Posts: 8,824
Website

Re: Arrow keys do not work from tty to auto complete [SOLVED]

OK... if I ctrl+alt+F1 then log in my up/down arrow keys work BUT they do not work using history completion.  In other words, I hit up arrow, it will scroll through my history but if I start typing a command and then hit up arrow, it does not honor what I typed and search within the subset.  If I manually source my ~/.zshrc and try it, it does work as expected.

EDIT: http://www.zsh.org/mla/users/2013/msg00001.html

Last edited by graysky (2013-01-01 11:32:23)


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

Offline

#8 2013-01-01 20:28:47

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 20,114
Website

Re: Arrow keys do not work from tty to auto complete [SOLVED]

jasonwryan wrote:

It would probably be more helpful if you pastebinned your configs for .zsh, including .zshenv, .zprofile (or however you initialize your session), and some details about your environment.


Arch + dwm   •   Mercurial repos  •   Github

Registered Linux User #482438

Online

#9 2013-01-01 20:31:58

graysky
Member
From: The worse toilet in Scotland
Registered: 2008-12-01
Posts: 8,824
Website

Re: Arrow keys do not work from tty to auto complete [SOLVED]

@jw - Missed that....  I used `chsh -s $(which zsh)` which modded /etc/passwd for my user:

facade:x:1001:100::/home/facade:/bin/zsh

...naive question but is that how am I initializing my session?

Last edited by graysky (2013-01-01 20:32:51)


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

Offline

#10 2013-01-01 20:38:00

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 20,114
Website

Re: Arrow keys do not work from tty to auto complete [SOLVED]

How do you login? I looked through your configs, but I didn't find* a .zprofile or the like that sets up your environment.



* I am between Internet connections at the moment and can only tether to my phone's rather dire 3G network, so opening a heap of pages is a RPITA, ie., I may have missed it...


Arch + dwm   •   Mercurial repos  •   Github

Registered Linux User #482438

Online

#11 2013-01-01 20:39:57

graysky
Member
From: The worse toilet in Scotland
Registered: 2008-12-01
Posts: 8,824
Website

Re: Arrow keys do not work from tty to auto complete [SOLVED]

Login is simply via ctrl+alt+Fx and type name/password for non X or via lxdm with X.  Can you post your ~/.zprofile for me?


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

Offline

#12 2013-01-01 20:49:55

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 20,114
Website

Re: Arrow keys do not work from tty to auto complete [SOLVED]

Sure: relevant files here: http://sprunge.us/IPTQ

For non-X, something has to start your session.


Arch + dwm   •   Mercurial repos  •   Github

Registered Linux User #482438

Online

#13 2013-01-01 21:21:40

graysky
Member
From: The worse toilet in Scotland
Registered: 2008-12-01
Posts: 8,824
Website

Re: Arrow keys do not work from tty to auto complete [SOLVED]

jasonwryan wrote:

For non-X, something has to start your session.

What's the Arch default?  For example, without X installed, the system is at the multiuser target... what starts sessions?


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

Offline

#14 2013-01-02 00:00:54

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 20,114
Website

Re: Arrow keys do not work from tty to auto complete [SOLVED]

/etc/profile

Did you try adding those keybinds to your rc file?


Arch + dwm   •   Mercurial repos  •   Github

Registered Linux User #482438

Online

#15 2013-01-02 02:55:08

graysky
Member
From: The worse toilet in Scotland
Registered: 2008-12-01
Posts: 8,824
Website

Re: Arrow keys do not work from tty to auto complete [SOLVED]

@jason - No, because they work just fine under X.  I think your original suspicion about a sourcing problem is more likely.  Plus, aren't those emacs bindings?  I use vim bindings.  The sole line in /etc/zsh/zprofile is:

emulate sh -c 'source /etc/profile'

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

Offline

#16 2013-01-02 03:46:42

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 20,114
Website

Re: Arrow keys do not work from tty to auto complete [SOLVED]

The bindings working under X may be LXDE-related (check in your rc.xml).

Yes, they are emacs bindings because vim doesn't use the cursor keys, but that is the behaviour you are seeking, so you could try and see if it works.


Arch + dwm   •   Mercurial repos  •   Github

Registered Linux User #482438

Online

#17 2013-01-02 04:31:27

graysky
Member
From: The worse toilet in Scotland
Registered: 2008-12-01
Posts: 8,824
Website

Re: Arrow keys do not work from tty to auto complete [SOLVED]

@jason - I pasted your ~/.zprofile to my ~ and tried it out from the TTY... no change sad


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

Offline

#18 2013-01-02 04:40:49

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 20,114
Website

Re: Arrow keys do not work from tty to auto complete [SOLVED]

OK: I am out of ideas.

I just tried a new keybinding in my .zshrc and it worked flawlessly in the TTY. Try is and see what happens:

bindkey "\ek" backward-kill-line

Switch to a TTY and type a string then hit Alt-k and see if it deletes it.


Arch + dwm   •   Mercurial repos  •   Github

Registered Linux User #482438

Online

#19 2013-01-02 04:50:01

graysky
Member
From: The worse toilet in Scotland
Registered: 2008-12-01
Posts: 8,824
Website

Re: Arrow keys do not work from tty to auto complete [SOLVED]

@j - Yes, it does indeed kill the line... are we talking about the same thing here... the arrow keys work from the TTY, they just do not work as they do under X with history completion...  example:

Under X I type:    cd <space> <up arrow>
I get:
cd logs
cd ~
cd /boot

Under a TTY I do the same and the three characters I typed "cd " have no effect and up arrow gives me just a blind list of my last commands.  EXCEPT after I manually source my ~/.zshrc at which point the up arrow behaves as it did under X.

Last edited by graysky (2013-01-02 04:50:43)


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

Offline

#20 2013-01-02 05:01:18

anonymous_user
Member
Registered: 2009-08-28
Posts: 3,058

Re: Arrow keys do not work from tty to auto complete [SOLVED]

@graysky - Does it make any difference if you source your .zshrc from your .zprofile file?

Offline

#21 2013-01-02 05:34:00

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 20,114
Website

Re: Arrow keys do not work from tty to auto complete [SOLVED]

@graysky If you logged into a new TTY, and the new bind worked, then your .zshrc is being correctly sourced.

@anonymous_user that shouldn't be necessary (but it might not hurt as a hack).

My suspicion is that it is still the way you have defined the keys (although that doesn't account for how they work as expected once you source the file from the TTY). In any event, as you won't test my hypothesis, the point is moot.


Arch + dwm   •   Mercurial repos  •   Github

Registered Linux User #482438

Online

#22 2013-01-02 13:01:22

graysky
Member
From: The worse toilet in Scotland
Registered: 2008-12-01
Posts: 8,824
Website

Re: Arrow keys do not work from tty to auto complete [SOLVED]

jasonwryan wrote:

@graysky If you logged into a new TTY, and the new bind worked, then your .zshrc is being correctly sourced.

My suspicion is that it is still the way you have defined the keys (although that doesn't account for how they work as expected once you source the file from the TTY). In any event, as you won't test my hypothesis, the point is moot.

Thought I did?

graysky wrote:

@jason - I pasted your ~/.zprofile to my ~ and tried it out from the TTY... no change sad


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

Offline

#23 2013-01-02 19:37:05

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 20,114
Website

Re: Arrow keys do not work from tty to auto complete [SOLVED]

No, I meant the keybinds I pasted right at the start f this thread. Remove everything else from your keys fle and just start with those (that is what I did). I currently only have this key-related stuff in my .zshrc:

# keybinds
bindkey "^[[A" history-beginning-search-backward
bindkey "^[[B" history-beginning-search-forward
bindkey "\ep" insert-last-word 
bindkey "\eq" quote-line
bindkey "\ek" backward-kill-line

# use the vi navigation keys in menu completion
bindkey -M menuselect 'h' vi-backward-char        
bindkey -M menuselect 'k' vi-up-line-or-history   
bindkey -M menuselect 'l' vi-forward-char         
bindkey -M menuselect 'j' vi-down-line-or-history

Arch + dwm   •   Mercurial repos  •   Github

Registered Linux User #482438

Online

#24 2013-01-02 19:43:58

graysky
Member
From: The worse toilet in Scotland
Registered: 2008-12-01
Posts: 8,824
Website

Re: Arrow keys do not work from tty to auto complete [SOLVED]

OK... I replaced my ~/.zshrc with your code:

/home/facade/.zshrc:bindkey:9: no such keymap `menuselect'
/home/facade/.zshrc:bindkey:10: no such keymap `menuselect'
/home/facade/.zshrc:bindkey:11: no such keymap `menuselect'
/home/facade/.zshrc:bindkey:12: no such keymap `menuselect'
ease%

No arrow key functionality at all smile


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

Offline

#25 2013-01-02 19:48:34

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 20,114
Website

Re: Arrow keys do not work from tty to auto complete [SOLVED]

Remove the second stanza, the vi navigation keys, and see what happens...


Arch + dwm   •   Mercurial repos  •   Github

Registered Linux User #482438

Online

Board footer

Powered by FluxBB