Reading gnu-screen logs with vim
To provide an answer here and finally mark this fixed: The AnsiEsc plugin adds syntax highlighting for ANSI color sequences. So instead of seeing ^[[30m
; the following text will be highlighting in the corresponding color, just like when using less --raw-control-chars
.
When using vim or less in gnu screen, quitting vim or less leaves a lingering imprint
screen's altscreen
(alternate screen) feature is turned off by default.
Add this to your .screenrc
:
altscreen on
See: http://www.gnu.org/software/screen/manual/screen.html#Redisplay
Running Vim in GNU Screen: How to avoid Shift+left/right to delete characters
You may need to run screen
with a different TERM
, such as xterm
, e.g.
$ screen -T xterm
...
Why is the default vim's background option is differrent when run in gnome-terminal and gnu-screen?
vim's using an escape sequence from xterm's repertoire to ask what the background color is, which you can see in the block in term.c
beginning with the comment
/* Check for background color response from the terminal:
*
* {lead}11;rgb:{rrrr}/{gggg}/{bbbb}{tail}
*
* {lead} can be <Esc>] or OSC
* {tail} can be '\007', <Esc>\ or STERM.
culminating in some code (which I'd recommend rewriting...):
{/* TODO: don't set option when already the right value */
LOG_TR("Received RBG");
rbg_status = RBG_GOT;
set_option_value((char_u *)"bg", 0L, (char_u *)(
(3 * '6' < tp[j+7] + tp[j+12] + tp[j+17])
? "light" : "dark"), 0);
which was added in mid-2015:
commit b5c3265521749fda81ae4b052de35a0d1209cf50
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Jun 25 17:03:36 2015 +0200
patch 7.4.757
Problem: Cannot detect the background color of a terminal.
Solution: Add T_RBG to request the background color if possible. (Lubomir
Rintel)
xterm patch #94 (March 1999) added the control sequence for querying colors:
extend dynamic colors control sequences to allow users to determine the colors and font which are currently active.
VTE's developers copied the feature early in 2014 (see #567444).
But GNU screen doesn't recognize the sequence (or its response), so it doesn't allow it to pass through.
By the way, there's more than one way that vim could have done this. I checked to see which method it used with strace
.
Vim background with gnu screen
[filling in for the OP, see the comment]
The OP found the issue:
I needed to have this set:
defbce "on"
This forces background colours to refresh.
"Change background-color-erase setting. If
bce
is set to “on”, all characters cleared by an erase/insert/scroll/clear operation will be displayed in the current background color. Otherwise the default background color is used."
– Ravi 19 hours ago
Related Topics
Why Can't Cuda's Examples Makefile Find the Cuda Libraries
How to Solve "Bash: Ls: Command Not Found"
"Echo" Output Different Answer by Sh and Bash
Hash ("#") Symbol in /Etc/Environment Causes String to Be Split
Arm: Disabling Mmu and Updating Pc
How to Escape Unusual/Uniq Characters from Expect Scripts
How to Get the CPU Time for a Perl System Call
Significance of Address 0X8048080
Random Alphanumeric String Linux Swift 3
Sed: Find Pattern Over Two Lines, Not Replace After That Pattern
Sched_Fifo Higher Priority Thread Is Getting Preempted by the Sched_Fifo Lower Priority Thread
Delete the Word Whose Length Is Less Than 2 in Bash
Raspberry Pi Refusing Connection to Bottle Server
Undefined Reference to 'Pthread_Init' When Using -Lpthread Flag:
Why Would the Elf Header of a Shared Library Specify Linux as the Osabi
Using Pipe in Linux Using Parent and Child Process
How to Pass a Complete Argument List in Bash While Keeping Mulitword Arguments Together