Vim colors not behaving how I expect? - vim

I read this article on turning off syntax highlighting, and I wanted to try the "color" scheme the author uses (effectively all white with some bolded words and a yellowish cursor), which he links to here. However, when I try to apply it in my terminal, it ends up looking like this instead:
What could be causing that? Context:
macOS 10.13.2
Terminal 2.8 (xterm-256color)
The color file exactly as it appears in the second link is in ~/.vim/colors/
My .vimrc:
set nocompatible
syntax on
set formatoptions=tcroql
set relativenumber
set incsearch
set hlsearch
set smartindent
filetype indent on
let g:go_highlight_trailing_whitespace_error=0

From the comments in the color schema I see you need to install and configure base16-shell.
Set this variable in your .vimrc:
let g:base16_shell_path=base16-builder/output/shell/
before running :color. Set the actual path where you install the scripts.

Related

How to disable linting in vim (no, it's not ALE)

Recently, the vim built into my Mac has started to show me linting feedback visually whenever I save. This is annoying and I'd rather it not happen. (Previous 20 years of using vi/vim did not have this behavior.)
My web searching suggests perhaps it's ALE, so I tried to disable it with :ALEToggle, but vim replied with "E492: Not an editor command: ALEToggle." So I don't think it's ALE.
The gutter shows many instances of S> as the indicator of where linting feedback resides, and then highlights characters within those lines as points of concern. See examples in screenshot below.
What linter uses S> and how do I disable it globally, for all files? I don't need or want this feature.
The relevant parts of my ~/.exrc file are here. (Note that things like ^H had to be typed out, because trying to paste them here failed for obvious reasons.) There is a little more than this in my file, but everything not shown here I've tried commenting out and it doesn't help, so it's not the problem.
execute pathogen#infect()
set ai
set ts=4
syntax on
set expandtab
set nu
filetype indent off
set softtabstop=4
set shiftwidth=4
set smarttab
set hlsearch
set ignorecase
set t_Co=256
colorscheme wombat256mod
map ^H :nohlsearch<Enter>
set mouse=a
set relativenumber
It looks like you're getting style warnings from Syntastic.
Either you can remove the plugin by deleting ~/.vim/bundle/syntastic or you could try adding this to your Vim config:
let g:syntastic_mode_map = {"mode": "passive"}

Where is my vim color scheme coming from?

When I edit a Fortran file with vim on my iMac it uses a very nice color scheme. I would like to send this color scheme file to a friend, but I cannot find where it is coming from.
In vim the :colorscheme command lists "default".
The default.vim file in /usr/share/vim/vim73/colors has the following non comment lines:
hi clear Normal
set bg&
hi clear
if exists("syntax_on")
syntax reset
endif
let colors_name = "default"
I have tested all of the color schemes in /usr/share/vim/vim73/colors and none of them are the one which vim is using.
My vimrc file contains the following non comment lines:
set modelines=0
set nocompatible " Use Vim defaults instead of 100% vi compatibility
set backspace=2 " more powerful backspacing
au BufWrite /private/tmp/crontab.* set nowritebackup
au BufWrite /private/etc/pw.* set nowritebackup
:let fortran_free_source=1
:hi link fortranTab NONE
:syntax on
:highlight Normal ctermfg=grey ctermbg=black
So where is this very nice color scheme coming from?
You are using the vim default colorscheme, so there is no file. The defaults are baked in and you see that the file defaults.vim is just clearing certain things so they fall back to the default and resetting the syntax highlighting to defaults. The default syntax highlighting colors are your terminal colors. Your terminal emulator provides a 16 color palette (by default, it can however go up to 256 colors) and vim references its colors from this palette. To send him your color scheme, you need to send him your terminal palette.
If you are using Terminal.app, you can see your color palette in Terminal->Preferences->Settings and the 16 color palette for each theme are the colors under "ANSI Colors". If you are using xterm or another X terminal emulator the colors are typically specified in a .Xresources or .Xdefaults file with the form:
*color0: rgb:2E/34/36
*color1: rgb:CC/00/00
*color2: rgb:4E/9A/06
*color3: rgb:C4/A0/00
*color4: rgb:00/00/FF
*color5: rgb:74/4E/7A
*color6: rgb:06/98/9A
*color7: rgb:FF/FF/FF
*color8: rgb:55/57/53
*color9: rgb:EF/29/29
*color10: rgb:8A/E2/34
*color11: rgb:FC/E9/4F
*color12: rgb:72/9F/CF
*color13: rgb:AD/7F/A8
*color14: rgb:59/BC/D9
*color15: rgb:FF/FF/FF
and can be queried from the command line with xrdb -q.

How to make comments Italic in gVim?

I am fairly new to Vim and mainly use gVim for most of my coding purposes. I am trying to figure out what to add in my _vimrc (in windows) to make my comments italic.
I tried adding
highlight Comment cterm=italic
but that didn't work. My modifications so far in my vimrc (if it matters) is:
color slate
set number
set nowrap
set guioptions+=b
if has('gui_running')
set guifont=Consolas:h10
endif
So what can I do so that my comments appear in italics (consolas, italic, size 10)?
The cterm definition is only for high color terminals; for the GUI, you need to use the gui= argument:
highlight Comment cterm=italic gui=italic
Also, put this after the :colorscheme command in your ~/.vimrc, or else it might get overridden.

ConEmu: Vim Syntax Highlight

Is it possible to get vim syntax highlighting in ConEmu?
Note. Some updated information may exists on the project site.
Well, builds since 130120 supports 256 colors in vim. You need to
Check options "Inject ConEmuHk" and "ANSI X3.64 / xterm 256 colors" on "Features" page
Check option "TrueMod (24bit color) support" on "Colors" page
Edit your vimrc file, sample lines are here. Of course, you need some 256-color vim scheme, it is zenburn in the last line of this example.
set term=xterm
set t_Co=256
let &t_AB="\e[48;5;%dm"
let &t_AF="\e[38;5;%dm"
colorscheme zenburn
And "vim" must be vim.exe ATM.
Note. 'Original' Vim (Win32 console executable from gvim##.exe and vim##w32.zip) passed tests. MinGW's Vim fails to switch to using Ansi sequences.
I know is an old question. But what worked for me was similar to the selected answer except that instead of setting term to xterm, set it to pcansi that way the keyboard keys will still work. For ConEmu in the %HOMEPATH%_vimrc
if !empty($CONEMUBUILD)
set term=pcansi
set t_Co=256
let &t_AB="\e[48;5;%dm"
let &t_AF="\e[38;5;%dm"
set bs=indent,eol,start
colorscheme wombat256
endif

Solarized theme on Vim + Terminator + Ubuntu 11.10

I am trying to setup solarized theme for vim on Terminator but it is not working. :-(
I was successfully able to setup solarized for terminator but it just doesn't seem to work for vim. Here is what my .vimrc looks like
call pathogen#infect()
filetype plugin indent on
syntax enable
set background=dark
"set t_Co=16
"let g:solarized_termcolors=16
let g:solarized_visibility = "high"
let g:solarized_contrast = "high"
colorscheme solarized
$TERM is set to xterm
I have also tried it with the two lines above uncommented but still not working.
Could someone please tell me what I am doing wrong?
Thanks!
Edit:
As Ethan Schoonover pointed out in his vim colorscheme readme, to make the colorscheme work first you have to configure your terminal colour palette.
In terminator there is a github repo that holds the colour configuration for the dark and light scheme.
The problem is that that palette isn't right either :P, the correct one is the one a guy posted in an issue on that same repo.
The correct configuration is the following (at least for the dark scheme):
[[solarized-dark]]
palette = "#073642:#dc322f:#859900:#b58900:#268bd2:#d33682:#2aa198:#eee8d5:#002b36:#cb4b16:#586e75:#657b83:#839496:#6c71c4:#93a1a1:#fdf6e3"
cursor_color = "#eee8d5"
foreground_color = "#eee8d5"
background_color = "#002b36"
After that, you have to configure the solarized colorscheme:
syntax on
set t_Co=16
set background=dark
colorscheme solarized
A couple of things to have in mind:
Normally, the set t_Co=16 line is not necessary because most terminal emulators only support 16 colours (terminator for example). But I rather be explicit than implicit (specially if you are going to sync your files between multiple computers).
The line set g:solarized_termcolors=16 is the default, so you can put it or not: it won't make any difference.
In my experience the 256 colour version is better (I like more grey background over a blue one; but that's personal taste :P). Contrary to what everyone could think, the 256 colour scheme is actually the 'fallback' being the 16 one the default. Yeah, weird, most people would think that 256 > 16. Anyway, to use the 'fallback' you have to change the lines to the following:
set t_Co=256
set g:solarized_termcolors=256
There are actually some issues with colour output in other CLI applications, I suggest you to go and read Seebi article about dircolors and an ongoing(?) discussion on the solarized github issue tracker.
Pretty sure you don't need the vim color theme import, since you already set up the color scheme for terminator. At least, that was the only way I could get it to play nice after lots of trial and error.
Here's a screenshot of my vimrc, from vim, within terminator:
As you can see, I haven't got the line
colorscheme solarized
So you could try taking that out - it finally seems to be working for me!
ps your screenshot doesn't look like it was taken from within terminator - unless we are talking about different terminators, of course.
Try adding this to your .vimrc file
let g:solarized_termcolors=16
The rest of the settings in the screenshot are fine.

Resources