From 4b22a7504c5ca1996e8635f03bc4b2d9b6ea2222 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=BCdecke=20Sascha?= Date: Mon, 28 Sep 2026 09:52:20 +0200 Subject: [PATCH] Agenda Mode updates and sorting + a --- lua/config/alpha-nvim.lua | 2 +- lua/keybindings.lua | 2 +- lua/plugins.lua | 49 ++++++++++++++++++++++++++++++++++++--- 3 files changed, 48 insertions(+), 5 deletions(-) diff --git a/lua/config/alpha-nvim.lua b/lua/config/alpha-nvim.lua index f53992a..a554125 100644 --- a/lua/config/alpha-nvim.lua +++ b/lua/config/alpha-nvim.lua @@ -83,7 +83,7 @@ dashboard.section.header.val = vim.split(adjustedLogo, '\n') local buttons = { dashboard.button('n', ' New file', ':ene startinsert '), dashboard.button('s', ' Settings', 'WorkspacesOpen config-nvim'), - dashboard.button('a', ' Agenda & TODOs', 'Org agenda t'), + dashboard.button('a', ' Agenda & TODOs', 'Org agenda c'), dashboard.button('u', '󱐥 Update plugins', 'Lazy update'), dashboard.button('w', '󱌣 Workspaces', 'WorkspacesOpen'), dashboard.button('q', '󰤆 Quit', 'qa'), diff --git a/lua/keybindings.lua b/lua/keybindings.lua index 9f5af01..1003b56 100644 --- a/lua/keybindings.lua +++ b/lua/keybindings.lua @@ -43,7 +43,7 @@ vim.keymap.set('n', 'of', }) end, { desc = "Open org folder" }) -vim.keymap.set('n', 'a', ':silent Org agenda t', { desc = "Org Agenda" }) +vim.keymap.set('n', 'a', ':silent Org agenda c', { desc = "Org Agenda" }) vim.keymap.set('n', 'Q', ':silent Org capture t', { desc = "Org new TODO"}) vim.keymap.set('n', 'q', ':silent Org capture i', { desc = "Org new interruption" }) diff --git a/lua/plugins.lua b/lua/plugins.lua index dc8ca60..92d0aa2 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -56,7 +56,7 @@ require("lazy").setup({ -- [''] = { 'select_and_accept', 'fallback' }, -- [''] = { 'select_next', 'show_and_insert', 'fallback' }, - [''] = { function(cmp) cmp.show({ providers = { 'lsp' } }) end }, + [''] = { function(cmp) cmp.show({ providers = { 'lsp' } }) end }, }, signature = { enabled = true }, @@ -193,7 +193,7 @@ require("lazy").setup({ -- Setup orgmode require('orgmode').setup({ win_split_mode = '0tabnew', - org_log_done = false, + -- org_log_done = false, -- cf: https://github.com/nvim-orgmode/orgmode/blob/master/docs/configuration.org#mappings mappings = { org = { @@ -203,13 +203,46 @@ require("lazy").setup({ org_demote_subtree = { '>s', '' }, } }, + org_agenda_hide_empty_blocks = true, + org_agenda_custom_commands = { + -- "c" is the shortcut that will be used in the prompt + c = { + description = 'Combined view', -- Description shown in the prompt for the shortcut + types = { + { + type = 'tags_todo', -- Type can be agenda | tags | tags_todo + match = '+PRIORITY="A"', --Same as providing a "Match:" for tags view oa + m, See: https://orgmode.org/manual/Matching-tags-and-properties.html + org_agenda_overriding_header = 'High prio todos', + org_agenda_todo_ignore_deadlines = 'far', -- Ignore all deadlines that are too far in future (over org_deadline_warning_days). Possible values: all | near | far | past | future + org_agenda_sorting_strategy = { 'tag-up', 'todo-state-down', 'priority-down' } -- See all options available on org_agenda_sorting_strategy + }, + { + type = 'agenda', + org_agenda_overriding_header = 'Agenda 10 days', + org_agenda_span = 10, -- 'week' is default, so it's not necessary here, just an example + -- org_agenda_start_on_weekday = 1, -- Start on Monday + -- org_agenda_start_on_weekday = false, -- Start today + -- org_agenda_remove_tags = true -- Do not show tags only for this view + org_agenda_sorting_strategy = { 'time-up', 'tag-up', 'todo-state-down', 'priority-down' } -- See all options available on org_agenda_sorting_strategy + }, + { + type = 'tags_todo', + match = '-PRIORITY="A"', --Same as providing a "Match:" for tags view oa + m, See: https://orgmode.org/manual/Matching-tags-and-properties.html + org_agenda_overriding_header = 'Normal prio todos', + org_agenda_sorting_strategy = { 'tag-up', 'todo-state-down', 'priority-down' }, -- See all options available on org_agenda_sorting_strategy + -- org_agenda_todo_ignore_scheduled = 'all', -- Ignore all headlines that are scheduled. Possible values: past | future | all + + }, + } + }, + }, -- org_agenda_files = '~/orgfiles/**/*', -- org_default_notes_file = '~/orgfiles/refile.org', org_agenda_files = sl_opt.org_agenda_files, org_default_notes_file = sl_opt.org_default_notes_file, org_archive_location = sl_opt.org_archive_location, org_capture_templates = { - t = { description = 'Task', template = "* TODO %u %?" }, + t = { description = 'Task', template = "* TODO %u %?\n SCHEDULED: %^{Due date}t" }, i = { description = 'Interruption', template = "* STARTED [#A] %^{Working on}\n %U\n %a\n" }, }, org_todo_keywords = { 'TODO(t)', 'STARTED(s)', 'PLANNED(p)', '|', 'DONE(d)', 'UNPLANNED(u)' }, @@ -235,6 +268,16 @@ require("lazy").setup({ }, }) + vim.api.nvim_create_autocmd('ColorScheme', { + pattern = '*', + callback = function() + -- Define own colors + -- color updates + vim.api.nvim_set_hl(0, '@org.agenda.weekend', { fg = '#aaaaaa' }) + vim.api.nvim_set_hl(0, '@org.agenda.day', { fg = '#eeeeee' }) + end + }) + -- NOTE: If you are using nvim-treesitter with ~ensure_installed = "all"~ option -- add ~org~ to ignore_install -- require('nvim-treesitter.configs').setup({