Open a matlab instance in the background, and send it commands from Neovim.
Install using your favorite package manager.
use 'BalderHolst/matlab.nvim'
Make sure to have Matlab installed.
You can now configure and enable the plugin by calling the setup()
function.
This is the default configuration:
require("matlab").setup({
-- Path to the matlab executable. If `matlab` is already in your $PATH, just leave this.
matlab_path = "matlab",
-- How to open the matlab window. There are 4 options for now:
-- split
-- splitdown
-- vsplit
-- vsplitright
open_window = require("matlab.openers").vsplit,
-- Display the matlab splash screen on startup
splash = true,
-- A list of any other flags you want to add, when launching matlab
matlab_flags = {},
})
Evaluate a string as a matlab command.
MatlabEval <expr>
require("matlab").evaluate("<matlab cmd>")
Evaluate currently opened matlab script.
MatlabEvalFile
require("matlab").evaluate_current_file()
Evaluate a matlab script file.
require("matlab").evaluate_file(path)
Evaluate the block under the cursor. Matlab blocks are separated by comments beginning with %%
.
MatlabEvalBlock
require("matlab").evaluate_block()
Evaluate currently highlighted text.
MatlabEvalVisual
require("matlab").evaluate_visual()
Evaluate a table of strings as matlab commands.
require("matlab").evaluate_lines(lines)
Open documentation of the function under cursor.
require("matlab").open_documentation_at_cursor()
Open documentation of an arbitrary function.
MatlabDoc <matlab-function>
Close window and end matlab process.
MatlabClose
require("matlab").close()
Open the matlab "workspace" (variable explorer).
MatlabWorkspace
require("matlab").open_workspace()
- Matlab output inserted as comments under command