CRAG666/code_runner.nvim

markdown

Closed this issue · 3 comments

zmd56 commented

filetype = {
markdown = "MarkdownPreview",
},

zsh:1: command not found: MarkdownPreview

zmd56 commented

Vim script is used to solve this problem perfectly.

vim.api.nvim_exec(
[[
" noremap rr :call CompileRunGcc()
func! CompileRunGccA()
exec "w"
for i in ["c","cpp","python","sh","html","go","lua","rust","r","nix","javascript","java"]
if &filetype == i
exec "RunFile float"
elseif &filetype == 'markdown'
exec "MarkdownPreview"
elseif &filetype == 'tex'
silent! exec "VimtexStop"
silent! exec "VimtexCompile"
endif
endfor
endfunc
]] ,
false
)

Hello,

Have you tried something like:

filetype = {
     markdown = "cd $dir && nvim --headless +MarkdownPreview qa",
}

...?

Based on my understanding, part of which comes from this question on Reddit, writing it this way should allow you to give code_runner a command similar to the commands used for other languages like Java, Rust, or Go. I haven't tested it yet, so I can't say for sure it will work. If you decide to try it, please let me know what happens!

Good luck!

EDIT: forgot to link to Reddit question, sorry!

the problem occurs, because code runner is meant to be used with terminal commands, all commands are executed in a shell