Skip to content

Simple NeoVim plugin for Meson Build system integration

License

Notifications You must be signed in to change notification settings

marc0x71/mesone.nvim

Repository files navigation

mesone.nvim

Tests

Simple NeoVim plugin for Meson Build system integration

output

Description

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! ๐Ÿ˜€

Requirements

This plugin requires:

Note

You also must have meson installed on your machine, please follow this guide

Installation

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')

Configuration

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:

Available Commands

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 ๐Ÿ˜Š

Tests

Using Mesone you can easily execute test, the following keyboard shortcut are available:

  • r - execute selected test
  • d - debug selected test
  • l - show last log of selected test
  • <CR> - go to the source code of selected test
  • q 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

test_signs

Currently only for the following test framework is supported the "go-to" feature and test signs:

Troubleshooting

If this plugin isn't working, feel free to make an issue or a pull request.

About

Simple NeoVim plugin for Meson Build system integration

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published