Simple NeoVim plugin for Meson Build system integration
Mesone is a NeoVim plugin that will allow you (easily) to manage your workflow with Meson Build System directly from your favorite editor.
You will be able to perform the setup
of your project simply by pressing a button, as well as compile
it or maybe run your tests.
You will also be able to debug your tests and even your applications, directly from NeoVim thanks to the help of nvim-dap
, or perform the compilation of your code automagically when you save your changes!
So what are you waiting for? Install it and enjoy! ๐
This plugin requires:
fidget.nvim
to show notification messages and execution progress.nvim-dap
for debugging targets and teststelescope
used for UI selectionsplenary
used also for async jobs
Note
You also must have meson
installed on your machine, please follow this guide
You can use your preferred package manager, the following example is based on lazy.nvim
:
{
'marc0x71/mesone.nvim',
lazy = false,
opts = {
build_folder = "build",
build_type = "debugoptimized",
dap_adapter = "gdb",
show_command_logs = false,
auto_compile = true
},
dependencies = {
"j-hui/fidget.nvim",
"mfussenegger/nvim-dap",
"nvim-telescope/telescope.nvim",
"nvim-lua/plenary.nvim",
},
keys = {
{ '<leader>mi', '<cmd>Mesone init<cr>', desc = "Initialize Mesone" },
{ '<leader>ms', '<cmd>Mesone setup<cr>', desc = "Initialize Meson project" },
{ '<leader>mc', '<cmd>Mesone compile<cr>', desc = "Compile project" },
{ '<leader>mt', '<cmd>Mesone test<cr>', desc = "Show tests" },
{ '<leader>mr', '<cmd>Mesone run<cr>', desc = "Run target" },
{ '<leader>md', '<cmd>Mesone debug<cr>', desc = "Debug target" },
{ '<leader>ml', '<cmd>Mesone log<cr>', desc = "Show last log" },
{ '<leader>mC', '<cmd>Mesone clean<cr>', desc = "Clean" },
{ '<leader>mS', '<cmd>Mesone setting<cr>', desc = "Project settings" },
}
},
Note
Mesone
must be configured disabling lazy if you want auto-commands works at startup without using lua require('mesone')
Mesone
comes with the following default configuration:
{
-- Path used to compile
build_folder = "build",
-- Default build type is 'debug', but can be: plain, debug,
-- debugoptimized, release, minsize, custom
build_type = "debug",
-- The dap adapter used for debugging
dap_adapter = "gdb",
-- Show always meson log window
show_command_logs = false,
-- Automatically compile project if a source file has been changed
auto_compile = false
}
You can overwrite using setup
function or via opts
if you are using lazy.nvim
:
You can execute Mesone in command-mode
writing :Mesone <action>
Actions | Description |
---|---|
init | Initialize project. build.meson must be present in he current folder. This command is executed automatically on current folder change |
setup | Execute meson setup command to configure the project |
compile | Execute meson compile command to build the project |
log | Show last meson execution log |
test | Show all test cases found (show next paragraph for available shortcuts) |
run | Run target |
debug | Run target in debug (using DAP) |
clean | Clean meson project |
setting | Change project settings |
The Mesone plugin will help you to compose the command via the auto-completion ๐
Using Mesone
you can easily execute test, the following keyboard shortcut are available:
r
- execute selected testd
- debug selected testl
- show last log of selected test<CR>
- go to the source code of selected testq
or<ESC>
- close the testcases window
In the test source code a sign will appear, in the definition, which will indicate the status of the last execution
Currently only for the following test framework is supported the "go-to" feature and test signs:
If this plugin isn't working, feel free to make an issue or a pull request.