diff options
Diffstat (limited to 'lua/aotrix/competitive_programming.lua')
| -rw-r--r-- | lua/aotrix/competitive_programming.lua | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/lua/aotrix/competitive_programming.lua b/lua/aotrix/competitive_programming.lua index bcb5888..12c7e45 100644 --- a/lua/aotrix/competitive_programming.lua +++ b/lua/aotrix/competitive_programming.lua @@ -1,8 +1,8 @@ function Compile_and_run_cpp() local filename = vim.fn.expand("%:p") local basename = vim.fn.expand("%:r") - local output_file = "output.txt" -- Change this to the desired output file name - local input_file = "input.txt" -- Change this to the desired input file name + local output_file = "/tmp/output_competitive_programming.txt" -- Change this to the desired output file name + local input_file = "/tmp/input_competitive_programming.txt" -- Change this to the desired input file name -- Check if current file is a valid C++ or C file local valid_extensions = {"cpp", "c"} @@ -63,9 +63,10 @@ function Compile_and_run_cpp() vim.cmd(file .. "wincmd w") -- Compile and run C++ file - local compile_cmd = string.format("g++ %s -o %s && ./%s < %s > %s", - filename, basename, basename, input_file, - output_file) + local compile_cmd = string.format( + "g++ -std=c++26 %s -o %s && ./%s < %s > %s", + filename, basename, basename, input_file, + output_file) vim.cmd("silent w") -- Save the current file vim.cmd("silent !clear") -- Clear the terminal vim.cmd("silent !" .. compile_cmd) -- Execute the compile and run command @@ -75,5 +76,6 @@ function Compile_and_run_cpp() end vim.api.nvim_create_user_command("CompetitiveProgrammingRun", - function() Compile_and_run_cpp() end, - { desc = 'Run current cpp file with input/output windows' }) + function() Compile_and_run_cpp() end, { + desc = 'Run current cpp file with input/output windows' +}) |
