How to enable 256-color console Vim syntax highlight in ConEmu

256-colors vim in ConEmu


  • Only certain releases are supported;
  • Vim’s executable must be named ‘vim.exe’;
  • 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.
if !has("gui_running")
    set term=xterm
    set t_Co=256
    let &t_AB="\e[48;5;%dm"
    let &t_AF="\e[38;5;%dm"
    colorscheme zenburn

You may also check environment variable ConEmuANSI but I’m not sure how to do that properly.

Only certain releases are supported

NB ‘Original’ Win32 console executable Vim from gvim##.exe and passed tests (versions 7.3 and 7.4 were tested). There is no guarantee that other versions would be working, for example MinGW’s and Cygwin’s Vim do not pass ANSI to ConEmu.

Notes about vim color schemes

Selected Vim color scheme must be prepared specially for Xterm color. Some color schemes are working properly in Gvim, showing 256 colors and more, but if they aren’t aware about xterm sequences, they will fail in the console vim.

If you have problems with certain color scheme, please contact it’s author.

Color scheme mentioned above (zenburn) is working fine.

Fix BS issue

If you have problems with BS in Vim under ConEmu when term=xterm, you may try to remap BS key:

inoremap <Char-0x07F> <BS>
nnoremap <Char-0x07F> <BS>

Check for details in the issue 641.

How to enable Vim scrolling using mouse Wheel in ConEmu

When ConEmu emulates xterm it translates mouse wheel to the following sequences:

ConEmu Event Sequence Description
<WheelDown> \e[62~ toward the user
<WheelUp> \e[63~ away from the user
<Shift><WheelDown> \e[64~ toward the user
<Shift><WheelUp> \e[65~ away from the user

So all you need to add following lines to your vimrc file:

" let mouse wheel scroll file contents
if !has("gui_running")
    set term=xterm
    set mouse=a
    set nocompatible
    inoremap <Esc>[62~ <C-X><C-E>
    inoremap <Esc>[63~ <C-X><C-Y>
    nnoremap <Esc>[62~ <C-E>
    nnoremap <Esc>[63~ <C-Y>

If you have problems with Vim configuration, you may refer to the Issue 1007.

vim-airline plugin

StackOverflow and SuperUser answers