forked from jubnzv/mdeval.nvim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mdeval.txt
146 lines (111 loc) · 5.03 KB
/
mdeval.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
*mdeval.txt*
CONTENTS *mdeval-contents*
Introduction |mdeval-introduction|
Installation |mdeval-installation|
Usage |mdeval-usage|
Configuration |mdeval-configuration|
Note: Type |gO| to show the outline of contents.
==============================================================================
INTRODUCTION *mdeval-introduction*
This plugin is inspired by org-mode's evaluating code blocks feature and tries
to implement its basic functionality inside Neovim.
==============================================================================
INSTALLATION *mdeval-installation*
------------------------------------------------------------------------------
Via Plugin Manager~
Take [vim-plug](https://github.com/junegunn/vim-plug) for example:
>
Plug 'sainnhe/mdeval'
<
You should also enable syntax highlighting inside code blocks in markdown
using the built-in functionality. Please define a list of markdown fenced
languages in your configuration file:
>
let g:markdown_fenced_languages = ['python', 'cpp']
<
==============================================================================
USAGE *mdeval-usage*
------------------------------------------------------------------------------
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.
==============================================================================
CONFIGURATION *mdeval-configuration*
You can configure *mdeval.nvim* by running `mdeval.setup` function.
Here is a complete list of the available configuration options.
------------------------------------------------------------------------------
*require_confirmation*
require_confirmation~
If set to `true`, the plugin will ask for confirmation each time before
evaluating the code block.
Available values: `false`, `true`
Default value: `true`
------------------------------------------------------------------------------
*allowed_file_types*
allowed_file_types~
A list of language codes, for which this plugin will not ask for the
confirmation before evaluation.
Default value: `{}`
E.g.
>
allowed_file_types={'python', 'cpp'}
<
------------------------------------------------------------------------------
*tmp_build_dir*
tmp_build_dir~
The path to the directory that will be used to store temporary source files
and compiled artifacts.
Default value: `/tmp/mdeval/`
------------------------------------------------------------------------------
*exec_timeout*
exec_timeout~
Timeout for execution of the code block in seconds. If set -1, the timeout
will be disabled.
Default value: `*-1*`
------------------------------------------------------------------------------
*results_label*
results_label~
The string inserted before the code evaluation output.
Default value: `*Results:*`
------------------------------------------------------------------------------
*eval_options*
eval_options~
A table with evaluation options for the code blocks for different languages.
Supported table keys:
- `command`
A command to run the interpreter or compiler.
- `language_code`
A code of the language in the markdown code block.
- `exec_type`
Supported values: "compiled" and "interpreted".
- `extension`
File extension for the temporary files generated by the plugin. Some
languages require the correct extension to compile the file.
- `default_header`
The lines of code that will be added at the beginning of each code block
before execution. For example, you can use this to add some imports.
Example configuration:
>
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"},
language_code = "racket",
exec_type = "interpreted",
extension = "rkt",
},
}
<
------------------------------------------------------------------------------
==============================================================================
vim:tw=78:nosta:noet:ts=8:sts=0:ft=help:et:sw=4:fen:fdm=marker:fmr={{{,}}}: