Skip to content

Commit 7a08267

Browse files
committed
update mkdnflow config
1 parent 19fdee7 commit 7a08267

File tree

3 files changed

+53
-9
lines changed

3 files changed

+53
-9
lines changed

lua/plugin-config/mkdnflow.lua

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
local mkd = require("uConfig").mkdnflow
2+
if type(mkd) == "table" and mkd.enable then
3+
require("mkdnflow").setup({
4+
modules = {
5+
maps = false,
6+
},
7+
filetypes = { md = true, mdx = true, markdown = true },
8+
links = {
9+
style = "markdown",
10+
implicit_extension = nil,
11+
transform_implicit = false,
12+
transform_explicit = function(text)
13+
text = text:gsub(" ", "-")
14+
text = text:lower()
15+
text = os.date("%Y-%m-%d-") .. text
16+
return text
17+
end,
18+
},
19+
})
20+
21+
local mkdnflowGroup = vim.api.nvim_create_augroup("mkdnflowGroup", {
22+
clear = true,
23+
})
24+
vim.api.nvim_create_autocmd("FileType", {
25+
group = mkdnflowGroup,
26+
pattern = { "markdown", "md", "mdx" },
27+
callback = function()
28+
local opts = { buffer = vim.api.nvim_get_current_buf() }
29+
keymap("n", mkd.next_link, "<cmd>MkdnNextLink<CR>", opts)
30+
keymap("n", mkd.prev_link, "<cmd>MkdnPrevLink<CR>", opts)
31+
keymap("n", mkd.prev_heading, "<cmd>MkdnPrevHeading<CR>", opts)
32+
keymap("n", mkd.next_heading, "<cmd>MkdnNextHeading<CR>", opts)
33+
keymap("n", mkd.go_back, "<cmd>MkdnGoBack<CR>", opts)
34+
keymap("n", mkd.follow_link, "<cmd>MkdnFollowLink<CR>", opts)
35+
keymap("n", mkd.toggle_item, "<cmd>MkdnToggleToDo<CR>", opts)
36+
keymap({ "n", "x" }, mkd.follow_link, "<cmd>MkdnFollowLink<CR>", opts)
37+
end,
38+
})
39+
end

lua/plugins.lua

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,13 @@ packer.startup({
158158
vim.notify = require("notify")
159159
end,
160160
})
161+
use({
162+
"jakewvincent/mkdnflow.nvim",
163+
ft = { "markdown" },
164+
config = function()
165+
require("plugin-config.mkdnflow")
166+
end,
167+
})
161168

162169
if paccker_bootstrap then
163170
packer.sync()

lua/uConfig.lua

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -159,16 +159,14 @@ local M = {
159159
},
160160

161161
mkdnflow = {
162-
163162
enable = true,
164-
165-
next_link = "mn",
166-
prev_link = "mp",
167-
next_heading = "mj",
168-
prev_heading = "mk",
169-
go_back = "<BS>",
170-
follow_link = "m<CR>",
171-
toggle_item = "mt",
163+
next_link = "gn",
164+
prev_link = "gp",
165+
next_heading = "gj",
166+
prev_heading = "gk",
167+
go_back = "<C-o>",
168+
follow_link = "gd",
169+
toggle_item = "tt",
172170
},
173171

174172
comment = {

0 commit comments

Comments
 (0)