In a specific context, typing :vsplit does nothing.

Typing :split still splits the screen horizontally. And if I open a new file e.g. vi foo.txt then :vsplit works.

EDIT: steps to reproduce

  1. Type /bin/vi on the command-line
  2. Type :vsplit. For me, nothing happens.

(See answer below for more)


I am running this script:

> cat fix.sh
for D in 2*; do
  vi ${D}/node_*;
  cp ${D}/node_input.txt samples.txt${I}
  cat ${D}/node_output.txt >> futen_output.txt
  I=$((${I} + 1))

On this machine:

> uname -a
Linux h3.karst.uits.iu.edu 2.6.32-696.1.1.el6.x86_64 #1 SMP Tue Mar 21 12:19:18 EDT 2017 x86_64 x86_64 x86_64 GNU/Linux

In case it helps, here's my .vimrc:

set ai
set background=dark
set expandtab
set list
set listchars=trail:.
set nowrap
set nu
set ruler
set shiftwidth=2
set tabstop=2
set nohlsearch
syntax on

EDIT: more details about /bin/vi

After typing /bin/vi, then typing :version

VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Dec 12 2016 09:48:07)
Included patches: 1-207, 209-629
Modified by <bugzilla@redhat.com>
Compiled by <bugzilla@redhat.com>
Small version without GUI.  Features included (+) or not (-):
+acl             -cmdline_compl   -diff            -find_in_path    -keymap          -modify_fname    +multi_byte      -python3         -statusline      -title           -wildmenu
-arabic          +cmdline_hist    -digraphs        -float           -langmap         -mouse           -multi_lang      -quickfix        -sun_workshop    -toolbar         +windows
-autocmd         -cmdline_info    -dnd             -folding         -libcall         -mouse_dec       -mzscheme        -reltime         -syntax          -user_commands   +writebackup
-balloon_eval    -comments        -ebcdic          -footer          -linebreak       -mouse_gpm       -netbeans_intg   -rightleft       -tag_binary      -vertsplit       -X11
-browse          -conceal         -emacs_tags      +fork()          -lispindent      -mouse_jsbterm   -path_extra      -ruby            -tag_old_static  -virtualedit     -xfontset
+builtin_terms   -cryptv          -eval            -gettext         -listcmds        -mouse_netterm   -perl            -scrollbind      -tag_any_white   +visual          -xim
-byte_offset     -cscope          -ex_extra        -hangul_input    -localmap        -mouse_sgr       -persistent_undo -signs           -tcl             -visualextra     -xsmp
-cindent         -cursorbind      -extra_search    +iconv           -lua             -mouse_sysmouse  -printer         -smartindent     +terminfo        -viminfo         -xterm_clipboard
-clientserver    -cursorshape     -farsi           -insert_expand   -menu            -mouse_urxvt     -profile         -sniff           -termresponse    -vreplace        -xterm_save
-clipboard       -dialog          -file_in_path    +jumplist        -mksession       -mouse_xterm     -python          -startuptime     -textobjects     +wildignore      -xpm
   system vimrc file: "/etc/virc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  fall-back for $VIM: "/etc"
 f-b for $VIMRUNTIME: "/usr/share/vim/vim74"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H     -O2 -g -pipe -Wall -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -U_FORTI
Linking: gcc   -L/usr/local/lib -Wl,--as-needed -o vim        -lm  -lselinux -ltinfo -lacl -lattr

After typing /bin/vi, then :vsplit, then :messages:

Messages maintainer: Bram Moolenaar <Bram@vim.org>
  • To be running on Linux 2.6.32 that must be quite an old version of Vim. But moreover, since it is such an old Linux and on a university, it is likely to be heavily customized. Therefore (1) check if this does happen when starting with vim -u NONE --noplugin and (2) have a look for customised scripts in the list printed by :scriptnames
    – grochmal
    May 16 '17 at 1:25
  • 1
    @grochmal it seems to be RHEL 6 (or derivatives) form the el6 in the version string, and RHEL 6.8 has Vim 7.4 (patches 1-207,209-629), so not very old. (That's newer than Ubuntu 14.04's 7.4, patches 1-52.)
    – muru
    May 16 '17 at 5:19
  • 5
    your question is confusing. :split always splits horizontally, and :vsplit vertically. I am not sure I understand what exactly your problem is. Please give precise steps in Vim that reproduce the problem. May 16 '17 at 5:48
  • Thanks all for the comments. @grochmal (1) VIM 7.4.629 (2) :scriptnames prints nothing. @ChristianBrabandt my problem is that I type ":vsplit" and nothing happens. It does not split the screen vertically. Adding steps to reproduce above. May 16 '17 at 16:07
  • 4
    -vertsplit -- that version of Vim has been compiled without that feature.
    – Antony
    May 16 '17 at 16:47

The problem is the line in my script that calls vi

  vi ${D}/node_*;

"vi" points to /bin/vi, and for some reason /bin/vi ignores the :vsplit command. I'll email the local sysadmin.

EDIT: @Antony points out, /bin/vi was compiled without the vertsplit option.

The fix is easy, change vi to vim.

  • Vi is acually Vim run in compability mode, the original editor Vi didn't have vsplit. That's why vsplit don't work Sep 14 '17 at 20:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.