Tuesday, September 24, 2013

Vim + colors inside ConEmu under windows.

Hello,

Under Windows, I'm using ConEmu + Vim (either Git bash's vim or vim.exe from the Vim 7.4 Windows installer).

ConEmu is a really great console program for Windows that happens to have kind of xterm 256 colors support.

Inside my .vimrc, I added the following:

if !empty($CONEMUBUILD)
set term=xterm
set t_Co=256
let &t_AB="\e[48;5;%dm"
let &t_AF="\e[38;5;%dm"
endif

So far so good, I'm happily using Vim with colors inside ConEmu.

However, set term=xterm breaks arrow keys (and also keypad).

As Vim's documentation mentions, Vim under Windows doesn't really understand term being set to something else than 'win32'.

At that point I'm kinda stuck. ConEmu + Vim won't display nice colors unless the configuration lines above are used. For instance not setting term to 'xterm' makes Vim display " ←[38;5;15m←[48;5;233m" escape sequences straight.

From there, I would like to know whether I can improve the hack by "somehow fixing termcaps"

For instance, I noticed in src/term.c:472 defines:

{K_UP, "\316H"},
{K_DOWN, "\316P"},
{K_LEFT, "\316K"},
{K_RIGHT, "\316M"},


So within Vim inside ConEMU I tried:

set t_ku="\316H"

That totally doesn't work. Also something strange happens:

1. :set t_ku? --> answers " t_ku <Up> ^[O*A"
2. :set t_ku="\316H" --> nothing happens
3. :set t_ku? --> E518: Unknown option: t_ku?

At that point, I realize many Vim behaviors may be conditioned by term being "win32" or by term being "xterm".

All in all is one of the following doable when inside ConEmu?

1. set term=xterm and "fix arrow keys"
or
2. keep term=win32 and "fix color display by fixing t_AB, t_AF etc so that it behaves like xterm"

I know it all sounds hairy, but please let me know if you have an idea on how to improve the Vim inside ConEmu situation.

Thank you,
Gregory

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment