I'm using a colour scheme which makes some text unreadable in the vim terminal. Therefore I want to alter g:terminal_ansi_colors.

:echo g:terminal_ansi_colors

This shows me the value of the variable, but I cannot select the text. What can I do to select the text, or how can I redirect the variable value to a file, a vim register or the system clipboard?

1 Answer 1


I would do:

:redir @* | echo g:terminal_ansi_colors | redir END

It moves the output of echo g:terminal_ansi_colors to the * register.

  • Perfect, thanks.
    – paradroid
    Nov 28, 2023 at 6:13
  • Thanks for the feedback. If the solution fit your need maybe you can accept it. It allow the question to rest ;-) Nov 28, 2023 at 6:14
  • 2
    Using setreg(), let @* = thevar, or even :put=thevar would have been simpler. Did I miss something? Nov 28, 2023 at 9:49
  • For that case it is even better indeed :-) Nov 28, 2023 at 10:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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