diff options
| author | Kyren223 <ulmliad223@gmail.com> | 2024-07-12 16:51:16 +0300 |
|---|---|---|
| committer | Kyren223 <ulmliad223@gmail.com> | 2024-07-12 16:51:16 +0300 |
| commit | 637d8e143bfe5b3aa9a258a2e0f733a582a98925 (patch) | |
| tree | 99415f58416e94dbec31bcb6942e050d10262f90 /.config/nvim | |
| parent | 0652aa92543b458b890ce234c78c02166c45d8f2 (diff) | |
Neovim: configured overseer (task runner), added a make_c task template
Diffstat (limited to '.config/nvim')
| -rw-r--r-- | .config/nvim/lua/custom/plugins/TODO-overseer.lua | 10 | ||||
| -rw-r--r-- | .config/nvim/lua/custom/plugins/overseer.lua | 23 | ||||
| -rw-r--r-- | .config/nvim/lua/overseer/template/custom/init.lua | 3 | ||||
| -rw-r--r-- | .config/nvim/lua/overseer/template/custom/make_c.lua | 20 | ||||
| -rw-r--r-- | .config/nvim/plugin/options.lua | 3 |
5 files changed, 48 insertions, 11 deletions
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', '<leader>r', '<cmd>OverseerRun<cr>', { 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, + ['<C-v>'] = false, + ['<C-s>'] = false, + ['<C-k>'] = false, + ['<C-j>'] = false, + ['<C-u>'] = 'ScrollOutputUp', + ['<C-d>'] = 'ScrollOutputDown', + }, + }, + }) + vim.keymap.set('n', '<leader>or', '<cmd>OverseerRun<cr>', { desc = '[O]verseer [R]un' }) + vim.keymap.set('n', '<leader>ot', '<cmd>OverseerToggle<cr>', { 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 |
