Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use vim as editor in Matlab GUI

Tags:

vim

editor

matlab

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.

like image 913
Bernhard Avatar asked Apr 30 '14 05:04

Bernhard


People also ask

Can you use vim as a text editor?

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.

What is vim editor used for?

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”.

How do I use vim in terminal?

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.

Can you use vim on Linux?

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.


2 Answers

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.

like image 141
Bernhard Avatar answered Sep 22 '22 03:09

Bernhard


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.

like image 23
dccsillag Avatar answered Sep 19 '22 03:09

dccsillag