I\'m using linux and gvim/vim as external editor for matlab.
Using matlab editor you can run a file by pressing F5. I\'m trying to reproduce this with gvim-gtk(offic
I do this on Windows using Autohotkey (which I also use to swap the Esc and Caps Lock keys). Autohotkey can be installed without admin rights, useful on corporate machines.
Using the set up described below:
Cell mode could be achieved through a slightly different mapping for CTRL-E (see below). (The Autohotkey script will execute in Matlab whatever is put into the clipboard by the CTRL-E mapping in gvim.) You can then set up Matlab and gvim side by side or on different screens, and it's a great way to work.
In my Autohotkey file, I use this mapping:
^l::
; execute line or current selection in Matlab
IfWinActive, ahk_class Vim
{
; CTRL-E is mapped to a Vim shortcut to yank the text you want
Send, ^e
WinActivate, ahk_class SunAwtFrame
Send, ^0^v{Enter}
WinActivate, ahk_class ahk_class Vim
} else if WinActive, ahk_class SunAwtFrame
{
Send, ^0^v{Enter}
}
Return
Then, in vim I use the following shortcut:
:nnoremap ^E Y
:vnoremap ^R y
Note: ^E is a a literal CTRL-E entered in vim by pressing CTRL-V CTRL-E or CTRL-Q CTRL-E.
Note 2: SunAwtFrame is what Windows calls the Matlab window on my machine. You can use Windowspy (which comes bundled with Autohotkey) to confirm that it is called the same on your machine.