kaytrance
kaytrance

Reputation: 2757

Linux console text editor - writing with colors

Is there a way to write a text in some console text editor under linux so that I can define the color of the text displayed based on system console colors defined (*color0.. *color15)?

For example I what the part of the text to be displayed as green, and part as cyan while I am typing in the text editor.

Upvotes: 1

Views: 3157

Answers (3)

BPS
BPS

Reputation: 218

The Txtfmt plugin for Vim provides what you're looking for. In addition to colors, you can also apply formatting to the text: e.g., bold, underline, italic, undercurl, etc..., as well as any combination thereof.

Txtfmt

Note: The errors mentioned by the previous poster are most likely caused by failure to enable filetype plugins in his vimrc. For some reason, the normally desired setting is not the default in many Vim installations. Adding the following line should prevent the errors:

filetype plugin on

Upvotes: 1

kaytrance
kaytrance

Reputation: 2757

The only thing I have found so far is a VIM plugin called TxtFmt available at http://www.vim.org/scripts/script.php?script_id=2208

The only problem is that I cannot make it work - On :MakeTextPage I get bunch of errors like "Unknown function: Txtfmt_GetTokStr" and many others.

Upvotes: 0

Alex Gittemeier
Alex Gittemeier

Reputation: 5373

You can use these codes: http://tldp.org/HOWTO/Bash-Prompt-HOWTO/x329.html

Basic Syntax:

echo '/033[ the color code m' (no spaces)

To reset

echo '\033[0;0m'

To make a literal color:

  • In vi you can use Ctrl-V then Esc instead of echo '\033
  • in nano you can use Meta-V then Esc instead of echo '\033
    • Meta-v can either be Esc then v or Alt-v depending on your setup.

Upvotes: 0

Related Questions