Skip to content

mpas/marp-nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🔌 Marp.nvim

A neovim plugin for Marp.

✨ Features

  • start/stop the Marp server
  • toggle the Marp server (start/stop)
  • see if Marp server is running
  • browser window opens when Marp is running and ready

⚡️ Requirements

  • Marp CLI installed and available in your path

📦 Installation

Install the plugin with your preferred package manager:

Packer:

  use({
    "mpas/marp-nvim",
  }),

Lazy:

  {
    "mpas/marp-nvim",
  },

With a specific configuration:

  {
    "mpas/marp-nvim",
    config = function()
      require("marp").setup({
        port = 8080,
        wait_for_response_timeout = 30,
        wait_for_response_delay = 1,
      })
    end,
  },

⚙️ Configuration

The following defaults are provided:

{
  port = 8080, -- the port on which the Marp server should listen
  wait_for_response_timeout = 30, -- how long to wait for a response from the server before giving up
  wait_for_response_delay = 1, -- how long to wait between attempts to connect to the server
}

In the above example, the Marp server will be started on port 8080, and the plugin will wait for up to 30 seconds for a response from the server before giving up. It will try to connect to the server every second.

⌨️ Keybindings

This plugin does not set any keybindings by default. You can set them yourself like this:

vim.keymap.set("n", "<leader>MT", "<cmd>MarpToggle<cr>", { noremap = true, silent = true })
vim.keymap.set("n", "<leader>MS", "<cmd>MarpStatus<cr>", { noremap = true, silent = true })
...

The following commands are available:

  • :MarpStart - start the Marp server
  • :MarpStop - stop the Marp server
  • :MarpToggle - toggle the Marp server (start/stop)
  • :MarpStatus - see if Marp server is running

🎨 Theming

Marp CLI can recognize custom themes that are in the themes/ directory in your project's root directory. For example, if you open neovim in the presentations directory, created a directory inside of presentations called themes and place the theme CSS files inside of this directory. They should be automatically loaded by Marp and applied to presentations with the theme specified.

💡Inspiration

This plugin is inspired by aca/marp.nvim!