Tuesday, September 24, 2013

Re: Vim + colors inside ConEmu under windows.

On 24/09/13 12:21, Grégory Pakosz wrote:
> 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
>

Well, you'll have to find out which terminal ConEmu is trying to
"emulate". Apparently not xterm.

Vim under Windows should understand, as a minimum, the terminal names
compiled in it. Which ones they are can be seen in the top third of the
output of :version, as follows:

-builtin_terms
No terminal names built-in; Vim will rely on what your
system provides.
+builtin_terms
Only the most common ones
++builtin_terms
A rich collection ;-) .

To be able to use 256 colors, ":set t_Co=256" should be enough; but then
you need a colorscheme or plugin to use those 256 colors, otherwise all
you have is a fancy 16-color terminal. One problem under Windows is that
terminal Vim for Windows is not GUI-enabled, so I don't know if CSApprox
will be able to render GUI colors on even a 256-color Windows terminal.

If "windows" doesn't work (even with t_Co=256), try term=ansi which is a
general-purpose terminal. If your Windows console has been correctly set
up, it should understand ANSI control codes.


Best regards,
Tony.
--
"It is precisely because it is fashionable for Americans to know no science,
even though they may be well educated otherwise, that they so easily fall
prey to nonsense. They thus become part of the armies of the night, the
purveyors of nitwittery, the retailers of intellectual junk food, the
feeders on mental cardboard, for their ignorance keeps them from
distinguishing nectar from sewage."
[Isaac Asimov, "The Armies of the Night"]

--
--
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