SexNvim/lua/config/render-markdown.lua
2025-04-10 22:48:33 +03:00

74 lines
2.1 KiB
Lua

require('render-markdown').setup({
debounce = 100,
-- render_modes = true,
heading = {
enabled = true,
icons = { "", },
position = 'inline',
border = { true, true, true, false, false, false},
border_virtual = true,
width = 'block',
right_pad = 1,
left_pad = 1,
},
sign = { enabled = false },
quote = { repeat_linebreak = true },
link = {
enabled = true,
render_modes = false,
footnote = {
superscript = false,
prefix = '',
suffix = '',
},
image = '󰥶 ',
email = '󰀓 ',
hyperlink = '',
highlight = 'RenderMarkdownLink',
wiki = {
icon = '󱗖 ',
body = function()
return nil
end,
highlight = 'RenderMarkdownWikiLink',
},
custom = {
web = { pattern = '^http', icon = '󰖟 ' },
discord = { pattern = 'discord%.com', icon = '󰙯 ' },
github = { pattern = 'github%.com', icon = '󰊤 ' },
gitlab = { pattern = 'gitlab%.com', icon = '󰮠 ' },
google = { pattern = 'google%.com', icon = '󰊭 ' },
neovim = { pattern = 'neovim%.io', icon = '' },
reddit = { pattern = 'reddit%.com', icon = '󰑍 ' },
stackoverflow = { pattern = 'stackoverflow%.com', icon = '󰓌 ' },
wikipedia = { pattern = 'wikipedia%.org', icon = '󰖬 ' },
youtube = { pattern = 'youtube%.com', icon = '󰗃 ' },
},
},
checkbox = {
unchecked = { icon = '' },
checked = { icon = '' },
},
bullet = { icons = { '', '', '-',} },
})
-- переход по ссылкам
vim.keymap.set('n', 'gl', function() FindHttpOrWwwInLine() end, { silent = true })
function FindHttpOrWwwInLine()
local line = vim.api.nvim_get_current_line()
local start_pos, end_pos = line:find("http")
if start_pos then
local col = start_pos - 1
vim.api.nvim_win_set_cursor(0, {vim.fn.line('.'), col})
vim.cmd("normal! vE")
vim.fn.feedkeys("gx")
vim.api.nvim_input("<Esc>")
end
end