|mcol 284e664b0b||1 year ago|
|ftplugin||1 year ago|
|indent||1 year ago|
|syntax||1 year ago|
|.gitignore||1 year ago|
|LICENSE||1 year ago|
|README.md||1 year ago|
|op.m||1 year ago|
This is a collection of code sourced from a few places, modified, expanded and put in one place for my own use.
It is my attempt at making vim and matlab work together as painlessly as possible. Some things are still a work in progress.
Most of the cool stuff requires vim be run in server mode. To run a vim server that can use all the functions here, including automatic session restoration, open it with:
vim --servername vimlab
To enable session saving and restoration, add this to your .vimrc:
let g:vimlab_session = "~/.cache/vim/sessions/matlab-session.vim"
changing the path to where you keep vim sessions, and open vim with:
vim --servername vimlab -S $HOME/.cache/vim/sessions/matlab-session.vim
You can change the default binding to save and exit (which is XA in normal mode):
nnoremap XA <Plug>VimlabEndSession
Hitting enter when the cursor is on a word will either:
This requires the included op.m function be on matlab's path.
The default bindings are to open the word in the vim server and to open it in a new window, if the word points to an .m file. The vim server name and terminal can be changed from the default "vimlab" and urxvtc with:
let g:vimlab_server = "vimserver" let G:vimlab_terminal = "xterm"
|\a||add a debug marker at the current line (this saves the buffer)|
|\r||remove the marker at the current line|
|\t||toggle the marker at the current line|
|\s or F10||step to the next line in debug mode|
|\c or F5||continue running the code|
|\e||toggle stopping to debug at errors|
|\x||exit debug mode|
|\f||flush all markers|
|\ds||list the debug stack|
|\du||go up the stack|
|\dd||go down the stack|
These keybindings assume the leader key is the default backslash.
This plugin contains Thomas Ibbotson's mlint.vim. If mlint isn't on your system's $PATH, you can set the path by putting this in your .vimrc:
let g:mlint_path_to_mlint = "$HOME/applications/MATLAB/R2018b/bin/glnxa64/mlint"
This will automatically run mlint when the cursor is idle, but this can be disabled by setting this variable to anything:
let g:mlint_hover = 1
Auto linting can be toggled with the ToggleLine command, which is bound by default to
|\ll||run mlint manually|
||||toggle automatic mlint aucommands|
|\lm||see the message from the current line|
|\lo||view an outline of all messages|
|\ln||jump to the next message|
|\lp||jump to the previous message|
For, if, and switch statements will automatically get an end placed below them on the next empty line. So if there is a code block on the next line, the statement will surround it. To disable this altogether, set the variable g:vimlab_no_autoend
For matchit word pairing of things such as if/end, allowing the use of % to navigate these pairs, add the following to your .vimrc: