ENGLISH | 中文版
-
You can preview the result of every code block in markdown, and the result will be showed in floating window. It does not discrupt your current window layout.
-
If there are mulitple languages in your markdown, you can choose to run one of them. It will select all code blocks using the language, and run them in the order which they appear in the text. Finally, the result will be showed in floating window.
If you use vim-plug
, you can install by following commands:
Plug 'demonlord1997/markdown-org', {'for':'markdown'}
If you use dein
, you can install by following commands:
[[plugins]]
repo = 'demonlord1997/markdown-org'
on_ft = 'markdown'
If you set let g:default_quick_keys=1
in your .vimrc
or init.vim
, you will use default settings.
let g:default_quick_keys = 1
Parameters / Quick keys | Function |
---|---|
Alt+b |
Expand the result of current code block |
Alt+l |
Run all code blocks of a language, and it will popup select box of language |
g:language_path |
Set evnironmental path of languages |
g:org#style#border |
Set the style of border (0, 1, 2, 3, 4, 5), 0: no border |
g:org#style#bordercolor |
Set the color of border |
g:org#style#color |
Set the color of result text |
Border number | Show |
---|---|
border0 | ![]() |
border1 | ![]() |
border2 | ![]() |
border3 | ![]() |
border4 | ![]() |
border5 | ![]() |
If you wish custom parameters and quick keys, you can refer the example:
let g:default_quick_keys = 0
let g:org#style#border = 2
let g:org#style#bordercolor = 'keyword'
let g:org#style#color = 'Identifier'
let g:language_path = {
\ "python":"python",
\ "python3":"python3",
\ "go": "go",
\ "c": "gcc",
\ "cpp": "g++",
\ "c++": "g++",
\ "javascript": "node",
\ }
nnoremap <silent> <M-b> :call org#main#runCodeBlock()<CR>
nnoremap <silent> <M-l> :call org#main#runLanguage()<CR>
-
You need set
let g:default_quick_keys=0
, it will disable default settings. -
g:org#style#border
can be set to 0 - 5. -
g:org#style#bordercolor
andg:org#style#color
can be set different colors. You can choose a color fromkeyword
,Identifier
,Statement
,Comment
,PreProc
,Ignore
,Label
,Conditional
,Exception
, etc. The final effect will depend on your current theme. -
g:language_path
can be used to set different languages' evnironmental path. If your evnironment of the language is ok, default setting will work well. If your evnironment exists some problems, for example, when you input python, you can not enter interactive mode. In this case, you can write your python path intog:language_path
:
let g:language_path = {
\ "python":"/usr/bin/python",
\ "python3":"python3",
\ "go": "go",
\ "c": "gcc",
\ "cpp": "g++",
\ "c++": "g++",
\ "javascript": "node",
\ }
org#main#runCodeBlock
is the function to run code block, andorg#main#runLanguage
is the function to run a language. You can refer befor example to bind you quick keys.
Finally, floating window mainly refers to vim-quickui of Linwei. Thanks the excellent project provided by Linwei.