Ⅰ. 插件描述
VimLab is a vim plugin which replicates MATLAB's support for code sections.Ⅱ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'dajero/vimlab'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'dajero/vimlab'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'dajero/vimlab'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/dajero/vimlab
Ⅳ. 文档说明
# VimLab
VimLab replicates MATLAB's support for code sections in Vim. It uses
tmux to maintain a MATLAB session from within vim.
Requirements
VimLab relies on tmux and screen.vim which are used to set up and communicate
with a MATLAB session. It expects the matlab command to be on your $PATH.
Code analysis, similar to that offered by MATLAB's editor, is provided by the
excellent Syntastic plugin. If mlint is on your path as well, Syntastic will
automatically analyze your MATLAB code when it's saved.
tmux
VimLab requires vim to run inside a tmux session. Linux users may find a tmux
package is provided by their favorite distribution. For OS X users, I recommend
installing tmux using homebrew.
For a well written introduction to tmux, please take a look at the book ["tmux:
Productive Mouse-Free Development"](http://pragprog.com/book/bhtmux/tmux) by
Brian P. Hogan.
screen.vim
VimLab uses Screen.vim to manage a MATLAB
session within tmux.
Syntastic (Optional)
Install Syntastic if you wish to have
your MATLAB code automatically analyzed when it is saved.
Installation
I recommend installing VimLab using Vundle.
Add the following lines to your .vimrc file:
Bundle "ervandew/screen"
Bundle "dajero/VimLab"
"Optional, if you desire automatic code analysis
Bundle "scrooloose/syntastic"Next, either quit and relaunch vim or source .vimrc from within your current
vim session. Finally, issue the :BundleInstall command to vim to install
VimLab and its dependencies.
Usage
VimLab automatically creates a few key mappings when you enter a MATLAB buffer.
These mappings are prefixed by your leader, which defauls to \. If you set
your mapleader to a different character, please mentally substitute the
backslash by the mapleader of your choice.
\mmstarts matlab\mssends the current section to MATLAB\mdopen the documentation for the current word\mhshow help for the current word\mvshow the variable the cursor is ongngo to the next sectiongNgo to the previous section
VimLab also provides two commands to quickly open the documentation or help for
a function:
:MATDoc my-functionopens the documentation for my-function:MATHelp my-functionshows help for my-function
Configuration
By default, VimLab splits your tmux window horizontally to create a pane for
MATLAB. If instead, you prefer the panes to be arranged vertically, set the
varible g:matlab_vimlab_vertical to 1, e.g. add the following line to your.vimrc:
let g:matlab_vimlab_vertical=1