Mac Vim Color

Question or issue on macOS:

I am having a strange issue with iTerm2, in terminal vim (non-gui) and the solarized color scheme. First, I have set iTerm2 to use the dark solarized colour scheme.

On Sun, Oct 26, 2008 at 6:35 PM, aireydc wrote: I'm looking for an old style green on black color scheme (like green phosphor screens). Honestly, I like Apple's Terminal.app better as well, but if I'm doing a lot of work in vim from the mac (normally I'm on a linux box), I like to have my color scheme (requires 256 color support) and mouse support. If Apple would just add those to Terminal.app, I don't think I'd ever use iTerm:). Hi guys, I have an obscure problem with my MacVim, it renders all colors too bright. It does that in both the stable version and snapshot 49. ATSUI renderer on/off doesn't matter. Starting without any.vim or.vimrc. The following commands gives me a background color of #1A1A1A (determined by colorpicker)::hi Normal guibg=#101010 guifg=#ffffff gui=none I tried:set bg=dark but that doesn't help. How do you change mac terminal theme; mac terminal color ls; change terminal color linux; Customize the colors of your Terminal in MacOS; Customizing the Terminal; Let’s get started. Option-1) Step-1. Open Terminal Window. You should see the color scheme like this: Step-2. Command: $ vi /.bashprofile and Enter Below lines and save file. My local machine is Mac OS X Mountain Lion. Remote server is Debian (Squeeze). Remote Vim is 7.2. EDIT-1: I don't know if the following are related, but here are a few more symptoms: 1. If I split the screen within Vim, the file info lines between them get jumbled up (must be related, I think) 2. 'set ruler' does not work.

I am also using solarized for vim. I have the following lines in my .vimrc

In the terminal the color scheme looks incorrect:

For reference this is how it looks under MacVim (gui vim)

What do I need to change in iTerm or my .vimrc to get the colors looking correctly in my console vim?

How to solve this problem?

Color

Solution no. 1:

A couple of things to check:

  1. In iTerm2, in Preferences -> Profiles -> Terminal, under “Terminal Emulation” you have “Report Terminal Type:” set to xterm-256color.

  2. In your .vimrc, there are some options you can also set to make sure it’s using 256 colors:

    And one of those should work, but #1 first.

BUT, if you’re using the default, built in vim on Snow Leopard, it won’t work, as it’s not built with support for 256 colors. I believe the built in version in Lion does.

Edit: Based on several comments on this answer, I’ve removed let g:solarized_termcolors = 256 line from the .vimrc example above. It appears that could be a problem for some. Another says that adding the line let g:solarized_termcolors = 16 fixed a color display problem. Your own mileage may vary.

Second Edit: If you’ve loaded the solarized color palette into iTerm2, then you must let g:solarized_termcolors=16. Only let g:solarized_termcolors=256 if you are not using the solarized palette as your iTerm2 color preset.

Solution no. 2:

The above answers didn’t work for me.

I’m using iTerm2 with vim 7.3 on OS X 10.7.4.

If the above solutions didn’t work for you too, try this

Update: According to Jim Stewart, this works on Kitty too.

Solution no. 3:

Download Solarized package (https://github.com/altercation/solarized) and follow instructions:


Open iTerm 2, open Preferences, click on the “Profiles” (formerly Addresses, formerly Bookmarks) icon in the preferences toolbar, then select the “colors” tab. Click on the “load presets” and select “import…”. Select the Solarized Light or Dark theme file.
You have now loaded the Solarized color presets into iTerm 2, but
haven’t yet applied them. To apply them, simply select an existing
profile from the profile list window on the left, or create a new
profile. Then select the Solarized Dark or Solarized Light preset from
the “Load Presets” drop down.

Or:

Modify .vimrc

Dark Theme:

Light

Solution no. 4:

This worked for me in OS X 10.9.1 in iTerm 2 as well as Terminal. One mistake I was making was putting the colorscheme declaration before the termtrans and termcolors settings (and I needed both of these to make it work). As others have said, I set my terminal type to xterm-256color

Solution no. 5:

I struggled with the same problem on OSX 10.11.6, iTerm2 Build 3.0.12.

Here is my fix for it.

Mac Vim Color Chart

  1. .vimrc

    syntax enable
    set background=dark
    colorscheme solarized

  2. Set Report Terminal Type to xterm-256color.

  1. Set color preset in the profile to Solarized Dark

Solution no. 6:

From the creator: http://ethanschoonover.com/solarized/vim-colors-solarized


IMPORTANT NOTE FOR TERMINAL USERS:
If you are going to use Solarized in Terminal mode (i.e. not in a GUI version like gvim or macvim), please please please consider setting your terminal emulator’s colorscheme to used the Solarized palette. I’ve included palettes for some popular terminal emulator as well as Xdefaults in the official Solarized download available from Solarized homepage. If you use Solarized without these colors, Solarized will need to be told to degrade its colorscheme to a set compatible with the limited 256 terminal palette (whereas by using the terminal’s 16 ansi color values, you can set the correct, specific values for the Solarized palette).
If you do use the custom terminal colors, solarized.vim should work out of the box for you. If you are using a terminal emulator that supports 256 colors and don’t want to use the custom Solarized terminal colors, you will need to use the degraded 256 colorscheme. To do so, simply add the following line before the colorschem solarized line:

let g:solarized_termcolors=256


Again, I recommend just changing your terminal colors to Solarized values either manually or via one of the many terminal schemes available for import.

Solution no. 7:

Bill Turner’s answer works, but there is a way to get the colors to match MacVim exactly. Solarized has support specifically for iTerm2, among other terminal emulators.

  1. Go to the iterm2-colors-solarized github page
  2. Follow the instructions under “Installation”
  3. Make sure your .vimrc has the line colorscheme solarized

This should set the vim colors in iTerm2 to be exactly as they are in gui editors.

Solution no. 8:

Mac Vim Monokai Color Scheme

A simple way to solve this problem is:

In colors dir on vim-color-solarized exist an arquive named ‘solarozed.vim’

Open this file and search:
exe “let s:bg_back = ‘ “.s:vmode.”bg=”.s:back .”‘”

replace to:
exe “let s:bg_back = ‘ “.s:vmode.”bg=”.s:none .”‘”

Mac Vim Color Scheme

Solution no. 9:

For any still having issues like I was, I had installed iterm2 solarized color profile. Installing vim-color-solarized to vim bundles and following the instructions was unnecessary and was incompatible. There were funny highlighting issues like in the screen capture above.

Lesson learned: don’t do both.

Solution no. 10:

I tried all of the previous suggestions. I just added set t_Co=256A good man is hard to find pdf free download. to .vimrc and it was fixed. I didn’t need to create a tmux alias or change my config file.

Hope this helps!

I often work on remote servers. There is one server that seems to get 'confused' about the number of available columns (my best guess), but only when working in Vim (not bash). Specifically, when I open a file with long lines, everything looks normal at first. But as I move around, the text get jumbled up. The cursor will appear as though it's over a certain word, but I'm actually on a different line. I can tell because if I search for the word the cursor is covering, a word from another line suddenly appears under my cursor. Also, some of the text appear to be wrapping to the next line (even though I have 'set nowrap'). And it wraps much sooner than the window would require.

If I perform 'ls' on the command line, text extends to the end of the window. So I think it's Vim specific.

What I've checked:
1. I've checked that $TERM matches the $TERM on my local machine (thinking there was some miscommunication there). Both are 'xterm-color'.
2. I've checked that Vim hasn't set some odd number of columns (verbose set columns?). The returned value matches the width of my window.
3. I've done a lot of googling and couldn't find anything related.

I appreciate any help. Let me know how I can clarify.

Mac Vim Color Schemes

My local machine is Mac OS X Mountain Lion. Remote server is Debian (Squeeze). Remote Vim is 7.2.

EDIT-1:
I don't know if the following are related, but here are a few more symptoms:
1. If I split the screen within Vim, the file info lines between them get jumbled up (must be related, I think)
2. 'set ruler' does not work

EDIT-2:
I just realized that 'less' is wrapping text too early (way before the end of the window) and at the exact same spot Vim is attempting to. So I'm guessing it actually is related to bash somehow. The only difference with 'less' is that the lines do not get messed up like they do in Vim.

EDIT-3: This is all probably obvious now, and I should have checked other editors earlier, but naturally emacs has the same issues as Vim. Is this a bash issue? A Term issue?

Mac Vim Color

EDIT-4: I just tried accessing the same files remotely using iTerm (instead of Terminal.app) and it is working perfectly. I don't know what to make of that. In a sense my problem is solved, but I would love to understand what is going on if anyone can shed some light.

Comments are closed.