Why we need to do this ?
Closed this issue · 3 comments
ysl2 commented
code_runner.nvim/lua/code_runner/commands.lua
Lines 29 to 31 in a010649
I inject my cofig like this:
require('code_runner').setup({
mode = 'toggleterm',
filetype = {
c = (function()
if vim.fn.has('win32') == 1 then
result = ('cd %s && clang %s -o %s.exe && .\\%s.exe'):format(vim.fn.expand('%:p:h'), vim.fn.expand('%:t'), vim.fn.expand('%:t:r'), vim.fn.expand('%:t:r')):gsub('/', '\\')
return result
end
return 'cd $dir && clang $fileName -o $fileNameWithoutExt && ./$fileNameWithoutExt'
end)()
}
})
The command I desire is:
cd C:\Users\aaba\Documents\_Documents\code-playground && clang main.c -o main.exe && .\main.exe
But it will auto append working directory path like this:
cd C:\Users\aaba\Documents\_Documents\code-playground && clang main.c -o main.exe && .\main.exe C:\Users\aaba\Documents\_Documents\code-playground
CRAG666 commented
change return result
for return result .. '$end'
ysl2 commented
thanks bro !