Maximus5 / ConEmu

Customizable Windows terminal with tabs, splits, quake-style, hotkeys and more
https://conemu.github.io/
BSD 3-Clause "New" or "Revised" License
8.53k stars 572 forks source link

`vim` in `cmd::Cmder` display black screen #2384

Closed playgithub closed 4 months ago

playgithub commented 2 years ago

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.

Maximus5 commented 2 years ago

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

playgithub commented 2 years ago

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

gquerret commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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.

https://user-images.githubusercontent.com/2254879/148541255-5aef59ce-78c3-4cf2-8a27-9e66021d9fe8.mp4

gquerret commented 2 years ago

Same here.

ktyl commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

this one seems to be related: https://github.com/Maximus5/ConEmu/issues/2404

chocobearz commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

issue still valid in build 220308 preview

tienli commented 2 years ago

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 commented 2 years ago

The problem doesn't appear after upgrading.

ktyl commented 2 years ago

@playgithub could you please share what have you upgraded?

playgithub commented 2 years ago

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

ConEmu 210912 [64]
ktyl commented 2 years ago

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...

ghost commented 2 years ago

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 commented 2 years ago

Is that reproduced with build 220418?

ktyl commented 2 years ago

@Maximus5 unfortunately the issue still exists in 220418 for me

edoswaldgo commented 2 years ago

Hi everyone,

I'm still encountering this problem when using Windows 11 version 21H2 with the latest Cmder stable release (ConEmu 210912).

One workaround is to resize the window, as suggested by the others, and the usual format of Vim will be displayed. Thanks for the suggestions but hopefully this issue will be fixed.

cRyckreator commented 2 years ago

I met this issue today(May 12th, 2022) on win11 22000.675. However, the problem magically disappears after I installed gvim for Windows from its official website and upgrade the Windows system (with KB5013628 and KB5013943). I did those things with no intention to fix the cmder vim issue but vim in cmder seems work fine later.

Since the update notes of KB5013628 and KB5013943 mention nothing remotely relevant to this issue, I assume you guys could try installing gvim to fix this issue.

taichushouwang commented 2 years ago

I met this issue today(May 12th, 2022) on win11 22000.675. However, the problem magically disappears after I installed gvim for Windows from its official website and upgrade the Windows system (with KB5013628 and KB5013943). I did those things with no intention to fix the cmder vim issue but vim in cmder seems work fine later.

Since the update notes of KB5013628 and KB5013943 mention nothing remotely relevant to this issue, I assume you guys could try installing gvim to fix this issue.

@cRyckreator can you tell me, what is the version of the gvim you download? I install [gvim_8.2.2825.exe], but still have this issue.

cRyckreator commented 2 years ago

@taichushouwang gVim 8.2 with OLE support

image

It's from the self-installing executable on vim's official site. https://www.vim.org/download.php#pc

Download link: https://ftp.nluug.nl/pub/vim/pc/gvim82.exe

I have no idea how I fix the issue so if this installation works for you pls post a confirmation here to help others

taichushouwang commented 2 years ago

@cRyckreator I think I find the reason of the problem. After change the version of Vim, we can fix this problem. Download the https://ftp.nluug.nl/pub/vim/pc/gvim82.exe, And add the path of the vim82 to the environment variable of Windows, then we can use cmder normally. But there is still a problem, we use git in the cmder. After we input "git commit", it still display black screen. Because the git still use the vim.exe in the path "cmder\vendor\git-for-windows\usr\bin\vim.exe", And after I replace the vim.exe with I downloaded, it will not display black screen, but it show garbled for the Chinese, can you provide some suggestions or fix this problem @Maximus5

Sayeh-1337 commented 2 years ago

For anyone still faces such a problem: you may try un-checking this In-console options in Cmder Settings > Features :

Inject ConEmuHk

gquerret commented 2 years ago

@Sayeh-1337 This works for me ! What is the impact of disable ConEmuHk ?

Sayeh-1337 commented 2 years ago

@gquerret, as per this document ConEmu provides two dlls ConEmuHk.dll and ConEmuHk64.dll which will be loaded in each process of console processes started in ConEmu window. this help in injection the required windows API to work in each process spawned. IMO, latest updates and latest Windows 11 solved a lot of Microsoft bugs which may not need to have dll injection solution. till now I don't face any problem related to multiple conemu consoles process handling.

playgithub commented 2 years ago

For anyone still faces such a problem: you may try un-checking this In-console options in Cmder Settings > Features :

Inject ConEmuHk

Windows 11 Pro

After this, there is a problem when vim quits image

If enable "Inject ConEmuHk", black screen in vim.

Sayeh-1337 commented 2 years ago

@playgithub, did you tried to open new tab after disabling it to see if it still persistent?

playgithub commented 2 years ago

@playgithub, did you tried to open new tab after disabling it to see if it still persistent?

Yes, tested thoroughly

gquerret commented 2 years ago

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

ktyl commented 2 years ago

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 commented 2 years ago

@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 commented 2 years ago

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

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 commented 2 years ago

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 commented 2 years ago

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

dbilgin commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

@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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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.