From 27d1d1458d8e308c2559f60dc67125e961bb5d20 Mon Sep 17 00:00:00 2001 From: Daniel Fichtinger Date: Thu, 23 Jan 2025 19:30:05 -0500 Subject: [PATCH] AutoYADM commit: 2025-01-23 19:30:05 --- .config/nvim/after/ftplugin/org.lua | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/.config/nvim/after/ftplugin/org.lua b/.config/nvim/after/ftplugin/org.lua index 17ccdf4c..71ed1de4 100644 --- a/.config/nvim/after/ftplugin/org.lua +++ b/.config/nvim/after/ftplugin/org.lua @@ -9,7 +9,7 @@ vim.api.nvim_create_autocmd({ "InsertLeave", "TextChanged" }, { command = "silent! write", }) -local function modmap(dir, type) +local function modmap(type, dir) local mode = vim.api.nvim_get_mode() local level = { notsame = { @@ -27,7 +27,9 @@ local function modmap(dir, type) }, }, } - require("orgmode").action("org_mappings." .. dir .. "_visible_heading") + local map = level[type].map + local word = level[type].words[dir] + require("orgmode").action(map[1] .. word .. map[2]) if mode.mode == "n" then vim.cmd("normal! zz") end @@ -35,10 +37,16 @@ end local override = true if override then vim.keymap.set("n", "}", function() - modmap("next") + modmap("notsame", "next") end) vim.keymap.set({ "n", "x" }, "{", function() - modmap("previous") + modmap("notsame", "previous") + end) + vim.keymap.set({ "n", "x" }, "[[", function() + modmap("same", "previous") + end) + vim.keymap.set({ "n", "x" }, "]]", function() + modmap("same", "next") end) end -- vim.api.nvim_create_autocmd({ "CursorMoved" }, {