fix code runner

This commit is contained in:
asep komarudin 2023-03-05 20:11:50 +07:00
parent 418a659142
commit a44ddd6365
2 changed files with 19 additions and 11 deletions

View file

@ -116,5 +116,13 @@ vim.g.pcode_whichkey = {
-- https://github.com/CRAG666/code_runner.nvim -- https://github.com/CRAG666/code_runner.nvim
vim.g.pcode_coderunner = { vim.g.pcode_coderunner = {
java = "cd $dir && javac $fileName && java $fileNameWithoutExt",
python = "python3 -u",
typescript = "deno run",
rust = "cd $dir && rustc $fileName && $dir/$fileNameWithoutExt",
-- cpp="gcc $fileName -lstdc++ -o $fileNameWithoutExt && $fileNameWithoutExt"
cpp = "g++ $fileName -o $fileNameWithoutExt && $dir/$fileNameWithoutExt",
scss = "sass $dir/$fileName $dir/$fileNameWithoutExt.css",
javascript = "node $dir/$fileName", javascript = "node $dir/$fileName",
go = "go run $fileName",
} }

View file

@ -3,26 +3,26 @@ if not status_ok then
return return
end end
local filetype = { local rfile = {
java = "cd $dir && javac $fileName && java $fileNameWithoutExt", -- java = "cd $dir && javac $fileName && java $fileNameWithoutExt",
python = "python3 -u", -- python = "python3 -u",
typescript = "deno run", -- typescript = "deno run",
rust = "cd $dir && rustc $fileName && $dir/$fileNameWithoutExt", -- rust = "cd $dir && rustc $fileName && $dir/$fileNameWithoutExt",
-- cpp="gcc $fileName -lstdc++ -o $fileNameWithoutExt && $fileNameWithoutExt" -- -- cpp="gcc $fileName -lstdc++ -o $fileNameWithoutExt && $fileNameWithoutExt"
cpp = "g++ $fileName -o $fileNameWithoutExt && $dir/$fileNameWithoutExt", -- cpp = "g++ $fileName -o $fileNameWithoutExt && $dir/$fileNameWithoutExt",
scss = "sass $dir/$fileName $dir/$fileNameWithoutExt.css", -- scss = "sass $dir/$fileName $dir/$fileNameWithoutExt.css",
} }
local data_exists, runscript = pcall(require, "core.config") local data_exists, runscript = pcall(require, "core.config")
if data_exists then if data_exists then
for _, code in pairs(runscript.coderunner) do if runscript.coderunner ~= nil then
table.insert(filetype, code)
end end
rfile = runscript.coderunner
end end
code_runner.setup({ code_runner.setup({
-- put here the commands by filetype -- put here the commands by filetype
filetype = filetype, filetype = rfile,
-- mode = "term", -- mode = "term",
mode = "float", mode = "float",
focus = true, focus = true,