summaryrefslogtreecommitdiff
path: root/.config/nvim/lua/overseer/template/custom/cmake_build.lua
diff options
context:
space:
mode:
authorKyren223 <ulmliad223@gmail.com>2024-08-05 16:26:54 +0300
committerKyren223 <ulmliad223@gmail.com>2024-08-05 16:26:54 +0300
commit6abe2a79f71401003134d967327d4ee526ed12ae (patch)
tree6e6f824d7c622e706bd59a13d8dfe6fbe0c4b7a5 /.config/nvim/lua/overseer/template/custom/cmake_build.lua
parentd296700cb3a8fa7909e38b8bfcb15ddf1b811e25 (diff)
feat(nvim): setup overseer for C with cmake
Diffstat (limited to '.config/nvim/lua/overseer/template/custom/cmake_build.lua')
-rw-r--r--.config/nvim/lua/overseer/template/custom/cmake_build.lua24
1 files changed, 24 insertions, 0 deletions
diff --git a/.config/nvim/lua/overseer/template/custom/cmake_build.lua b/.config/nvim/lua/overseer/template/custom/cmake_build.lua
new file mode 100644
index 0000000..cb321a0
--- /dev/null
+++ b/.config/nvim/lua/overseer/template/custom/cmake_build.lua
@@ -0,0 +1,24 @@
+local overseer = require('overseer')
+local root_pattern = require('lspconfig/util').root_pattern('CMakePresets.json', 'CTestConfig.cmake', 'build', 'cmake')
+return {
+ name = 'Build Cmake Project',
+ builder = function(_)
+ local filename = vim.fn.expand('%:p')
+ local root_dir = root_pattern(filename) or vim.fn.getcwd()
+
+ return {
+ name = 'Cmake',
+ cmd = 'cmake .. && cmake --build .',
+ cwd = root_dir .. '/build',
+ }
+ end,
+ tags = { overseer.TAG.BUILD },
+ priority = 40,
+ condition = {
+ callback = function()
+ local filename = vim.fn.expand('%:p')
+ local root_dir = root_pattern(filename)
+ return root_dir ~= nil
+ end,
+ },
+}