I'm wondering why my VIM can't apply the changes I modify in $MYVIMRC. The changes only apply to GVIM instead of VIM. I have the following in $MYVIMRC:
syntax on
colorscheme tomorrow-night
I also tried changing the color scheme setting in the command bar below by typing :colorscheme tomorrow-night but nothing changed. Why is it not changing?
The main difference between Vim and GVim is that GVim is an independent application that does not run in your terminal emulator.
If you use Vim and GVim for different purposes, I recommend you to create also a gvimrc file. But if you want to keep a single vimrc file, you can do something like this:
if has('gui_running')
" GVim
set guifont=Larabiefont\ 13
else
" Vim
set t_Co=256
set termguicolors
endif
colorscheme archery
Notice the set termguicolors in this code. I think this is the most convenient solution nowadays for common issues with colorschemes. It tells Vim to use the true colors defined for GVim with hexadecimal notation in guifg and guibg (instead of ctermfg and ctermbg).
Related
I have used vim for a while now, but after my friend introduced me to gvim, I'm trying to use it now. I have basic vimrc settings of :
set guifont=Monaco:h17
colorscheme zellner
set number
syntax on
I noticed that the settings were applied to my gvim. I want a different colorscheme for gvim and vim as I usually open the files I'll read quickly with vim or vi, and use gvim as my main code editor.
I heard people talk about the .gvimrc file, but I don't have it where my .bashrc, .zshrc, and .vimrc are.
How do I have separate colorschemes for gvim and vim?
Vim doesn't create either ~/.vimrc or ~/.gvimrc for you so you have to create them on your own.
You can either create the missing file in your shell, then edit in Vim:
$ touch ~/.gvimrc
$ vim ~/.gvimrc
<some editing>
:wq
or do everything from Vim:
:e ~/.gvimrc
<some editing>
:wq
Note: ~/.vimrc is still sourced whether you have a ~/.gvimrc or not so your gvimrc can be kept lightweight by only having GUI-specific options and overrides. In your case:
" ~/.vimrc
colorscheme zellner
set number
syntax on
" ~/.gvimrc
set guifont=Monaco:h17
colorscheme slate
You can do it in a single ~/.vimrc:
if has("gui_running")
colorscheme zellner
else
colorscheme blue
endif
See http://vimdoc.sourceforge.net/htmldoc/eval.html#has() and http://vimdoc.sourceforge.net/htmldoc/eval.html#feature-list
I have Ubuntu 17.04, Tmux: 2.3, vim:8.0, and a colorscheme called onedark
Vim displays right colorscheme when i am not inside TMUX, but when i am inside TMUX, vim looks completely different.
I tired every possible configurations in my .bashrc, .vimrc and .tmux.conf, but no luck.
I just recently discovered that when i run vim inside Tmux with sudo, root(administrative) privileges, everything works as expected which i don't think is a good solution.
So my question is how can i make vim display consistent colorscheme regardless of root privilages or weather i am inside or outside of Tmux.
My configurations related to colors are.
.tmux.conf
set-option -sa terminal-overrides ",xterm*:Tc"
set -g default-terminal "xterm-256color"
.vimrc
set encoding=utf-8
set nocompatible
set t_Co=256
set t_ut=
set background=dark
set showmatch
syntax on
if (empty($TMUX))
if (has("nvim"))
let $NVIM_TUI_ENABLE_TRUE_COLOR=1
endif
if (has("termguicolors"))
set termguicolors
endif
endif
colorscheme one
if do echo $TERM inside or outside of tmux, i get xterm-256color
The culprit is the termguicolors setting which you enable in terminal but not Tmux. Moving it out of the outermost if should fix things.
I want to change my colorscheme to this: earthsong on http://daylerees.github.io/
but it changes color something srange. like this (up: molokai, down: earthsong)
I try :colorscheme earthsong in vim, it gives same result.
I using vim on mac (latest version)
I got .vim code from https://github.com/daylerees/colour-schemes/blob/master/vim/colors/earthsong.vim
Can I get some help?
The very first place to look for help with an open source project is its issue tracker if it exists.
That colorscheme only uses your terminal palette. This means that you must adjust it to the colors used in the colorscheme which don't seem to be listed anywhere else than in the colorscheme itself.
If you use Vim 8 and an up-to-date iTerm you could tell Vim to use your GUI colors in the terminal with:
set termguicolors
In terminal.
I use 256-color terminal:
-->tput colors
256
I see colorized termial (PS1 and directory list) in Putty.
In Vim.
I set colorscheme to what I need:
:color
sweyla891274
I set t_Co to 256:
set t_Co
t_Co=256
I see correct syntax:
set syntax
syntax=cpp
Finally, I see colorized according to colorscheme text when I print in Vim :highlight.
Nevertheless my Vim is black and white.
Why????
Below is screenshot for :highlight
It looks like you're missing the syntax definitions for the cpp filetype. Check the output of :scriptnames, it shows all sourced scripts, and should contain syntax/cpp.vim from your runtime path. Also, check :set runtimepath?, and whether everything is properly installed.
I want to use solarize for macvim, but I want the default for when I am in vi. I assume I put a dew lines of code in my .vimrc... but what do I put in there?
MacVim uses the ~/.gvimrc, so you could set it up in the ~/.gvimrc file. Or you could use has("gui_running"):
if has("gui_running")
colorscheme solarized
endif
Both versions should work.
You can also use
if has("gui_macvim")
colorscheme solarized
endif
If you want solarized only for MacVim but not other graphical vim clients.