

Add the above definitions to ~/.bash_profile (or wherever) to make them permanent. 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. To save typing every time you use vi in a wide terminal, the following aliases can be set up. For example: # stty columns 200Īnd things look normal again. No problem, just change back the setting. Text will wrap at 160 characters, leaving the right side of the terminal window unused, and generally making a mess. However, this will leave you with a terminal 160 columns wide, even if your terminal window (eg. One workaround is to adjust the terminal “columns” setting before the edit, 163 being the maximum that vi seems willing to accept. But on Solaris, vi will fail if your terminal is more than about 160 characters wide: On a large screen it could easily be 200 characters or more. The width of a virtual terminal depends on how much big you make the window. In a modern windowing environment, the terminal has been replaced by virtual terminal apps – xterm, lterm, Terminal and many others.

Vi was originally written for screens (terminals) which were 80 characters wide. This article offers a workaround for the annoying “Terminal too wide” problem encountered by vi users on Solaris. It offers a good balance between usability and ubiquity. While other editors are available (ed, emacs, vim, etc), vi is quick and convenient. It is available as standard on almost every unix/linux system. One of the best ways of doing that is with the vi editor. Use the Unix command line and sooner or later, you will be editing text files. Workaround for vi “Terminal too wide” problem
