The vi
command in some configurations (e.g. Solaris) will give the error "Terminal too wide" if launched on a terminal with more than a certain number of columns. One way to fix this is to modify the source code, as detailed in this Arch Linux bug report. If the source code is unavailable or the limit otherwise cannot be modified, a work-around is the following script, to be put in one's .profile
.
VI_COLS=163
vi () {
local original_cols=$(tput cols)
if [ "$original_cols" -gt "$VI_COLS" ]; then
stty columns "$VI_COLS"
"$(which vi)" "$@"