0

I use a modified version of industry where my normal text color is bright white instead of grey.

Here is the offending line

highlight Normal ctermfg=white ctermbg=Black guifg=#dddddd  guibg=Black

I am having a problem in gnu screen where the bright white-ness bleeds into the next line of text in my terminal and so on until I reset it by hand with the command printf "\033[0m"

I tried to fix this by having vim execute the following command:

autocmd VimLeave * :call Printf_Fixup()

function! Printf_Fixup()
    !printf '\033[0m'
endfunction

but unfortunately, vim doesn't "just execute" the shell command printf '\033[0m' when exiting, it sometimes prompts me to manually press enter. not sure what's going on there.

Is there a way to configure vim to be more aggressive when "displaying" a colorscheme and use redundant ansi resets all over the place?

  • 1
    Any chance :set t_te=^[[0m works? (Where the ^[ is a literal escape: press Ctrl+v then esc). – Rich Aug 11 '17 at 13:20
  • @Rich that actually works perfectly in this case (although I'm not sure what it does). – Gregory Nisbet Aug 11 '17 at 19:21
  • I'll write up an answer. – Rich Aug 12 '17 at 7:51
  • I think it suggests though that my termcap is misconfigured in screen ... otherwise I wouldn't need to direct vim to ignore it, no? – Gregory Nisbet Aug 12 '17 at 7:53
  • It does suggest that, yes. – Rich Aug 12 '17 at 20:30
1

Vim reads the ti and te capabilities from your termcap and sends the commands in these to the terminal when it starts up and exits, respectively.

You could manually override the te setting to instead emit your escape sequence for clearing colours with the following command:

:let &t_te = "\<esc>[0m"

This shouldn't be necessary, though: Does :set t_te? report different values when Vim is run within screen and when it is not? If so, you may want to inspect the value stored for te in your terminfo database by running terminfo -C from the shell within and outside of screen.

See my earlier answer to a similar question for a bit more detail on the t_te setting.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.