Giter Site home page Giter Site logo

vim-medieval's Introduction

vim-medieval

Evaluate Markdown code blocks within Vim.

asciicast

Description

Medieval allows you to evaluate code blocks in Markdown buffers of the following form:

```bash
echo "Hello world!"
```

By placing your cursor anywhere in the code block above and running :EvalBlock, Medieval will print the result of evaluating the block (in this case, it will echo "Hello world!")

You can send the output of evaluation into another code block, allowing you to do a primitive style of literate programming. You can accomplish this by adding a "target" parameter to your code block and creating a second code block with a "name" parameter. The output of the evaluation of your code block will be redirected to the targeted block. For example:

<!-- target: squares -->
```python
print([x*x for x in range(5)])
```

<!-- name: squares -->
```
```

If you run :EvalBlock in the first code block, the second block will become

<!-- name: squares -->
```
[0, 1, 4, 9, 16]
```

Medieval can do a lot more. Read :h medieval for the full documentation.

Create a mapping

Medieval does not create any mappings by default, but you can easily create one yourself by adding the following to the file ~/.vim/after/ftplugin/markdown.vim (create it if it does not yet exist):

nmap <buffer> Z! <Plug>(medieval-eval)

Limitations

For now, Medieval only works in Markdown buffers. If you'd like to see support added for other file types, please see the Contributing section.

Contributing

Please feel free to contribute changes or bug fixes. You can send patches to [email protected] or submit a pull request on GitHub.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.