Tuesday, September 7, 2010

convenient settings for /etc/motd etc. that has multi-character color codes

Is there a convenient way to edit /etc/motd (or for that matter any
other file that has color codes / multibyte characters in it)? The
usual problem is that many if the file has a color code (say,
^[[33m^[[1m ) then this occupies multiple characters in the editor but
zero characters when finally displayed. Hence it is hard to get the
alignment right without lots of trial and error. For an example see
below.

I was wondering if vim had a smart way of dealing with this?!

--
Rahul


cat /etc/motd

/
****************************************************************************
\
| ^[[33m^[[1m Welcome to Euclid
Cluster^[[0m |
| ^[[33m^[[1m euclid.foo.barr.edu
^[[0m |
| ^[[34m^[[1m (Kickstarted on Feb. 05
2010)^[[0m |
*----------------------------------------------------------------------------
*
| Operating System : CentOS 5.4
(Final) |
| Kernel :
2.6.18-164.el5 |
| Queuing System : Torque 2.3.3 + Maui
3.2.6p19 |
|^[[35m^[[1m Login nodes (x
2)^[[0m |
| Dell PowerEdge R410 (Two Quad-Core Intel Xeon E5520 @
2.27GHz) |
| RAM: 24 GB@1067 MHz; Harddisks: 2x300 GB 15k RPM SAS RAID
1 |
|
|

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

No comments: