0

I was trying to append some text to multiple lines in vi on a RHEL 6 system, however I could not get it to work. I press Control + V to get into visual block mode, select the lines I need, but when I press capital A, instead of going into insert mode, it goes back into command mode. I then created two droplets on digital ocean to test this, one CentOS 7 and one Ubuntu, and to my surprise, this worked fine on Ubuntu, but did not on CentOS. So why is that? Is there some option I need to add to my vimrc file or are these functions remapped somehow on RHEL/CentOS? Searching the web did not help very much.

2
  • 2
    Can you add the versions and vimrcs of the systems? Are you starting the program as vi or vim? Can you check the value of compatible? – D. Ben Knoble May 24 '19 at 11:29
  • Check your version, you need +visualextra (which is now always included with the latest Vim versions, but I believe a tiny Vim does not enable this by default) – Christian Brabandt May 24 '19 at 11:29
0

It appears to be a result of inconsiderate overcustomization by RedHat somewhere in /usr/share/vim .

The following workaround

vim -u NONE [file ...]

suppresses all initializations (replace NONE by the path to your own .vimrc to do your own initialization). After this, block commands work fine for me. Consider setting a shell alias if you routinely need this. See vim's man page for details.

2
  • 1
    Welcome to Vi and Vim! If you can share what specific changes are in /usr/share/vim that cause this, it would improve the answer—and possibly illuminate a less nuclear way to solve the problem. – D. Ben Knoble Feb 3 at 16:01
  • Thanks for asking. On one of my CentOS 7 systems, cd /usr/share/vim/vim74 && find . -type f -print | xargs cat | wc -l reveals that there are more than 300000 lines of customization, making this a search for a needle in a haystack.Generally I doubt the value of vendor-supplied customization for the end-user because vendor lock-in reduces the user's ability to confidently use their tools across a wide variety of OSs (speaking from 35 years of professionally using vi/vim as preferred editor) – user3441275 Feb 10 at 10:05

Your Answer

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