Ctrl+L doesn't clear screen in Console2+Cygwin+Bash

3

As per the title, when I press Ctrl+L it just simulates a return carriage and returns me to the prompt.

wulfgarpro

Posted 2012-01-19T04:28:18.533

Reputation: 173

Works for me. Are you using a recent Cygwin version? What shell are you using (i.e. the default bash or something else)? – ak2 – 2012-01-19T12:06:39.757

I just reinstalled cygwin from scratch with the same problem. I'm going to reinstall Console2. – wulfgarpro – 2012-01-20T03:50:49.360

Also just reinstalled Console2 and wiped all settings. Same deal - Ctrl+L just does a carriage return. – wulfgarpro – 2012-01-20T04:02:09.377

Hm - could this have to do with my running on Windows 7 x64? – wulfgarpro – 2012-01-23T22:48:29.390

Does the clear command clear the screen? What does clear | cat -A print? What is your $TERM environment variable set to? – Keith Thompson – 2012-01-24T01:39:21.703

No, clear does the same as Ctrl+L; clear | cat -A prints nothing. echo $TERM prints dumb. – wulfgarpro – 2012-01-24T01:45:16.983

Answers

6

The problem is the $TERM setting. For the Cygwin console, this should be set to cygwin, and it's the same for Console2, which is a wrapper around the console window.

Something must have set TERM to dumb in the system-wide settings. Perhaps some other Unix toolkit?

ak2

Posted 2012-01-19T04:28:18.533

Reputation: 3 387

Fantastic been bugging me for months. – Kevvvvyp – 2015-05-11T13:16:33.253

I added the export to my .bashrc and all was solved. Not sure what changed it. – wulfgarpro – 2012-01-24T22:44:18.213

1

That's because you've told it to do this.

You've …

  • … switched out of emacs mode into vi mode with
    set -o vi
    ; or
  • … reprogrammed Ctrl+L with
    bind '"\C-l": something'
    ; or
  • you've done something in Console2 to remap the key there.

So simply undo that. Switch the readline mode back or re-bind the key to clear-screen.

JdeBP

Posted 2012-01-19T04:28:18.533

Reputation: 23 855

set -o shows emacs on, vi off; I've never used the bind command. I executed the following: bind '"\C-l": clear-screen', and I'm getting the same behavior. – wulfgarpro – 2012-01-19T22:53:29.337