From 637d8e143bfe5b3aa9a258a2e0f733a582a98925 Mon Sep 17 00:00:00 2001 From: Kyren223 Date: Fri, 12 Jul 2024 16:51:16 +0300 Subject: Neovim: configured overseer (task runner), added a make_c task template --- .config/nvim/lua/custom/plugins/TODO-overseer.lua | 10 ---------- .config/nvim/lua/custom/plugins/overseer.lua | 23 ++++++++++++++++++++++ .config/nvim/lua/overseer/template/custom/init.lua | 3 +++ .../nvim/lua/overseer/template/custom/make_c.lua | 20 +++++++++++++++++++ .config/nvim/plugin/options.lua | 3 ++- 5 files changed, 48 insertions(+), 11 deletions(-) delete mode 100644 .config/nvim/lua/custom/plugins/TODO-overseer.lua create mode 100644 .config/nvim/lua/custom/plugins/overseer.lua create mode 100644 .config/nvim/lua/overseer/template/custom/init.lua create mode 100644 .config/nvim/lua/overseer/template/custom/make_c.lua diff --git a/.config/nvim/lua/custom/plugins/TODO-overseer.lua b/.config/nvim/lua/custom/plugins/TODO-overseer.lua deleted file mode 100644 index a597f51..0000000 --- a/.config/nvim/lua/custom/plugins/TODO-overseer.lua +++ /dev/null @@ -1,10 +0,0 @@ -return { - 'stevearc/overseer.nvim', - opts = {}, - config = function() - require('overseer').setup({ - templates = { 'builtin', 'user.c_build_make' }, - }) - vim.keymap.set('n', 'r', 'OverseerRun', { desc = '[R]un Task' }) - end, -} diff --git a/.config/nvim/lua/custom/plugins/overseer.lua b/.config/nvim/lua/custom/plugins/overseer.lua new file mode 100644 index 0000000..4e24c39 --- /dev/null +++ b/.config/nvim/lua/custom/plugins/overseer.lua @@ -0,0 +1,23 @@ +return { + 'stevearc/overseer.nvim', + opts = {}, + config = function() + require('overseer').setup({ + templates = { 'builtin', 'custom' }, + task_list = { + min_height = 0.5, + bindings = { + ['o'] = false, + [''] = false, + [''] = false, + [''] = false, + [''] = false, + [''] = 'ScrollOutputUp', + [''] = 'ScrollOutputDown', + }, + }, + }) + vim.keymap.set('n', 'or', 'OverseerRun', { desc = '[O]verseer [R]un' }) + vim.keymap.set('n', 'ot', 'OverseerToggle', { desc = '[O]verseer [T]oggle' }) + end, +} diff --git a/.config/nvim/lua/overseer/template/custom/init.lua b/.config/nvim/lua/overseer/template/custom/init.lua new file mode 100644 index 0000000..be9e689 --- /dev/null +++ b/.config/nvim/lua/overseer/template/custom/init.lua @@ -0,0 +1,3 @@ +return { + 'custom.make_c', +} diff --git a/.config/nvim/lua/overseer/template/custom/make_c.lua b/.config/nvim/lua/overseer/template/custom/make_c.lua new file mode 100644 index 0000000..358047f --- /dev/null +++ b/.config/nvim/lua/overseer/template/custom/make_c.lua @@ -0,0 +1,20 @@ +local overseer = require('overseer') +return { + name = 'Make Current C file', + builder = function(_) + local path = vim.fn.expand('%:p') + local dir, file = path:gmatch('(.*)[/\\](.*)')() + file = string.sub(file, 1, -3) -- remove .c extension + + return { + cmd = { 'make' }, + args = { file }, + cwd = dir, + } + end, + tags = { overseer.TAG.BUILD }, + priority = 20, + condition = { + filetype = { 'c' }, + }, +} diff --git a/.config/nvim/plugin/options.lua b/.config/nvim/plugin/options.lua index 4a2da62..9ee0fd0 100644 --- a/.config/nvim/plugin/options.lua +++ b/.config/nvim/plugin/options.lua @@ -2,7 +2,8 @@ vim.g.have_nerd_font = true vim.opt.mouse = 'a' -- enable mouse vim.opt.clipboard = 'unnamedplus' -- use system clipboard -vim.opt.undofile = true -- Persist undo history by saving it to a file +vim.opt.undofile = true -- persist undo history by saving it to a file +vim.opt.exrc = true -- WARNING: runs .nvim.lua in cwd, which may execute arbitrary code -- Tab vim.opt.expandtab = true -- convert tabs to spaces -- cgit v1.3.1