I'm using both console and GUI VIM. Cannot understand why my GUI vim shows different color palette and different parentheses colors (Rainbow parentheses plugin)
Console vim is in the left (and it seems to be better):
Terminal vim only has (at most) 256 colors, gvim/macvim has a lot more (#000000 - #FFFFFF).
If you look in your colorscheme/plugins for highlight commands. Terminal vim will you ctermfg/ctermbg and gvim/macvim will use guifg/guibg when selecting which color to use.
Related
I 'm working on MacOS Catalina and I am using vim 8.2
The only profile set up in my iterm2 is the Default one.
which has been set up to used a slightly customized solarized theme as depicted below
I am now opening vim (which has also been set up to use its counterpart solarized colorscheme)
My question is, why when I am opening the :terminal in vim, this opens in black background (I don't think there even exists a profile with such setting)
This will happen when you have Vim running with 'termguicolors' on. (You can confirm it and see where it's being enabled with :verb set tgc?.) Same as when running in a GUI (not the terminal), it will tell Vim to use 24-bit colors, and use the color scheme full RGB color specifications, rather than use the terminal color palette.
In that situations, Vim's colors get completely detached from those of the terminal where Vim is running, so Vim's built-in terminal no longer has access to the actual terminal colors.
You can set specific colors to use in Vim's built-in terminal with the g:terminal_ansi_colors variable (see :help g:terminal_ansi_colors for details.)
Alternatively, disabling 'termguicolors' should work as well. Assuming the Vim color scheme has been built in a way that will use the terminal color scheme to reproduce the same colors, it might not have other side effects in how Vim colors otherwise look.
Removing line
set termguicolors
from .vimrc fixed it
I am using Vim under WSL (Ubuntu) and I installed Cmder for the support of unicode.
Also, I downloaded the codedark colorscheme for Vim and under CMD it works perfectly:
But when I open it with Cmder, this is the result:
As you can see, the colors are not the same.
In Cmder, I chose Monokai as my colorscheme in the settings, and if I change it to something else, it changes the colorscheme of Vim too.
Why doesn't Vim override those settings when its on?
How can I make Vim use the same colorscheme under any console?
Why doesn't Vim override those settings when its on?
A console application (such as Vim) is not allowed to access OS graphics API directly. Instead, it talks to the terminal (Cmder), which, in turn, talks to OS.
Your screen has 24-bit colors (16 million), but Cmder provides for Vim only 8 bits (256 colors). Therefore, Vim can choose from only 256 indexes in Cmder's palette, i.e. a subset of some preselected colors (when you choose a colorscheme in terminal, you actually select colors in that palette). As those colors more or less differ from original codedark scheme, the resulting picture looks different too.
How can I make Vim use the same colorscheme under any console?
Make sure your terminal offers a proper palette. Or switch both terminal and Vim to TrueColor mode. For Vim, it requires setting an option termguicolors on. For Cmder, I'm not really sure, but ConEmu, which Cmder is based on, does suppot TrueColor, so you can make a try.
I've the same question as Change GVim Color Scheme to be Like Command Line Vim
I specially like the 'darkblue' scheme on vim (through putty). Can there be some script which changes the darblue color scheme and changes the guibg and guifg to match the values in ctermbg and ctermfg.
First you must be aware, maybe you are, that most terminal emulators come with the ability to let the user define a 16 colors default palette. If 256 colors support is not activated explicitely, most - if not all - terminal emulators will default to those 16 colors.
Because each terminal emulator comes with its own default colors and those can be modified by the user there's no way to tell the value of DarkRed or even Black without actually looking at the configuration file or preferences window of your terminal emulator.
Assuming that you are not running in 256 colors mode, you should find where the default/custom colors are defined in your terminal emulator and note their hexadecimal value.
Here is my own colorscheme, in Gnome terminal:
Once you have all the values, you can make a copy of the colorscheme:
$ cp /usr/share/vim/vim7x/colors/darkblue.vim ~/.vim/colors/darkblue.vim
and change all the guibg and guifg to the values you noted earlier.
Good luck.
Vivify provides colorschemes that usually support both terminal vim and gvim. Try downloading your scheme there.
you can use this way...
:colorscheme darkblue
this is worked in the gvim and xterm.
if you want to change the command line vim you can use this method.
this is same like as the gvim.
first you can type :colorscheme then press the tab it will give more color scheme.
which you you can set.
Instead of trying to downgrade the GVIM colors to the limited set of terminal colors, I would (assuming you have a "modern" terminal emulator that supports 256 colors) use the CSApprox plugin to get a very close rendition of the GVIM colors in the console, i.e. upgrade the terminal colors.
I'm surprised this isn't up here. There's a plugin called csapprox that does exactly this. The coolest thing is that it does it with no configuration. Just set your colorscheme in your vimrc and it automatically loads the colors correctly in terminal vim. Add it to Vundle:
Bundle 'godlygeek/csapprox'
And restart Vim. The only issue I've found is that sourcing your vimrc breaks it. You'll have to restart vim every time you want to source the vimrc with :so ~/.vimrc.
I have tried this in both gVIM and VIM
the background is correctly applied in gVIM but not in VIM, it just stays black.
I use the command, :color zenburn
I am running this in Windows XP, Command Prompt
I also wonder how many colours command prompt in xp supports.
The colour sets between "gui" vim (gvim) and "console" vim (vim) are completely different. They can even be completely different for the same colour scheme.
I'm unfamiliar with the "zenburn" scheme, but it sounds like it makes different choices depending on whether you're using the GUI or not.
The :highlight command has different arguments (term=, cterm=, gui=, etc) that define the different colours used by vim in different modes. You should be able to look at your zenburn.vim colour definition file to see what it is using.
The colors for the GUI version and the console version of Vim are set differently in each colorscheme file. They don't even have to be set at all (some colorschemes define only the values for the GUI version and vice versa).
That being said, open up your colorscheme file (zenburn.vim) and look it up. If you're interested in the background color, check it up for a line looking similar to
hi Normal guibg=... guifg=.... ctermbg=.... ctermfg=...
or something similar.
The values should be there - change them to your liking if you wish.
In a windows command prompt, I find only 16 color color schemes work well. You may prefer to install cygwin and include mintty in the installation. mintty is a better terminal and I have no problem with 256 colors. http://code.google.com/p/mintty/
Why vim color schemes differs between gvim and a normal terminal?
For example many schemes of this showcase don work in a normal terminal.
I am saving all new schemes to ~/.vim/colors/ and set with :colorscheme cool
Any way to solve this?
Terminal windows (such as xterm) are typically limited to 2**8 colors. On the other hand, a GUI term can have as many colors as your graphical windows desktop.
Many vim color schemes are designed for either the GUI or the terminal; if they are designed for a GUI, it's unlikely they would display in a terminal well by-default.
If you need to convert a GUI scheme to terminal (256 colors), you can use the CSApprox plugin.
The two current answers are pretty good. Your vote should go to Mike's because there is no perfect workaround.
Vim colorschemes usually specify colors separately for the GUI and for the CLI. Some colorshemes don't define anything for the CLI and those that do use the X11 colors.
These X11 colors (noted 0-255) have been more or less standardized since a very long time and only really work in terminal emulators that support 256 colors. In other less capable terminal emulators the higher numbers are skipped and your colors are messed.
GUI Vim can also use these 256 colors plus any color you might want, as long as it's specified with an hexadecimal notation (#00d6e3).
Because GUI colorschemes can use thousands of colours, and CLI colorschemes can only use 256 colors the values used for the CLI can only be approximations of those used by the GUI. That's why CLI Vim can't really look like GUI Vim, even if you use a modern terminal emulator.
If your colorscheme of choice insists on using colors outside of the X11 range you will never have CLI Vim and GUI Vim look the same.
The only way to sync the colors of GUI and CLI Vim I see is to dumb down the GUI colorscheme by using X11 colors only.
Theres a new kid on the block called CSExact which moldes you terminal to the exact colors of the colorscheme. Colors look a lot better than with CSApprox.
This plugin allows the use of GUI (GVim) color schemes in (some) terminals.
This is done by using terminal magic to modify the terminal's color palette
on startup and each time a color scheme is loaded.
Because gvim directly selects X11 colors, while the terminal vim uses the available terminal palette.
So if you use a modern terminal (gnome, kde or even OS X) you can change the palette of available colors and VIM will look completely different. GVIM, on the other hand, sets the colors directly without the intermediate translation layer of the terminal app.