Ⅰ. 插件描述
Neovim plugin for MATLABⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'daeyun/vim-matlab-say-im-great'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'daeyun/vim-matlab-say-im-great'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'daeyun/vim-matlab-say-im-great'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/daeyun/vim-matlab
Ⅳ. 文档说明
vim-matlab
An alternative to Matlab's default editor for Vim users.
FAQ
How do I run code cells (%% blocks)?
In Normal mode, press <Enter> or <C-m>. The editor will parse the code in the current cell and send to MATLAB for evaluation.
What if I need MATLAB's GUI features?
Most MATLAB windows can be launched through commands; even in -nodisplay mode. For example, workspace command opens the Workspace browser.

If you need to access the debugger, use edit to open the default GUI editor.
Error: E492: Not an editor command
If this the first time you're installing a Python plugin written for Neovim, you should install python-client and run :UpdateRemotePlugins.
The recommended way to install this plugin is to use the plugin manager vim-plug and add this to your .vimrc or init.vim:
function! DoRemote(arg)
UpdateRemotePlugins
endfunction
Plug 'daeyun/vim-matlab', { 'do': function('DoRemote') }Usage
vim-matlab works by remotely controlling a CLI Matlab instance (launched by vim-matlab-server.py).
Run
./scripts/vim-matlab-server.pyThis will start a Matlab REPL and redirect commands received from Vim to Matlab. When Matlab crashes (e.g. segfault during MEX development), it will launch another process.
Then open Vim in another terminal and start editing .m files.
Alternatively, launch a server instance from Vim using :MatlabLaunchServer. The server will be launched either in a Neovim terminal buffer or a tmux split (see g:matlab_server_launcher).
:MatlabCliCancel(<leader>c) tells the server to send SIGINT to Matlab, canceling current operation.:MatlabCliRunSelectionexecutes the highlighted Matlab code.:MatlabCliRunCellexecutes code in the current cell — i.e.%%blocks. Similar to Ctrl-Enter in the Matlab editor.:MatlabCliOpenInEditor(,e) opens current buffer in a Matlab editor window. e.g. to access the debugger.:MatlabCliHelp(,h) prints help message for the word under the cursor.:MatlabNormalModeCreateCell(C-l) inserts a cell marker above the current line.:MatlabVisualModeCreateCell(C-l) inserts cell markers above and below the visual selection.:MatlabInsertModeCreateCell(C-l) inserts a cell marker at the beginning of the current line.:MatlabLaunchServerlaunches a server instance in a Vim or tmux split.
See this file for a list of available commands, and vim-matlab.vim for default key bindings.

Installation
- Install the python3 client for Neovim:
pip3 install neovim- Add to
.vimrc(or~/.config/nvim/init.vim). e.g. using vim-plug:
Plug 'daeyun/vim-matlab'- Register the plugin inside Neovim:
:UpdateRemotePluginsOptional steps (recommended)
- Install a snippet engine such as SirVer/ultisnips or vim-snipmate to use the included snippets. We also recommend installing vim-snippets. We welcome any contributions to extend the
matlab.snippetsfile. - Install pexpect for improved interactivity with the MATLAB console (e.g. tab completion):
pip3 install pexpectConfiguration
Use g:matlab_auto_mappings to control whether the plugin automatically generates key mappings (default = 1).
let g:matlab_auto_mappings = 0 "automatic mappings disabled
let g:matlab_auto_mappings = 1 "automatic mappings enabledUse g:matlab_server_launcher to control whether :MatlabLaunchServer uses a Vim or tmux split (default = 'vim').
let g:matlab_server_launcher = 'vim' "launch the server in a Neovim terminal buffer
let g:matlab_server_launcher = 'tmux' "launch the server in a tmux splitUse g:matlab_server_split to control whether :MatlabLaunchServer uses a vertical or horizontal split (default = 'vertical').
let g:matlab_server_split = 'vertical' "launch the server in a vertical split
let g:matlab_server_split = 'horizontal' "launch the server in a horizontal splitDevelopment
Set up a symlink so that the plugin directory points to your repository.
git clone git@github.com:daeyun/vim-matlab.git
rm -r ~/.vim/plugged/vim-matlab
ln -nsf $(pwd)/vim-matlab ~/.vim/plugged/After changing the code, run scripts/reload-vim.sh (optionally pass in a file to open) to reload.
For testing, install pytest and run scripts/run-tests.sh.