updates
This commit is contained in:
87
lua/shelbybark/plugins/markdown.lua
Normal file
87
lua/shelbybark/plugins/markdown.lua
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
return {
|
||||||
|
"MeanderingProgrammer/render-markdown.nvim",
|
||||||
|
dependencies = {
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
"nvim-tree/nvim-web-devicons", -- Optional: for file icons
|
||||||
|
},
|
||||||
|
ft = { "markdown", "codecompanion" }, -- Only load for markdown files
|
||||||
|
config = function()
|
||||||
|
require("render-markdown").setup({
|
||||||
|
-- Enable/disable the plugin
|
||||||
|
enabled = true,
|
||||||
|
-- Maximum file size (MB) to render
|
||||||
|
max_file_size = 10.0,
|
||||||
|
-- Debounce rendering after changes (ms)
|
||||||
|
debounce = 100,
|
||||||
|
-- Preset configurations: 'none', 'lazy', 'obsidian'
|
||||||
|
preset = "none",
|
||||||
|
-- Render modes: 'n' (normal), 'c' (command), 'i' (insert), 'v' (visual)
|
||||||
|
render_modes = { "n", "c" },
|
||||||
|
-- Anti-conceal behavior
|
||||||
|
anti_conceal = {
|
||||||
|
-- Disable anti-conceal on cursor line
|
||||||
|
enabled = true,
|
||||||
|
},
|
||||||
|
-- Heading configurations
|
||||||
|
heading = {
|
||||||
|
-- Turn on/off heading icon & background
|
||||||
|
enabled = true,
|
||||||
|
-- Turn on/off any sign column related rendering
|
||||||
|
sign = true,
|
||||||
|
-- Replaces '#+' of 'atx_h._marker'
|
||||||
|
-- The number of '#' in the heading determines the 'level'
|
||||||
|
-- The 'level' is used to index into the array using a cycle
|
||||||
|
icons = { " ", " ", " ", " ", " ", " " },
|
||||||
|
-- Added to the sign column if enabled
|
||||||
|
-- The 'level' is used to index into the array using a cycle
|
||||||
|
signs = { " " },
|
||||||
|
-- Width of the heading background
|
||||||
|
width = "full",
|
||||||
|
-- Amount of margin to add to the left of headings
|
||||||
|
left_margin = 0,
|
||||||
|
-- Amount of padding to add to the left of headings
|
||||||
|
left_pad = 0,
|
||||||
|
-- Amount of padding to add to the right of headings
|
||||||
|
right_pad = 0,
|
||||||
|
},
|
||||||
|
-- Code block configurations
|
||||||
|
code = {
|
||||||
|
-- Turn on/off code block & inline code rendering
|
||||||
|
enabled = true,
|
||||||
|
-- Turn on/off any sign column related rendering
|
||||||
|
sign = true,
|
||||||
|
-- Determines how code blocks & inline code are rendered:
|
||||||
|
-- none: disables all rendering
|
||||||
|
-- normal: adds highlight group to code blocks & inline code
|
||||||
|
-- language: adds language icon to sign column if enabled and icon + name above code blocks
|
||||||
|
-- full: normal + language
|
||||||
|
style = "full",
|
||||||
|
-- Amount of padding to add to the left of code blocks
|
||||||
|
left_pad = 0,
|
||||||
|
-- Amount of padding to add to the right of code blocks
|
||||||
|
right_pad = 0,
|
||||||
|
-- Width of the code block background
|
||||||
|
width = "full",
|
||||||
|
-- Determines how the top / bottom of code block are rendered:
|
||||||
|
-- thick: use the same highlight as the code body
|
||||||
|
-- thin: when lines are empty overlay the above & below icons
|
||||||
|
border = "thin",
|
||||||
|
-- Used above code blocks for thin border
|
||||||
|
above = "▄",
|
||||||
|
-- Used below code blocks for thin border
|
||||||
|
below = "▀",
|
||||||
|
-- Highlight for code blocks
|
||||||
|
highlight = "RenderMarkdownCode",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Optional keymaps
|
||||||
|
vim.api.nvim_set_keymap(
|
||||||
|
"n",
|
||||||
|
"<leader>mr",
|
||||||
|
"<cmd>RenderMarkdown toggle<cr>",
|
||||||
|
{ noremap = true, silent = true, desc = "Toggle markdown rendering" }
|
||||||
|
)
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
return {
|
return {
|
||||||
"nvim-telescope/telescope.nvim",
|
"nvim-telescope/telescope.nvim",
|
||||||
branch = "0.1.x",
|
|
||||||
dependencies = {
|
dependencies = {
|
||||||
"nvim-lua/plenary.nvim",
|
"nvim-lua/plenary.nvim",
|
||||||
{ "nvim-telescope/telescope-fzf-native.nvim", build = "make" },
|
{ "nvim-telescope/telescope-fzf-native.nvim", build = "make" },
|
||||||
@@ -15,6 +14,21 @@ return {
|
|||||||
telescope.setup({
|
telescope.setup({
|
||||||
defaults = {
|
defaults = {
|
||||||
path_display = { "smart" },
|
path_display = { "smart" },
|
||||||
|
-- Add fallback for treesitter highlighting issues
|
||||||
|
buffer_previewer_maker = function(filepath, bufnr, opts)
|
||||||
|
opts = opts or {}
|
||||||
|
|
||||||
|
-- Try default previewer, fallback if treesitter fails
|
||||||
|
local ok, _ = pcall(function()
|
||||||
|
require("telescope.previewers").buffer_previewer_maker(filepath, bufnr, opts)
|
||||||
|
end)
|
||||||
|
|
||||||
|
if not ok then
|
||||||
|
-- Fallback without treesitter highlighting
|
||||||
|
opts.use_highlighter = false
|
||||||
|
require("telescope.previewers").buffer_previewer_maker(filepath, bufnr, opts)
|
||||||
|
end
|
||||||
|
end,
|
||||||
mappings = {
|
mappings = {
|
||||||
i = {
|
i = {
|
||||||
["<C-k>"] = actions.move_selection_previous, -- move to prev result
|
["<C-k>"] = actions.move_selection_previous, -- move to prev result
|
||||||
|
|||||||
@@ -43,11 +43,21 @@ return {
|
|||||||
"yaml",
|
"yaml",
|
||||||
"ruby",
|
"ruby",
|
||||||
},
|
},
|
||||||
|
-- Add standard treesitter configuration
|
||||||
|
highlight = {
|
||||||
|
enable = true,
|
||||||
|
additional_vim_regex_highlighting = false,
|
||||||
|
},
|
||||||
|
indent = {
|
||||||
|
enable = true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
config = function(_, opts)
|
config = function(_, opts)
|
||||||
-- install parsers from custom opts.ensure_installed
|
-- Set up standard treesitter (this handles ensure_installed automatically)
|
||||||
|
require("nvim-treesitter.configs").setup(opts)
|
||||||
|
|
||||||
|
-- Register parsers for filetypes (if needed for custom mappings)
|
||||||
if opts.ensure_installed and #opts.ensure_installed > 0 then
|
if opts.ensure_installed and #opts.ensure_installed > 0 then
|
||||||
require("nvim-treesitter").install(opts.ensure_installed)
|
|
||||||
-- register and start parsers for filetypes
|
-- register and start parsers for filetypes
|
||||||
for _, parser in ipairs(opts.ensure_installed) do
|
for _, parser in ipairs(opts.ensure_installed) do
|
||||||
local filetypes = parser -- In this case, parser is the filetype/language name
|
local filetypes = parser -- In this case, parser is the filetype/language name
|
||||||
@@ -56,7 +66,10 @@ return {
|
|||||||
vim.api.nvim_create_autocmd({ "FileType" }, {
|
vim.api.nvim_create_autocmd({ "FileType" }, {
|
||||||
pattern = filetypes,
|
pattern = filetypes,
|
||||||
callback = function(event)
|
callback = function(event)
|
||||||
vim.treesitter.start(event.buf, parser)
|
local ok, _ = pcall(vim.treesitter.start, event.buf, parser)
|
||||||
|
if not ok then
|
||||||
|
-- Silently fail if parser issues
|
||||||
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
@@ -96,7 +109,12 @@ return {
|
|||||||
|
|
||||||
if not parser_installed then
|
if not parser_installed then
|
||||||
-- If not installed, install parser synchronously
|
-- If not installed, install parser synchronously
|
||||||
require("nvim-treesitter").install({ parser_name }):wait(30000)
|
local ok, _ = pcall(function()
|
||||||
|
require("nvim-treesitter.install").install(parser_name)
|
||||||
|
end)
|
||||||
|
if not ok then
|
||||||
|
return
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- let's check again
|
-- let's check again
|
||||||
@@ -104,7 +122,7 @@ return {
|
|||||||
|
|
||||||
if parser_installed then
|
if parser_installed then
|
||||||
-- Start treesitter for this buffer
|
-- Start treesitter for this buffer
|
||||||
vim.treesitter.start(bufnr, parser_name)
|
pcall(vim.treesitter.start, bufnr, parser_name)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
@@ -115,7 +133,6 @@ return {
|
|||||||
event = "BufRead",
|
event = "BufRead",
|
||||||
dependencies = {
|
dependencies = {
|
||||||
"nvim-treesitter/nvim-treesitter",
|
"nvim-treesitter/nvim-treesitter",
|
||||||
event = "BufRead",
|
|
||||||
},
|
},
|
||||||
opts = {
|
opts = {
|
||||||
multiwindow = true,
|
multiwindow = true,
|
||||||
@@ -124,6 +141,7 @@ return {
|
|||||||
{
|
{
|
||||||
"nvim-treesitter/nvim-treesitter-textobjects",
|
"nvim-treesitter/nvim-treesitter-textobjects",
|
||||||
branch = "main",
|
branch = "main",
|
||||||
|
dependencies = { "nvim-treesitter/nvim-treesitter" },
|
||||||
keys = {
|
keys = {
|
||||||
{
|
{
|
||||||
"af",
|
"af",
|
||||||
|
|||||||
Reference in New Issue
Block a user