Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vim in cmd::Cmder display black screen #2384

Closed
playgithub opened this issue Oct 12, 2021 · 66 comments
Closed

vim in cmd::Cmder display black screen #2384

playgithub opened this issue Oct 12, 2021 · 66 comments

Comments

@playgithub
Copy link

playgithub commented Oct 12, 2021

Versions

OS: Windows 11 21H2 22000.194
ConEmu Version: 210912

Problem description

vim in cmd::Cmder display black screen
but it works blindly, e.g.

  • cursor moves when typing
  • :q leads to quit
@Maximus5
Copy link
Owner

Maximus5 commented Nov 1, 2021

Press Ctrl-Win-Alt-Space to reveal real console.
Try to scroll it. Anything?

@playgithub
Copy link
Author

I can't test it now, because I've switched to Linux.

@gquerret
Copy link

gquerret commented Nov 2, 2021

I have a very similar issue. Also running Windows 11 (new machine, so unlikely to be cluttered by previous installs). ConEmu 210912.

Starting VIM in cmd.exe works perfectly:
image

When in ConEmu:
image

The real console shows (very small, same output with only 'zz'):
image

I can enter in Insert mode and type characters, then write file and exit, so input is correctly handled.

Funny thing: if I resize the real console, it then displays the usual tildes, and conemu output is updated:
image
image

Would you need any additional info ?

@Zd036
Copy link

Zd036 commented Nov 25, 2021

I have a similar problem on Windows 11 21H2 22000.318
Switching to 'legacy console' in 'CMD' solved the problem.
But this introduced a new problem, that is, downloading files via ConEmu would force closed.

@ktyl
Copy link

ktyl commented Dec 30, 2021

I have the same issue, fresh install of Win 11, vim in conemu displays only ZZ
Win 11 21h2 22000.376
Conemu 210912
VIM:
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Sep 21 2021 16:13:20)
Included patches: 1-3441
Compiled by https://www.msys2.org/

@Maximus5
Copy link
Owner

Maximus5 commented Jan 1, 2022

My guess, you do not use the Connector. If so - display problems are not in ConEmu, but in msys/cygwin.

Sometimes the TERM variable change may fix that. E.g. set msys or xterm instead of cygwin, or so...

@gquerret
Copy link

gquerret commented Jan 2, 2022

I'm using Cmder, but I switched to "plain" ConEmu to reproduce the problem. I downloaded again ConEmu, and found that vim works when used from Bash -- Git Bash, but doesn't work from Shells -- Cmd.
Different values of TERM didn't change the outcome.

@ktyl
Copy link

ktyl commented Jan 2, 2022

I'm using cmder (version 1.3.18.1106, downloaded and installed last week). Seeing @gquerret's post I checked vim in git bash but I have the same effect as in cmd - blan screen with ZZ displayed.
I haven't had time yet to play with connector as suggested by @Maximus5, but I tried different values of TERM variable and in my case it also did not change anything.

@ktyl
Copy link

ktyl commented Jan 7, 2022

Today I noticed something that might be connected:
When I type in the text that is longer than a single line, it should start another line. Currently the cursor moves for me to the beginning of the line and overwrites it.

ConEmu64_ggEzxdI32G.mp4

@gquerret
Copy link

gquerret commented Jan 7, 2022

Same here.

@ktyl
Copy link

ktyl commented Jan 13, 2022

Funny thing: if I resize the real console, it then displays the usual tildes, and conemu output is updated:

I've just spotted that not only resizing the real console helps, but also resizing conemu window restores the proper content

@TayfunTurgut
Copy link

I am having the same issue. The most frequent time I encounter this is when using git commit or when I try to paste some long lines into the terminal.
Also, if that helps, I noticed that it occurs more frequently to me when I use split tabs.

@ktyl
Copy link

ktyl commented Feb 4, 2022

this one seems to be related: #2404

@chocobearz
Copy link

I am having the same issue as well

image

But re-sizing the Window seems to fix it?

image

On Windows 11 as well:

λ ver

Microsoft Windows [Version 10.0.22000.493]

@zhpoo
Copy link

zhpoo commented Feb 17, 2022

Same here and resizing the window can fix it.
How can I fix this problem? I don't want to resize the window every time.

@Zd036
Copy link

Zd036 commented Feb 21, 2022

Same here and resizing the window can fix it. How can I fix this problem? I don't want to resize the window every time.

Switching to 'legacy console' in 'CMD' properties

@ShivaSmith
Copy link

ShivaSmith commented Feb 22, 2022

Same issue with Cmder on Windows 11... vi leads to "black screen" with just "ZZ" on 2nd line.

Resizing the window fixes the issue... definitely don't want to have to do that every time, of course.

It would be nice not have to switch CMD to "legacy console"... must be a better fix, at some point, but I can confirm that "legacy console" mode for CMD fixes this issue. I accessed it under Cmder System Menu (lower right hand corner of Cmder window) --> Debug --> Properties --> "Use legacy console" checkbox.

@ktyl
Copy link

ktyl commented Mar 9, 2022

issue still valid in build 220308 preview

@tienli
Copy link

tienli commented Mar 17, 2022

Use winpty (not good)

Found the issue long time ago. My way to use vim is to use it with winpty like

winpty vim <files ...>

Don't know why...
This was found while using msys2 mingw64 vim. Switching to legacy console mode solves the problem. Otherwise, need to use winpty which I don't like. Used ConEmu with msys2. Re-install msys2 from scratch and the problem is still there. My ConEmu setting with msys2 is put the following command line in shortcut icon property. And confirmed problem. ConEmu version = 210912

C:\msys64\msys2_shell.cmd -mingw64 -conemu

Even worse situation, it causes unreliable on-screen cut/paste. It pasted incorrect content often. A couple more time might succeed however.
One more, when cat a file, some on-screen content goes some extra spaces. With legacy set, no problem.
Guess this should be in another issue, but it looked pretty the same related.

@playgithub
Copy link
Author

The problem doesn't appear after upgrading.

@ktyl
Copy link

ktyl commented Apr 5, 2022

@playgithub could you please share what have you upgraded?

@playgithub
Copy link
Author

playgithub commented Apr 5, 2022

I'm using cmder, which uses ConEmu.
cmder support automatic update.
The version is as below

ConEmu 210912 [64]

@ktyl
Copy link

ktyl commented Apr 5, 2022

For me the fresh installation of cmder is still not working, have the same symptoms as before. The same happens after manually upgrading to conemu 220308 preview. I have no idea why it has started working for you, but in my case nothing has changed...

@playgithub playgithub reopened this Apr 5, 2022
@ghost
Copy link

ghost commented Apr 11, 2022

Same here, Windows 11 as well. It occurs to me when turn to Vim using git functions:

λ ver

Microsoft Windows [Versión 10.0.22000.593]

Cmder version: Version 1.3.18.1106

@Maximus5
Copy link
Owner

Is that reproduced with build 220418?

@gquerret
Copy link

Same here, but using Ctrl + L is enough to clear the screen. Not perfect, but better than the existing situation.

@ktyl
Copy link

ktyl commented Jun 28, 2022

For me after disabling the mentioned option everything seems to work ok, but I tested previous fixes in the preview version of conemu. Maybe there's something in the preview that fixed restoring the screen when vim exits
image

@Sayeh-1337
Copy link

@playgithub, Can you try to uncheck
ANSI and xterm sequences in ConEmu > settings > features
but check the sending characters, scrolling and lines rendering is ok not affected

@playgithub
Copy link
Author

Can you try to uncheck
ANSI and xterm sequences in ConEmu > settings > features

  • "ConEmu > settings > Features > ANSI and xterm sequences" unchecked
  • "ConEmu > settings > Features > Inject ConEmuHk" unchecked

It doesn't solved the problem after quit

but check the sending characters, scrolling and lines rendering is ok not affected

Where are the options?

@dphildebrandt
Copy link

Turning off Inject ConEmuHk is not a good solution, it breaks other things like arrow key scrolling through git log -p, and not properly clearing the screen after closing vim after a commit message.

@ktyl
Copy link

ktyl commented Jul 5, 2022

@dphildebrandt As I've mentioned above, ConEmu 220418 works ok for me with Inject ConEmuHk disabled.

  • backup your current conemu inside cmder directory
    mv %CMDER_ROOT%\vendor\conemu-maximus5 %CMDER_ROOT%\vendor\conemu-maximus5.bak
  • Download the preview version: https://www.fosshub.com/ConEmu.html
  • extract the conemu preview to %CMDER_ROOT%\vendor\conemu-maximus5

@dbilgin
Copy link

dbilgin commented Aug 25, 2022

I just got a new laptop and installed the latest version for cmder and had this issue as well. I did not want to disable anything, so I was trying to find a correlation in the problem between terminals.
When I went to vim and downloaded the gvim_9.0.0000.exe and installed it, everything started working just fine.

@EdmundMorris
Copy link

I have the same issue. Clean Windows 11 install. CMDer installed via Chocolatey. I tried rolling back a few versions but same issue.

Workaround: I noticed that CTRL-Z redraws the page and makes vim functional again

@jameseamaya
Copy link

jameseamaya commented Sep 6, 2022

I found another workaround that I haven't seen mentioned:

If you have WSL enabled, you can run "wsl vim" and to run vim from an installed linux distribution. I'm using git bash in conemu with 'alias vim="wsl vim"' and it works nicely.

@xiongbs
Copy link

xiongbs commented Sep 13, 2022

@dphildebrandt As I've mentioned above, ConEmu 220418 works ok for me with Inject ConEmuHk disabled.

  • backup your current conemu inside cmder directory
    mv %CMDER_ROOT%\vendor\conemu-maximus5 %CMDER_ROOT%\vendor\conemu-maximus5.bak
  • Download the preview version: https://www.fosshub.com/ConEmu.html
  • extract the conemu preview to %CMDER_ROOT%\vendor\conemu-maximus5

it's working for me, thx

@daxgames
Copy link

daxgames commented Oct 15, 2022

The issue still exists in ConEmu build 220807 and can be temporarily fixed by simply resizing the Conemu window.

@Maximus5 You ALWAYS say, 'use the connector'. There are NO examples of using the connector with a cmd.exe based shell that I have been able to find. The connector appears to require bash.exe?

Is it even possible to use the connector with a cmd.exe shell? If, so, can you point me to an example because I have not been able to figure it out. Some people don't want to have to run bash to use vim. ConEmu should not require a connector or bash to run vim. It is possible and works very well in cmd.exe.

@daxgames
Copy link

This is not a Cmder issue. I load up a default Conemu configured shell and have exactly the same issue. Updating/reinstallng Cmder will not help you.

@davidchaine
Copy link

davidchaine commented Oct 20, 2022

Same problem here. VIM works fine in standalone powershell console, but with powershell through ConEmu:
image
But found too that if I resize the window from this state, the view rerenders and everything becomes visible.

@virgo47
Copy link

virgo47 commented Dec 1, 2022

I had this problem when I ran the git-bash from Total Commander on Windows 11 via a hotkey definition in usercmd.ini - effectively, this was the command (I could have just written the same in the command line):

"C:\Program Files\ConEmu\ConEmu64.exe" -run "C:\Program Files\Git\git-bash.exe" --no-cd --command=usr/bin/bash.exe -l -i

For whatever reason, I've been using this for a long time, but -run is obsolete now, I guess.

I noticed that another tab with "Git bash" task works fine, so I just changed the command to use "{Git bash}" task instead of the whole -run ... parameter list - and it works fine. This also fixed the newlines acting like pure LF instead of CRLF.

@daxgames
Copy link

Still an issue in ConEmu 221218. I saw this on Windows 11 today but do not seem to have the issue on Windows 10 but I need to confirm this.

This is using a cmd.exe, also same issue in bash, session without the connector. Does not occur in bash in mintty.

The connector does not seem to support cmd.exe but no one will confirm that. @Maximus5???

Ctrl-Win-Alt-Space Shows same issue. Resizing ConEmu window resolves it until the next vim launch.

@sgornick
Copy link

sgornick commented May 23, 2023

Is this an issue only some of us are encountering? Here's my config:

λ ver

Microsoft Windows [Version 10.0.22621.1702]

I've installed Git for Windows, so that's from where vim is running:

λ where vim
C:\Users\Steve\AppData\Local\Programs\Git\usr\bin\vim.exe
λ vim --version
VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Mar 13 2023 19:52:41)
Included patches: 1-1403
Compiled by <https://www.msys2.org/>
λ ls %LOCALAPPDATA%\Programs\cmder_mini|grep Version
STDIN
Version 1.3.20.151

Conemu Help shows:
Your current ConEmu version is 221218 stable

λ env|grep -i term
STDIN
TERM=xterm-256color

If you have WSL enabled, you can run "wsl vim" and to run vim from an installed linux distribution. I'm using git bash in conemu with 'alias vim="wsl vim"' and it works nicely.

This is a nice workaround. I have wsl (Ubuntu), and that will suffice for now. When I do a git commit -m it still wants to use the vim from my path.

Resizing ConEmu window resolves it until the next vim launch.

That's another nice workaround ... kind of.

Is there anything else that can resolve this without needing workarounds?

@ktyl
Copy link

ktyl commented May 23, 2023

I've given up and moved to cmder inside Windows Terminal (https://medium.com/talpor/windows-terminal-cmder-%EF%B8%8F-573e6890d143) it works like a charm

@rabie-khlifi
Copy link

same here brand new install of git and cmder

@alexya
Copy link

alexya commented Aug 16, 2023

@EdmundMorris

Workaround: I noticed that CTRL-Z redraws the page and makes vim functional again

Yes, this workaround works for me. thx

@elienFR
Copy link

elienFR commented Aug 25, 2023

Hi everybody, here is a workaround that worked for me. In cmder press Win+Alt+P, then go to Features and uncheck Inject ConEmuHK. Start vim again. Enjoy :)

I hope this is going to help :)

image

@derrerker
Copy link

it works!

@EdmundMorris
Copy link

Working for me too, although it sometimes leaves a couple of lines of corrupt text on my console after existing vim. Easy enough to ctrl+L to redraw or ignore the lines. This is good enough until we get a proper fix. thanks @elienFR

@EdmundMorris
Copy link

Just a small point, the arrow keys don't work for paging with the work-around. E.g. git diff can only be used with the spacebar for the next page

@drew-chien
Copy link

I've seen the same issue here and managed to workaround this with neovim (which seems also have some more nice features).
Here's what I did:

  • Install neovim.
    I install it with chocolatey: choco install neovim
  • Set alias for vim and vi in cmder/config/user_aliases.cmd
    vi=nvim $*
    vim=nvim $*
    
  • Config git to use nvim: git config --global core.editor nvim

@EdmundMorris
Copy link

Thanks for the info @drew-chien. Best solution so far..

@daxgames
Copy link

daxgames commented Mar 7, 2024

I have started using unreleased Cmder that uses Windows Terminal instead of Conemu and it works prretty well also. FWIW I am a Cmder maintainer.

https://github.com/cmderdev/cmder/actions/runs/7805213995

*_wt* builds use windows terminal.

@ktyl
Copy link

ktyl commented Mar 7, 2024

it is possible to use previous cmder releases with windows terminal as well, as described in this reply. I've been working this way for a year now and I don't think I will ever return to the conemu based solution.

@playgithub
Copy link
Author

"cmder inside Windows Terminal" is a good a solution.
BTW "git-bash inside Windows Terminal" also works fine.

@DarinNing
Copy link

I found a way to solve the black screen problem that is suitable for me:
Step 1:
This can solve the black screen problem when Vim or git commit, but this triggers another fatal problem: when git commit, the upper, lower left and right arrow keys will become ABCD
image

Step 2:
According to the method in the picture, add "set term=xterm" to the environment, this solves the problem of different direction keys
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests