AutoYADM commit: 2025-01-23 19:30:05
This commit is contained in:
parent
462011e995
commit
27d1d1458d
1 changed files with 12 additions and 4 deletions
|
@ -9,7 +9,7 @@ vim.api.nvim_create_autocmd({ "InsertLeave", "TextChanged" }, {
|
||||||
command = "silent! write",
|
command = "silent! write",
|
||||||
})
|
})
|
||||||
|
|
||||||
local function modmap(dir, type)
|
local function modmap(type, dir)
|
||||||
local mode = vim.api.nvim_get_mode()
|
local mode = vim.api.nvim_get_mode()
|
||||||
local level = {
|
local level = {
|
||||||
notsame = {
|
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
|
if mode.mode == "n" then
|
||||||
vim.cmd("normal! zz")
|
vim.cmd("normal! zz")
|
||||||
end
|
end
|
||||||
|
@ -35,10 +37,16 @@ end
|
||||||
local override = true
|
local override = true
|
||||||
if override then
|
if override then
|
||||||
vim.keymap.set("n", "}", function()
|
vim.keymap.set("n", "}", function()
|
||||||
modmap("next")
|
modmap("notsame", "next")
|
||||||
end)
|
end)
|
||||||
vim.keymap.set({ "n", "x" }, "{", function()
|
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)
|
||||||
end
|
end
|
||||||
-- vim.api.nvim_create_autocmd({ "CursorMoved" }, {
|
-- vim.api.nvim_create_autocmd({ "CursorMoved" }, {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue