Usually I like to use this theme:
How I can get it in Vim?
Vim's default colorscheme will look just like GVim's if you set your terminal emulator's background to white.
I can’t get Gruvbox to work. I’m using neovim. And I would really appreciate if someone can locate the mistake.
I’ve installed gruvbox in ~/.config/nvim/bundle/ and this is my entire ~/.config/nvim/init.vim file. I tried to add True Color in two different ways.
execute pathogen#infect()
filetype plugin indent on
set tabstop=4
set expandtab
map <C-n> :NERDTreeToggle<CR>
set termguicolors
let $NVIM_TUI_ENABLE_TRUE_COLOR=1
colorscheme gruvbox
And when I run :colorscheme from inside vim I see gruvbox listed there. But it looks awful, no highlighting, all grey text on white.
I don’t know where the mistake is.
Thank you.
To correct the appearance, remove the lines below that set termguicolors
set termguicolors
Let me preface by saying that I am entirely new to Vim and MacVim. I am trying to get my preferred colorscheme to work, and I have been partially successful. As it currently stands, the colorscheme will work if, once I edit into a file I type:
:syntax enable
However, on the intial load up, it does not work. I thought by putting syntax enable in my .vimrc file, that would activate it at load up, but this apparently is not working. So far, my .vimrc files looks like:
set nocompatible "We want the latest Vim settings/options
so ~/.vim/plugins.vim
filetype plugin indent on
syntax on
set backspace=indent,eol,start "Make backspace behave like every other editor.
let mapleader = ',' "The default leader is \, but a comma is much better.
set number "Activates line numbering.
"-----------Visuals------------"
colorscheme atom-dark "Sets colorscheme.
set t_CO=256 "Use 256 colors. This is useful for terminal Vim.
set guifont=Fira_Code:h13 "Sets font and font height.
set linespace=15 "Macvim-specific line height.
set guioptions-=l "Removes left hand scroll bar.
set guioptions-=L "Removes left hand scroll bar on vertically split screens.
set guioptions-=r "Removes right hand scroll bar.
set guioptions-=R "Removes right hand scroll bar on vertically split screens.
There is some more to it, but I don't believe it's relevant. Also, I have the colorscheme saved in my ~/.vim/colors folder, if that matters. And, finally, I am using MacVim for the most part.
What am I missing to get the colorscheme to work on the initial load? Or is it just required that I always manually enable syntax each time?
Thanks for the help in advance!
EDIT
My .gvimrc file:
set nocompatible " be iMproved, required
filetype off " required
set modelines=0 " sets modeline to 0 for security
" Turn on line numbers
set number
You should remove filetype off from your .gvimrc. First, see :help gvimrc:
The gvimrc file is where GUI-specific startup commands should be placed. It is always sourced after the vimrc file. If you have one then the $MYGVIMRC environment variable has its name.
Your .vimrc file sets filetype plugin indent on. But .gvimrc will be sourced after the .vimrc file, and it sets filetype off again. So any filetype detection will not be performed within your MacVim.
Also I recommend you to make .gvimrc contain GUI-specific configurations only. This means you can remove
set compatible
filetype off
set number
from your .gvimrc. Also you can move set modelines=0 to .vimrc, but I don't think it's necessary, so you may remove it also.
Additionally, you have options which will only work with GUI enabled Vim such as guifont, linespace and guioptions in your .vimrc. To make your .vimrc work on terminal Vim too, wrap that options with if has('gui_running'). So the .vimrc would be:
set nocompatible "We want the latest Vim settings/options
so ~/.vim/plugins.vim
filetype plugin indent on
syntax on
set backspace=indent,eol,start "Make backspace behave like every other editor.
let mapleader = ',' "The default leader is \, but a comma is much better.
set number "Activates line numbering.
"-----------Visuals------------"
colorscheme atom-dark "Sets colorscheme.
set t_Co=256 "Use 256 colors. This is useful for terminal Vim.
if has('gui_running')
set guifont=Fira_Code:h13 "Sets font and font height.
set linespace=15 "Macvim-specific line height.
set guioptions-=l "Removes left hand scroll bar.
set guioptions-=L "Removes left hand scroll bar on vertically split screens.
set guioptions-=r "Removes right hand scroll bar.
set guioptions-=R "Removes right hand scroll bar on vertically split screens.
endif
First, you mistyped t_CO; it's t_Co.
Second, that line is completely useless. Remove it and configure your terminal emulator correctly instead.
Third, colorscheme atom-dark will only work in the MacVim GUI. If you want atom-dark to work in Vim you'll need to use the atom-dark-256 variant. Note that atom-dark-256 is machine-generated so there will probably be many differences between Vim and MacVim.
Four, use the project's issue tracker.
I have a vim highlight to display whitespace errors in code:
" Highlight redundant whitespaces and tabs.
highlight RedundantSpaces ctermbg=red
match RedundantSpaces /\s\+$\| \+\ze\t\|\t/
Which displays trailing whitespace problems like this:
However, i've recently started using the solarized color scheme and I am not able to get these highlights to display.
I've tried changing the color names to no avail. The relevant part of my (simple) .vimrc says:
syntax enable
set background=dark
colorscheme solarized
Moving the :highlight after the :colorscheme still doesn't help you when you switch colorschemes in the Vim session.
For that to work, re-define your highlighting via the ColorScheme event:
autocmd ColorScheme * highlight RedundantSpaces ctermbg=red
BTW, your minimalistic solution has other problems:
It does not highlight in split windows.
You lose the ability of quickly highlighting custom stuff via :match.
There are several plugins that offer this functionality, in a better way. Mine is called ShowTrailingWhitespace; the plugin page contains links to alternatives.
I am sick and tired of the white background when I edit C/C++ etc. I want the black backround. That is what I currently have in my .vimrc file in regard to coloring. Please help me change it:
if !has('gui_running')
set t_Co=8 t_md=
highlight NORMAL ctermbg=black ctermfg=white
:help colorscheme
For example:
:colorscheme torte
Or, find a color scheme you like at vim.org.
Colors are controlled with the :highlight command Vim documentation: syntax , which allows you to specify colors for gvim (guifg and guibg) differently from colors for terminal vim (ctermfg and ctermbg).
All you have to do is make sure that the colors you assign to guifg and guibg are the same as you assign to ctermfg and ctermbg. Here's a script that might get you going: Xterm256 color names for console Vim
Depending on your colorscheme, the following command might work (it does depend on the colorscheme).
:set background=dark