vim matlab ide,vim-matlab: vim-matlab 是 neovim 的 MATLAB 插件,它是 Vim 用户的 MATLAB 默认编辑器,用户可以通过 VIM 远程操作 M...

vim-matlab

An alternative to Matlab's default editor for Vim users.

FAQ

How do I run code cells (%% blocks)?

In Normal mode, press or . 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.

67ca8c4d1fa1d56c54ff6216cda10c1b.png

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

This 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 (c) tells the server to send SIGINT to Matlab, canceling current operation.

:MatlabCliRunSelection executes the highlighted Matlab code.

:MatlabCliRunCell executes 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.

:MatlabLaunchServer launches 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.

d1886314e97222baf63f64dfbda40ebb.png

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:

:UpdateRemotePlugins

Optional 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.snippets file.

Install pexpect for improved interactivity with the MATLAB console (e.g. tab completion):

pip3 install pexpect

Configuration

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 enabled

Use 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 split

Use 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 split

Development

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.

Recommended Plugins

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值