CRAG666 / code_runner.nvim

Neovim plugin.The best code runner you could have, it is like the one in vscode but with super powers, it manages projects like in intellij but without being slow
MIT License
533 stars 38 forks source link

markdown #59

Closed zmd56 closed 10 months ago

zmd56 commented 1 year ago

filetype = { markdown = "MarkdownPreview", },

zsh:1: command not found: MarkdownPreview

zmd56 commented 1 year ago

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 )

dorrajmachai commented 1 year ago

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!

CRAG666 commented 1 year ago

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