Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm getting zsh set up in Windows and I'm getting a reverse (black on white (black terminal background)) percent symbol in the first character position in the line just above every prompt.

Usually that means there's no newline at the end of the file, for example when cat-ing a file.

It doesn't happen on my Mac or even on Mintty on Windows. But it does happen in ConEmu and the standard terminal app that CMD.EXE usually runs in.

I've already unset all my prompt strings as well as precmd() which I normally use to add a blank line above the prompt.

Any clue what it could be?

share|improve this question

1 Answer 1

up vote 4 down vote accepted

The relevant option probably is PROMPT_SP, explanaition from the manual

Attempt to preserve a partial line (i.e. a line that did not end with a newline) that would otherwise be covered up by the command prompt due to the PROMPT_CR option. This works by outputting some cursor-control characters, including a series of spaces, that should make the terminal wrap to the next line when a partial line is present (note that this is only successful if your terminal has automatic margins, which is typical).

When a partial line is preserved, by default you will see an inverse+bold character at the end of the partial line: a % for a normal user or a # for root. If set, the shell parameter PROMPT_EOL_MARK can be used to customize how the end of partial lines are shown.

So, either you do a

unsetopt PROMPT_SP

if you don't care about the covered up line (however in your case it seems to be a empty line, as you get the % sign at the beginning).

Or use

setopt PROMPT_CR
setopt PROMPT_SP
export PROMPT_EOL_MARK=""

which preserves partial lines, but removes the % -- at the cost of some empty lines over the prompt.

To make this permanent, update your ~/.zshrc.

This is a blind shot, as I cannot reproduce this behaviour in my cmd.exe.

share|improve this answer
1  
Thanks @mpy, this put me onto just the right spot to learn more. Here's what I came up with: 1) three things work, more if you combine options: unsetopt PROMPT_CR; unsetopt PROMPT_SP; and PROMPT_EOL_MARK="". 2) setting PROMPT_EOL_MARK="" gets rid of the annoying inverse+bold "%" character, but it still adds an additional line feed, so prompt looks different than on mintty or the Mac. 3) I ended up going with unsetopt PROMPT_SP as the best compromise. 4) using set and unset doesn't work unless you use the -o option. setopt and unsetopt work. If you'll fix I'll accept your answer :) –  scanny Sep 15 '13 at 22:04
    
@scanny : I have to apologize for the set. Of course, it should've been setopt -- obviously I wrote my answer too fast. I updated my answer and tried to include also the point about the empty lines. –  mpy Sep 16 '13 at 11:00

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.