Nvim plugin
m2.nvim makes Neovim feel at home with .m2 files and lets you run code from the buffer.
-- lazy.nvim
{
"AlexanderGolys/m2.nvim",
dependencies = { "nvim-treesitter/nvim-treesitter" },
opts = {},
}
Neovim 0.11+.
What you get
- filetype detection, comments, indentation,
:makerunning the file through M2 with errors in quickfix - folding and indentation from the tree-sitter grammar
- an M2 terminal next to your code, and keys to send code to it
The language server isn’t started by the plugin; it’s a few lines, see here.
Running code
| Keys | |
|---|---|
<leader>mo | open M2 in a split |
<leader>mc | send the cell under the cursor (or the selection) |
<leader>ml | send the current line |
<leader>mt | hide / show the terminal (M2 keeps running) |
<leader>mq | close it |
A cell is just the top-level expression under the cursor, so no -- %% markers. A
multi-line call goes as one piece.
Keys can be changed with opts.term.keys, or switched off with term = false.