Going to vim from less produces a swag of errors

When I open a file with vim it opens with no errors, but if I open it with less and then type ‘v’ to switch to vim I get a swag of errors such as:

Error detected while processing /usr/share/vim/vim82/filetype.vim:

line 10:

E319: Sorry, the command is not available in this version: let did_load_filetypes = 1

line 13:

E319: Sorry, the command is not available in this version: let s:cpo_save = &cpo

line 47:

Error detected while processing /usr/share/vim/vim82/ftplugin.vim:

line 9:

E319: Sorry, the command is not available in this version: let did_load_ftplugin = 1

I note that redhat have a web-page Upgrading from RHEL 9.7 to 9.8 causes issues with vi/vim - Red Hat Customer Portal

But I cannot see the rest of the details on this page.

Is there any fix for this?

Sorry I should also have said I am running AlmaLinux 9.8 with kernel 5.14.0-687.17.1.el9_8.x86_64; vim-* 8.2.2637.26.el9_8.6; less 590.6.el9 and using xterm-256color

Up to 9.7 the vim-minimal did provide /usr/bin/vi that was a script.
That script did execute vim – if that was installed – or the real vi

In 9.8 the /usr/bin/vi is the real vi
This change related to some security issue.

If less calls “vi” but actually expects “vim”, then that would explain a bit


man less mentions both vi and vim, so it probably should be able to use either.
There is also mention that EDITOR or VISUAL could set the desired editor.

To expand on what jlehtone wrote above.
Assuming you have made sure you have vim installed, If you open a terminal and run export EDITOR=vim and then (in the same terminal) does the less > press v operation, does it still present the errors?
If not, you can set the environment variable EDITOR and optionally VISUAL to vim,

Thanks jlehtone and Bedna, setting EDITOR to vim has done the trick and vim recognises the filetype when opened via less. I have had ‘vi’ as an alias to ‘vim’ for many, many years.

1 Like