Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time
October 31, 2022 06:26
July 24, 2021 14:30
October 31, 2022 06:23
June 13, 2021 12:50
June 13, 2021 12:50
October 30, 2022 07:51
June 13, 2021 12:50
October 31, 2022 06:23
June 13, 2021 12:50


This plugin allows you evaluate code blocks inside markdown, vimwiki, orgmode.nvim and norg documents.

It attempts to implement the basic functionality of org-mode's evaluating code blocks feature inside Neovim.



This plugin requires Neovim version 0.5+.

It works on Linux, MacOS and Windows (through WSL).

MacOS users should make sure that they have coreutils package installed:

brew install coreutils

Windows users should have installed WSL with compilers/interpreters they want use.


Install it with your plugin manager.

Then add the following line in your init.lua:

require 'mdeval'.setup()

You should also enable syntax highlighting inside code blocks for your languages using the built-in functionality:

vim.g.markdown_fenced_languages = {'python', 'cpp'}


To use this plugin, you should move cursor inside a fenced code block with language identifier and execute the :MdEval command. mdeval.nvim will capture the results of the code block execution and inserts them in the markdown file, right after the code block.


You can configure mdeval.nvim by running the mdeval.setup function.

Here is an example:

require 'mdeval'.setup({
  -- Don't ask before executing code blocks
  -- Change code blocks evaluation options.
  eval_options = {
    -- Set custom configuration for C++
    cpp = {
      command = {"clang++", "-std=c++20", "-O0"},
      default_header = [[
    #include <iostream>
    #include <vector>
    using namespace std;
    -- Add new configuration for Racket
    racket = {
      command = {"racket"},        -- Command to run interpreter
      language_code = "racket",    -- Markdown language code
      exec_type = "interpreted",   -- compiled or interpreted
      extension = "rkt",           -- File extension for temporary files

By default, the plugin will ask your confirmation before evaluating code. This makes sense, because code evaluation is potentially harm operation. You can disable this feature setting require_confirmation option to false, or allow to execute code blocks without confirmation only for some languages, using allowed_file_types option, for example: allowed_file_types={'rust', 'haskell'}.

Probably, it will be a good idea to define keybindings to call :MdEval. This plugin doesn't add default keybindings, but you can do this in your configuration file, for example:

vim.api.nvim_set_keymap('n', '<leader>c',
                        "<cmd>lua require 'mdeval'.eval_code_block()<CR>",
                        {silent = true, noremap = true})

See the complete list of options in the documentation.

See also

  • Sniprun – A similar plugin written in Rust with much more features.


No releases published


No packages published