Terminal Too Wide

LazySystemAdmin is a useful how-to website that covers System Administration, Operating Systems, Cloud, DevOps, Virtualization, Scripts and Video Tutorials. This website to share our expertise and knowledge on Linux, UNIX, Windows, Hardware, Security, Cloud.

  1. The most practical way to fix this is just to buy a new battery terminal. I've been there and done that with loose terminals/strip nuts. It's NOT fun having to jiggle the connection every time and risk somehow one day shorting out the battery because your in a rush trying to rig it to work or if your stuck in the rain.
  2. Terminal too wide and I can't do viing. Would appreciate if someone help me. Muthu Comment. Premium Content You need an Expert Office subscription to comment. Start Free Trial. Watch Question. Premium Content You need an Expert Office subscription to watch. Start Free Trial.

Workaround for vi “Terminal too wide” problem

Use the Unix command line and sooner or later, you will be editing text files. One of the best ways of doing that is with the vi editor. It is available as standard on almost every unix/linux system. While other editors are available (ed, emacs, vim, etc), vi is quick and convenient. It offers a good balance between usability and ubiquity.

This article offers a workaround for the annoying “Terminal too wide” problem encountered by vi users on Solaris.

Vi was originally written for screens (terminals) which were 80 characters wide. In a modern windowing environment, the terminal has been replaced by virtual terminal apps – xterm, lterm, Terminal and many others. The width of a virtual terminal depends on how much big you make the window. On a large screen it could easily be 200 characters or more.

Terminal too wide in putty

Weakness of Solaris Vi Distribution

Linux systems handle this fine. But on Solaris, vi will fail if your terminal is more than about 160 characters wide:

Terminal too wide
:
1 more file to edit:q

Stty Adjustment

One workaround is to adjust the terminal “columns” setting before the edit, 163 being the maximum that vi seems willing to accept. Eg:

However, this will leave you with a terminal 160 columns wide, even if your terminal window (eg. xterm) is much wider. Text will wrap at 160 characters, leaving the right side of the terminal window unused, and generally making a mess. No problem, just change back the setting. For example:

And things look normal again. To save typing every time you use vi in a wide terminal, the following aliases can be set up.

Automated stty Adjustment

Write a background function to do it. This is for bash:

Now every time you invoke “vi”, the alias and the “myvi” function act to set the width narrow enough for vi (160 characters) before your edit, and then put it back to its original value afterwards. Add the above definitions to ~/.bash_profile (or wherever) to make them permanent. NB On your system vi may be located somewhere else, eg /bin/vi. Adjust the function accordingly.

Improvement Suggestion
Oracle/Sun could edit a few lines of source to remove this annoyance altogether. Update November 2013 – it seems they have done this, as the problem does not seem to occur in later releases of Solaris 10.

Working with Multiple Files
If you often use vi to edit more than one file at the same time, take note of Joe’s suggestion below.

Please read this before reporting a bug:
https://wiki.archlinux.org/index.php/Reporting_Bug_Guidelines
Do NOT report bugs when a package is just outdated, or it is in Unsupported. Use the 'flag out of date' link on the package page, or the Mailing List.
REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#15844 - [vi] ex-vi terminal too wide, vi starts in ex mode

Attached to Project: Arch Linux
Opened by Henning Garus (garns) - Friday, 07 August 2009, 12:36 GMT
Last edited by Paul Mattal (paul) - Monday, 15 February 2010, 15:14 GMT
Task TypeBug Report
Category Packages: Core
Status Closed
Assigned ToTobias Kieslich (tobias)
Aaron Griffin (phrakture)
ArchitectureAll
SeverityCritical
PriorityNormal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete
Votes11
  • Pericles (watsonalgas) (2010-01-22)
  • Daniel Yuste Aroca (daniel.yuste.aroca) (2010-01-17)
  • Dieter Plaetinck (Dieter_be) (2010-01-09)
  • Andre Herbst (moormaster) (2010-01-06)
  • Anne Edit (Aedit) (2009-12-07)
  • Stephen E. Baker (TheCycoONE) (2009-12-02)
  • rob (deadbeefcafe) (2009-11-17)
  • Smith Dhumbumroong (zodmaner) (2009-11-14)
  • Mark Merritt (markatto) (2009-11-13)
  • Thomas Caswell (tcaswell) (2009-10-31)
  • Ray (ataraxia) (2009-09-22)
Private No

Details

Description:
On a wide console (greater 160 columns) vi reports 'terminal too wide' and starts in ex mode. This can be changed by adjusting the value of TUBECOLS in config.h, as mentioned in the README. I suppose a value between 200 and 250 should be sufficient for most users.
On a sidenote, the additional files du.patch and exrc.sample are missing in ABS, the patch files from nvi are still present.
Additional info:
vi 050325-1
Steps to reproduce:
Take a terminal with a width greater than 160 chars (check $COLUMNS in bash), run vi.

Terminal Too Wide Vi

Closed by Paul Mattal (paul)
Monday, 15 February 2010, 15:14 GMT
Reason for closing: Fixed
Additional comments about closing: Fixed in 050325-2.

Terminal Too Wide In Sunos

Duplicate tasks of this task (0)