12

Ok, I've been searching for a while and just can't seem to find the answer, so I'm hoping someone can point me straight here...

I have (g)Vim 7.3 for windows installed and am trying to run it from the powershell prompt (v2.0/Win 7-amd64). Vim starts fine, but the colors are all jacked. Normally I use the desert theme for gVim. For POSIX shells I usually use CSApprox.vim plugin to get the gVim colors in vim and it works great (all i have set in the .vimrc is the set t_Co=256 for it). Anyway, I've tried vim with and with out the 256 and CSApprox plugin, but still get the wrong colors when launched from powershell (and cmd, but lets stick with powershell for simplicity here). How can I get powershell vim to look like gVim desert without permanately changing the powershell colors outside of Vim?

John S.
  • 1,937
  • 2
  • 18
  • 28
  • 1
    i'm having the exact same problem – justin cress Nov 30 '11 at 15:13
  • I think this is a problem with the color palette used by PowerShell. One would have to modify this palette to match a default xterm. I haven't given up hope, yet. – user1129682 Jan 27 '15 at 08:25
  • Compare user environment from ps, cmd and directly launched (? whatever method where the colors are right). Something is being presented to vim differently from the different sources. I suspect it's storing profile information relative to starting path. If you look in the shortcut in the startmenu or desktop, find a 'start in' property. Then go into powershell or cmd, change to that path, then launch vim, does it pick up the colors? – Jeter-work Nov 23 '15 at 19:32

4 Answers4

2

This does not appear to be possible.

John S.
  • 1,937
  • 2
  • 18
  • 28
0

PowerShell, like all terminals, defines a limited set of colours to be used by applications that run within it. See this answer for how to find out which ones. Therefore, if you want to recreate the desert theme exactly you will need to modify your PowerShell colours.

Community
  • 1
  • 1
LinusSch
  • 158
  • 1
  • 6
0

Have you added the line colorscheme desert to your _vimrc? It sets the gvim color when called from powershell or cmd for me. The only issue I had when adding it was finding the "right" _vimrc but running the :set runtimepath? in vim took care of that.

Bruce
  • 1,633
  • 1
  • 11
  • 12
  • yes, I only have one _vimrc file in the main directory of Vim (none in my profile). It is read by gVim. Running :set runtimepath shows the program files vim73 dir, as expected and that is where my _vimrc file is. Is there another or something else to be aware of or look at? – John S. Nov 14 '11 at 21:23
  • The only other thing I can think of is to start gvim then at the menu click Edit -> Startup Settings. It will open the _vimrc it read at startup. Make sure that "colorscheme desert" is there and look for anything else that could change/override it. If that doesn't help I'm out of ideas other than just sending you my _vimrc to compare/test. – Bruce Nov 15 '11 at 14:04
  • It's not the exact scenario of the question, but this is wonderful to know for fixing the obnoxious colors in vi when using Powershell to ssh into a Linux machine. No more invisible blue letters on a blue background. Thank you. – GG2 Feb 25 '22 at 22:29
-1

You could try: $Host.UI.RawUI.BackgroundColor = 'black' before launching vim…

Benoit
  • 76,634
  • 23
  • 210
  • 236