]> git.r.bdr.sh - rbdr/dotfiles/commitdiff
Merge branch 'main' of git.sr.ht:~rbdr/dotfiles
authorRuben Beltran del Rio <redacted>
Mon, 4 Mar 2024 20:55:38 +0000 (21:55 +0100)
committerRuben Beltran del Rio <redacted>
Mon, 4 Mar 2024 20:55:38 +0000 (21:55 +0100)
config/nvim/init.lua
config/nvim/lazy-lock.json
config/nvim/lua/brain.lua [deleted file]
config/nvim/lua/plugins.lua
install
plan [new file with mode: 0644]

index 7243f4aa206a8ae86e012336d0f6b7ed3bb8ad8c..674a55d6af239b1b3ad0a5ad3d37b40c659f3150 100644 (file)
@@ -75,6 +75,11 @@ vim.api.nvim_create_autocmd({'BufNewFile', 'BufRead'}, {
   callback = function () vim.opt.filetype = 'snes' end
 })
 
+vim.api.nvim_create_autocmd({'BufNewFile', 'BufRead'}, {
+  pattern = {'.plan'},
+  callback = function () vim.opt.filetype = 'markdown' end
+})
+
 -------------------------------------------------------------------------------
 -- Local Overrides
 -------------------------------------------------------------------------------
index a233e4e1c1cac92b3434a65724bdaefefcb40365..18ee0da81eccbbb4a9907359b383dedae140ab77 100644 (file)
@@ -1,17 +1,18 @@
 {
   "LargeFile": { "branch": "master", "commit": "3941a37b2b0288524300348a39521a46539bf9f6" },
   "auto-save.nvim": { "branch": "main", "commit": "979b6c82f60cfa80f4cf437d77446d0ded0addf0" },
-  "coq_nvim": { "branch": "coq", "commit": "76fa95ea445b3d33968ff60bc6a3e2e8e0132551" },
-  "fzf-lua": { "branch": "main", "commit": "d68d1cfde9bf82061dfdfe35b83fb8636e03766d" },
+  "coq_nvim": { "branch": "coq", "commit": "b4c6d69749ed65c116a17e7234cd3aea1fef3939" },
+  "fzf-lua": { "branch": "main", "commit": "ab4ce5031c52455468a1ac0606b38248aa919c7c" },
   "gemini.vim": { "branch": "master", "commit": "c9efb59c97b71c28d4678c79fd21fbdd3a69d196" },
   "lazy.nvim": { "branch": "main", "commit": "aedcd79811d491b60d0a6577a9c1701063c2a609" },
   "neodev.nvim": { "branch": "main", "commit": "84e0290f5600e8b89c0dfcafc864f45496a53400" },
+  "neogen": { "branch": "main", "commit": "70127baaff25611deaf1a29d801fc054ad9d2dc1" },
   "nota.nvim": { "branch": "main", "commit": "9e9e89d8556ecafa6b11ab21aa9ffab550f7f3ad" },
   "nvim-dap": { "branch": "master", "commit": "fc880e82059eb21c0fa896be60146e5f17680648" },
   "nvim-dap-ui": { "branch": "master", "commit": "9720eb5fa2f41988e8770f973cd11b76dd568a5d" },
   "nvim-dap-vscode-js": { "branch": "main", "commit": "03bd29672d7fab5e515fc8469b7d07cc5994bbf6" },
   "nvim-lspconfig": { "branch": "master", "commit": "9553725789be682ecd945a527ec552e489ea8534" },
-  "nvim-treesitter": { "branch": "master", "commit": "62b0bb4f24ad09f535efe44cc9d088f90dcd2498" },
+  "nvim-treesitter": { "branch": "master", "commit": "e3e5ff4ebddcbfa8f5798253ebd1f9b449e8ee69" },
   "snes-syntax-vim": { "branch": "master", "commit": "a6a699c8905f7b6119bf91e44f960667d9f03d59" },
   "tree-sitter-api-notation": { "branch": "main", "commit": "3113c6077d9ed1e662a891714ac00e1ee3bb7657" },
   "vim-closer": { "branch": "master", "commit": "6007d9db0a35e983af246b667282606612076b07" },
@@ -19,4 +20,4 @@
   "vim-fugitive": { "branch": "master", "commit": "2e88f14a585c014691904ba8fe39e6ea851c9422" },
   "vim-indent-object": { "branch": "master", "commit": "8ab36d5ec2a3a60468437a95e142ce994df598c6" },
   "vim-togglelist": { "branch": "master", "commit": "48f0d30292efdf20edc883e61b121e6123e03df7" }
-}
\ No newline at end of file
+}
diff --git a/config/nvim/lua/brain.lua b/config/nvim/lua/brain.lua
deleted file mode 100644 (file)
index 1d04df0..0000000
+++ /dev/null
@@ -1,188 +0,0 @@
-local brain_home = os.getenv('HOME') .. '/brain'
-local templates_path = brain_home .. '/1 periodic/99 templates'
-
--------------------------------------------------------------------------------
--- Private functions for Periodic Tasks
--------------------------------------------------------------------------------
-
-local function load_template(template_name)
-  local template_path = templates_path .. '/' .. template_name
-
-  print(template_path)
-
-  local template_file = io.open(template_path, 'r')
-  if not template_file then
-      print('Template file not found')
-      return
-  end
-  local content = template_file:read('*a')
-  template_file:close()
-  return content
-end
-
-local function open_or_create_from_template(template_name, file)
-  local journal_file = io.open(file, 'r')
-  if not journal_file then
-    local template_contents = load_template(template_name)
-
-    journal_file = io.open(file, 'w')
-    journal_file:write(template_contents)
-    journal_file:close()
-  end
-  vim.cmd('edit ' .. file)
-end
-
-local function find_tasks(completed)
-  local journal_path = brain_home .. '/1 periodic/01 journal/'
-
-  local pattern = '^\\s*\\- \\[ \\]'
-  if completed == 1 then
-    pattern = '^\\s*\\- \\[x\\]'
-  end
-
-  local command = string.format('rg --vimgrep \'%s\' \'%s\'', pattern, journal_path)
-  local results = vim.fn.systemlist(command)
-
-  if vim.v.shell_error == 0 then
-    local items = {}
-    for _, line in ipairs(results) do
-      local filename, lnum, col, text = line:match("([^:]+):(%d+):(%d+):(.*)")
-            table.insert(items, {
-                filename = filename,
-                lnum = tonumber(lnum),
-                col = tonumber(col),
-                text = text,
-            })
-    end
-
-        -- Set location list for the current window and open it
-        vim.fn.setloclist(0, items)
-        vim.cmd('lopen')
-  end
-end
-
-local function get_this_weeks_files()
-  local today = os.time()
-  local day_of_week = os.date('*t', today).wday
-  local week_start = today - (day_of_week - 2) * 86400
-  local filenames = {}
-
-  for i = 0, 6 do
-    local date = os.date('*t', week_start + i * 86400)
-    table.insert(filenames, string.format('%04d-%02d-%02d.md', date.year, date.month, date.day))
-  end
-
-  return filenames
-end
-
-local function populate_quicklist_with_files(filenames)
-  local uv = vim.loop
-  local items = {}
-  local pattern = '^%s*%- %[[ ]?x?%]'
-
-  for _, filename in ipairs(filenames) do
-    local daily_note = brain_home .. '/1 periodic/01 journal/' .. filename
-    local stat = uv.fs_stat(daily_note)
-
-    if stat then -- File exists
-      local file, err = io.open(daily_note, 'r')
-      if file then
-        local set_header = 0
-        local line_number = 0
-        for line in file:lines() do
-          line_number = line_number + 1
-          if line:match(pattern) then
-            if set_header == 0 then
-              local header = string.sub(filename:match('([^/\\]+)$'), 1, -4)
-              table.insert(items, {filename = '', lnum = 0, text = header})
-              set_header = 1
-            end
-            table.insert(items, {filename = daily_note, text = line, lnum = line_number})
-          end
-        end
-        file:close()
-      end
-    end
-  end
-  vim.fn.setloclist(0, {}, ' ', {title = 'Weekly Tasks', items = items})
-  vim.cmd('lopen')
-end
-
--------------------------------------------------------------------------------
--- Periodic Notes
--------------------------------------------------------------------------------
-
-function open_daily_note()
-    local filename_format = os.date('%Y-%m-%d')
-    local template_name = '001 daily.md'
-
-    local daily_note = brain_home .. '/1 periodic/01 journal/' .. filename_format .. '.md'
-    open_or_create_from_template(template_name, daily_note)
-end
-
-function open_weekly_note()
-    local filename_format = os.date('%Y-w%V')
-    local template_name = '002 weekly.md'
-
-    local weekly_note = brain_home .. '/1 periodic/02 weeks/' .. filename_format .. '.md'
-    open_or_create_from_template(template_name, weekly_note)
-end
-
--------------------------------------------------------------------------------
--- Task Utilities
--------------------------------------------------------------------------------
-
-function toggle_task()
-    local line_num = vim.api.nvim_win_get_cursor(0)[1]
-    local line = vim.api.nvim_get_current_line()
-
-    local unchecked_pattern = '^%s*%- %[ %]'
-    local checked_pattern = '^%s*%- %[x%]'
-
-    if line:match(unchecked_pattern) then
-        line = line:gsub(unchecked_pattern, '- [x]', 1)
-    elseif line:match(checked_pattern) then
-        line = line:gsub(checked_pattern, '- [ ]', 1)
-    end
-
-    vim.api.nvim_buf_set_lines(0, line_num - 1, line_num, false, {line})
-end
-
--------------------------------------------------------------------------------
--- Task Quicklist Views
--------------------------------------------------------------------------------
-
-function open_agenda()
-  local week_filenames = get_this_weeks_files()
-  populate_quicklist_with_files(week_filenames)
-end
-
-function open_open()
-  find_tasks(0)
-end
-
--------------------------------------------------------------------------------
--- Key Bindings
--------------------------------------------------------------------------------
--- Periodic Notes
-vim.api.nvim_set_keymap('n', '<leader>od', '<cmd>lua open_daily_note()<CR>', { noremap = true, silent = true })
-vim.api.nvim_set_keymap('n', '<leader>ow', '<cmd>lua open_weekly_note()<CR>', { noremap = true, silent = true })
--- Planned: \om to open monthly, \os to open seasonly, and \oy to open yearly
--- Agenda Views
-vim.api.nvim_set_keymap('n', '<leader>oa', '<cmd>lua open_agenda()<CR>', { noremap = true, silent = true })
-vim.api.nvim_set_keymap('n', '<leader>oo', '<cmd>lua open_open()<CR>', { noremap = true, silent = true })
--- Planned: \oj to open journal
--- Task Helpers
-vim.api.nvim_set_keymap('n', '<leader>t', '<cmd>lua toggle_task()<CR>', { noremap = true, silent = true })
--- Planned: \it to insert tasks
--- Planned: \ct to capture task to an inbox
--- Planned: \cl to capture a learning
--- Planned: \cp to capture .plan
--- Planned: \rt reschedule task to today
--- Planned: \rT reschedule task for tomorrow
--- Planned But even later: \rr reschedule task for an arbitrary date.
--- Planned: \rs reschedule task for someday
--------------------------------------------------------------------------------
--- Ideas:
--- Navigate through the weeks like in org mode?
--- Labels?
index 4bbcc15bbd9802ad328b86950629af1baefeb65b..15aeb955ee0b46b7260319dc6acc88c816828375 100644 (file)
@@ -46,6 +46,7 @@ require('lazy').setup({
   -- Syntaxes
   'ARM9/snes-syntax-vim',
   'https://git.sr.ht/~torresjrjr/gemini.vim',
+  { "folke/neodev.nvim", opts = {} },
 
   -- Debugging
   'mfussenegger/nvim-dap',
@@ -58,6 +59,10 @@ require('lazy').setup({
   'rstacruz/vim-closer',
   'michaeljsmith/vim-indent-object',
   'Pocco81/auto-save.nvim',
+  {
+    "danymat/neogen",
+    config = true
+  },
 
   -- Treesitter
   'nvim-treesitter/nvim-treesitter',
diff --git a/install b/install
index 7b5c7c5c5d87723c8c1d1abeb03a2b069942578b..9940001ca10211bb5d1d3dd4406d32d7b8a6af3a 100755 (executable)
--- a/install
+++ b/install
@@ -44,6 +44,9 @@ ln -fns .dotfiles/skhdrc ~/.skhdrc
 # tmuxp
 ln -fns .dotfiles/tmuxp ~/.tmuxp
 
+# plan
+ln -fns .dotfiles/plan ~/.plan
+
 # config dir
 mkdir -p ~/.config
 
diff --git a/plan b/plan
new file mode 100644 (file)
index 0000000..3a655ce
--- /dev/null
+++ b/plan
@@ -0,0 +1,9 @@
+# My plan for now, roughly
+
+- Add the task labeling and rescheduling functionality to nota.nvim
+
+    [2024-03-03] This is done. Adding scheduling was mostly a matter of text manipulation. Since I only use YYYY-MM-DD it works quite well. If people ever adopt it, I would consider adding flexibility.
+
+- Finalize the template parser for blog 7.0.0
+
+[2024-03-02]