summaryrefslogtreecommitdiff
path: root/lua
diff options
context:
space:
mode:
authorAotrix <[email protected]>2026-08-30 18:10:22 +0200
committerAotrix <[email protected]>2026-08-30 18:10:22 +0200
commit9fe9d68e89ad6273613b89c5de0a9dcc56acec81 (patch)
tree0bf05d1a52b9e945c178da02c079ded4cb16a08b /lua
parentcf843be74209a79a581beb1bd297882c043667b1 (diff)
set -std=c++26
Diffstat (limited to 'lua')
-rw-r--r--lua/aotrix/competitive_programming.lua16
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'
+})