Sunday, August 25, 2013

Re: Mapping <*-CR>

On 08/25/2013 02:16 PM, Nikolay Pavlov wrote:
> TERM=konsole and TERM=konsole-256color are contained in my
> terminfo database, seem to work fine with konsole and can be
> configured in profiles/environment variables. To my surprise,
> files in /usr/share/terminfo regarding konsole were installed
> by ncurses and not by konsole, but it appears that *all* other
> entries there except for fbterm come from sys-libs/ncurses. So
> I can't say whether using such non-standard $TERM is fine, but
> I do use it (-256color variant).
>
> Note that konsole is the only terminal I know that supports
> true color. Using non-standard $TERM makes me able to
> recognize konsole and enable true color support in some
> applications (i.e. vim, there is a patch for this lying
> somewhere, search for 'guicolors').

Interesting. I've never tried to get true color. I'm only
recently using 256-color terminals :-) Here's a StackOverflow
question about true-color terminals:
http://stackoverflow.com/questions/6403744/are-there-terminals-that-support-true-color

They mention only Konsole as having true color, and a tiny bit
more searching on my part doesn't turn up anything else (other
than another terminal based on Konsole). If you want true
color, you may have to live with Konsole (though you could
certainly do worse).

You may find, however, that some things don't work quite right
now that Konsole sends xterm-compatible keycodes. The "konsole"
entry in terminfo matches an older version of Konsole, so
programs that use terminfo to determine what to expect will be
unable to recognize the keys.

For example, you can check the value of "kf13" in the terminfo
database to find out the code for Shift-F1. Checking for
TERM=xterm and TERM=konsole, you can see they are different:

tput -T xterm kf13 | cat -A; echo
^[[1;2P

tput -T konsole kf13 | cat -A; echo
^[O2P

But if you launch Vim from within modern Xterm or Konsole, you
can see what keys are actually sent:

vim -u NONE

Enter insert mode via "i", then press CTRL-v to insert the
keycode literally, then press Shift-F1. You should see the same
escape sequence in both Konsole and Xterm, matching the terminfo
entry for xterm:

^[[1;2P

To see all of the terminfo differences between xterm and
konsole, use infocmp:

infocmp xterm konsole

comparing xterm to konsole.
comparing booleans.
km: T:F.
mc5i: T:F.
comparing numbers.
comparing strings.
bel: '^G', NULL.
cbt: '\E[Z', NULL.
cnorm: '\E[?12l\E[?25h', '\E[?25h'.
cvvis: '\E[?12;25h', NULL.
el1: '\E[1K', NULL.
enacs: NULL, '\E)0'.
ich: '\E[%p1%d@', NULL.
invis: '\E[8m', NULL.
is2: '\E[!p\E[?3;4l\E[4l\E>',
'\E[m\E[?7h\E[4l\E>\E7\E[r\E[?1;3;4;6l\E8'.
kDC: '\E[3;2~', NULL.
kEND: '\E[1;2F', NULL.
kHOM: '\E[1;2H', NULL.
kIC: '\E[2;2~', NULL.
kLFT: '\E[1;2D', NULL.
kNXT: '\E[6;2~', NULL.
kPRV: '\E[5;2~', NULL.
kRIT: '\E[1;2C', NULL.
kb2: '\EOE', NULL.
kent: '\EOM', NULL.
kf13: '\E[1;2P', '\EO2P'.
kf14: '\E[1;2Q', '\EO2Q'.
[...]

See man terminfo for details on the meanings of kf13 and the
like.

Basically, since modern Konsole is trying to emulate xterm,
TERM=xterm is a closer match to the actual behavior than the old
TERM=konsole entry.

If your goal is just to have a TERM value you can query to know
whether true color is available, then you could generate your
own terminfo entry based on xterm.

If you don't need changes, you can just copy it to another name:

cd /usr/share/terminfo/x
sudo cp xterm-256color xterm-konsole-256color

Then you can set TERM=xterm-konsole-256color and check for the
presence of "konsole" inside TERM. Programs that inspect TERM
for the magic "xterm" string often check for it as a prefix, so
you'll still have the benefit of any hacks they provide, but
your own code can tell this is a konsole-based xterm.

Michael Henry

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