summaryrefslogtreecommitdiff
path: root/.config/nvim/lua/extra.lua
diff options
context:
space:
mode:
authorKyren223 <contact@kyren.codes>2026-08-05 03:19:05 +0300
committerKyren223 <contact@kyren.codes>2026-08-05 03:19:05 +0300
commit615433f5772748d8beaa4eef61082ac39c7c5c3b (patch)
tree66b4b0d8b4398ab730730f5ace4bec904f2e6569 /.config/nvim/lua/extra.lua
parent0e25e3f5d9c1ee4592137e7b1f07990929f3fd4f (diff)
Refactor compile/task system thing to be more flexible, can now define
any number of tasks instead of just hardcoding build/run/test
Diffstat (limited to '.config/nvim/lua/extra.lua')
-rw-r--r--.config/nvim/lua/extra.lua19
1 files changed, 9 insertions, 10 deletions
diff --git a/.config/nvim/lua/extra.lua b/.config/nvim/lua/extra.lua
index 3af98a7..b6c2844 100644
--- a/.config/nvim/lua/extra.lua
+++ b/.config/nvim/lua/extra.lua
@@ -385,7 +385,7 @@ vim.api.nvim_create_autocmd('TermOpen', {
----------------------------------------------------------------------------
-- NOTE: Compile a project by opening a terminal, inspired by Casey's workflow
----------------------------------------------------------------------------
-function Compile_project(command)
+function RunCommand(command)
local x = 2
local y = 1
local filter = function(win)
@@ -631,10 +631,11 @@ function JumpToDiagnostic(direction, is_error, is_warning)
end, 0) -- in milliseconds
vim.defer_fn(function()
- if vim.g.project_compile_cmd then
- Compile_project(vim.g.project_compile_cmd)
+ local build_task = vim.g.workspace_tasks['build']
+ if build_task and build_task.cmd then
+ RunCommand(build_task.cmd)
else
- vim.notify('vim.g.project_compile_cmd missing', 'warn')
+ vim.notify('vim.g.workspace_tasks["build"].cmd missing', 'warn')
end
end, 100) -- in milliseconds
end
@@ -648,11 +649,11 @@ function JumpToPrevError()
end
function JumpToNextWarning()
- return JumpToDiagnostic(1, true, true)
+ return JumpToDiagnostic(1, false, true)
end
function JumpToPrevWarning()
- return JumpToDiagnostic(-1, true, true)
+ return JumpToDiagnostic(-1, false, true)
end
----------------------------------------------------------------------------
@@ -980,15 +981,13 @@ local function open_scratch_buffer_map(is_global)
end
end
-vim.keymap.set('n', '<leader>ge', open_scratch_buffer_map(true))
-vim.keymap.set('n', '<leader>we', open_scratch_buffer_map(false))
+vim.keymap.set('n', '<leader>go', open_scratch_buffer_map(true))
+vim.keymap.set('n', '<leader>so', open_scratch_buffer_map(false))
----------------------------------------------------------------------------
-- NOTE: Insert commit msg into commit buffer in neogit
----------------------------------------------------------------------------
-local commit_msg = 'Your default commit message\nTest\nMultiline'
-
local group = vim.api.nvim_create_augroup('NeogitCommitMessage', { clear = true })
vim.api.nvim_create_autocmd('FileType', {