I am using Matlab R2013b. I am using the GUI, with the Command Windows and Editor in split screen. In the Matlab preferences > Editor/Debugger > Editor. There is an option to set a custom editor instead of the Matlab editor. I set it to my local editor /usr/bin/vim
, but then I am not able to open files at all anymore. Is there a possibility to use the vim
editor in split screen mode?
I am aware of !vim file.m
, but this is not the solution I am looking for, as this only works satisfactory in -nodisplay
mode. I rather want to keep the split screen mode.
Vim is a text editor for Unix that comes with Linux, BSD, and macOS. It is known to be fast and powerful, partly because it is a small program that can run in a terminal (although it has a graphical interface). It is mainly because it can be managed entirely without menus or a mouse with a keyboard.
Vim editor is among the best editors used in the command-line interface to open, edit and save files, vim editor can be used for editing simple text files as well as different code files of different languages. Vim is the updated version of Vi editor that's why vim is abbreviated as “Vi improved”.
You simply type vim into the terminal to open it and start a new file. You can pass a filename as an option and it will open that file, e.g. vim main. c . You can open multiple files by passing multiple file arguments.
If you're on a Linux system right now, open up a terminal and type vim filename. Enter insert mode and type a bit (or copy some of the text from this article into Vim) and then hit Escape to start practicing movement around the file. Once you feel you're getting the hang of it, it's time to try some editing.
I did not find a solution that is 100% satisfying, but for now I am using tmux
as an intermediate solution. It allows two use a split screen for two terminals. In one of those I can open matlab -nodesktop
in terminal mode, and in the other one vim
. It is possible to quickly switch between both split screens.
You can use functionality of GUI Matlab by typing things as commandhistory
, who
et cetera.
Instead of using something such as screen
or tmux
, you can use vim's :term
command (needs to be compiled with the +terminal
feature). This way you can open your file on a window and run :term matlab -nodesktop
to open another window with the Matlab shell (if you want a vertical window, run :vert term matlab -nodesktop
).
Also, you might want to have a look at vim-slime.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With