I'm running Mac OS, using the latest version of zsh.
I've noticed that I have funny tab-completion behavior when inside a screen session.
Specifically, once I press tab, the first part of my command seems to be duplicated before the completion results are inserted.
For example, if I type
cd ~<TAB>
the contents of my command line will be replaced with
cd ~cd ~/
Strangely, this superfluous stuff doesn't affect the command: the interpreter still reads the command as
cd ~/
but it can be confusing at times, and it's certainly annoying to have my computer doing something I didn't intentionally program and cannot figure out.
Any ideas what's up?
Let me know if anybody wants to see any of my rc files.
have you resized your window by any chance?
If so, you might want to run 'resize' from the shell. I don't know where 'resize' lives under MacOS, but on Solaris it's under /usr/openwin/bin directory.
I ran "locate resize" and it seems the only resize on my computer is part of xterm.
What exactly does it do?
By the way, I noticed that the behavior doesn't occur for every tab-completion request: only when the zsh list of possible matches comes up does this occur.
In cases where there is only one possible match and it doesn't display a list to the user, the command line is unchanged.
Thus I can type
cd ~<TAB>
and it properly autocompletes "~" to /Users/myusername/, with no doubling. If I press tab again (which returns a list of the contents of ~/), the problem occurs.
cd~/<TAB>
will cause doubling without having to press tab a second time.
Well, if the screen does not support the control characters defined for xterm-color or screen, the $TERM can create such anomalies. Try other export TERM=model, like xterm-color for screen and vice-versa, or something simpler like vt100, XTERM. I am assuming zsh does something sane on the proper term type. I am not a zsh user yet.
I even tried, when testing TERM=vt100 in screen, configuring terminal.app to strictly emulate vt100, by declaring the terminal as vt100 and selected the "strict vt100 keypad behavior" option.
None of this had any affect on the problem. Unless I would have to do something more than simply export TERM=blah within a screen session.
If I start a screen session, and then run export PROMPT=% in order to give myself a blank prompt, the problem is resolved!
So, any ideas what I might do, other than living with it (now that I at least know what's causing it), or using a simple prompt within screen? Is there any way to configure screen, like say, what the prompt variable is?
Use half of the current prompt -- as much as makes sense. If it works, add half of the part left out, if it doesn't work, cut the half in half, repeat until solved.
Or, you could start with an emptyish prompt, and add a bit each time.
It seems to behave like screen does, up to and including giving me my weird problem. I never could figure out how or if screen will set its own prompt.
It seems like it has something to do with trying to create my user environment twice, as both screen and su try to replicate my user environment when I run them.