my neovim config, who would've thought

tasks: q for close; remove the space with #next too

olexsmir.xyz d9fecf3d 63c61e7d

verified
Changed files
+5 -4
lua
scratch
+5 -4
lua/scratch/tasks.lua
··· 71 71 ---@param str string 72 72 ---@return string 73 73 local function remove_next_tag(str) 74 - local res = str:gsub("%#next", "") 74 + local res = str:gsub(" %#next", "") 75 75 return res 76 76 end 77 77 ··· 80 80 ---@return string 81 81 local function display_file(fname, line) 82 82 local str = (fname:match "^(.-)%.%w+$" or fname) .. ":" .. line 83 - return (str .. string.rep(" ", 14 - #str)) 83 + return (str .. string.rep(" ", 10 - #str)) 84 84 end 85 85 86 86 -- converts a like with markdown task to completed task, and removes `#next` in it, if there's one ··· 114 114 return heading_line 115 115 end 116 116 117 - local tasks = {} 118 - 119 117 local function agenda_go_to_task() 120 118 local line = vim.api.nvim_get_current_line() 121 119 local fname, lineno = line:match "^([^:]+):(%d+)" ··· 139 137 vim.cmd.edit(fpath) 140 138 vim.api.nvim_win_set_cursor(0, { tonumber(lineno), 0 }) 141 139 end 140 + 141 + local tasks = {} 142 142 143 143 function tasks.agenda() 144 144 -- parse all `task_files` for `#next` tag ··· 184 184 vim.api.nvim_win_set_height(winid, 10) 185 185 vim.api.nvim_win_set_cursor(winid, { 2, 0 }) 186 186 187 + vim.keymap.set("n", "q", "<cmd>quit<cr>", { buffer = buf, silent = true }) 187 188 vim.keymap.set("n", "<CR>", agenda_go_to_task, { 188 189 desc = "Open file under cursor", 189 190 buffer = buf,