MATLAB: Am I unable to use the Vim external editor in MATLAB on a Unix system

editorexternalMATLABunixvivim

Why am I unable to use the Vim external editor in MATLAB on a Unix system?

Best Answer

This enhancement has been incorporated in Release 2006b (R2006b). For previous product releases, read below for any possible workarounds:
The ability to use the Vim external editor is not available in MATLAB. Currently, to work around this issue, the "edit.m" file needs to be modified.
There is a special case for the Vi external editor, which is similar to the Vim external editor, in the "edit.m" file because Vi needs to open in a terminal window:
if strcmp(editor,'vi') == 1
editor = 'xterm -e vi';
end
Since Vim has the same restriction, do the following in order to use the Vim editor:
1) Type the following at the MATLAB prompt:
edit edit
2) Change the relevant lines in "edit.m" to the following:
if strncmp(editor,'vi',2) == 1
editor = ['xterm -e ' editor];
end
This will enable you to use both Vi and Vim.