This commit is contained in:
2025-12-11 15:04:13 -06:00
parent 7fb1e8ba75
commit 223a658e91
3 changed files with 140 additions and 21 deletions

View 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,
}

View File

@@ -1,6 +1,5 @@
return {
"nvim-telescope/telescope.nvim",
branch = "0.1.x",
dependencies = {
"nvim-lua/plenary.nvim",
{ "nvim-telescope/telescope-fzf-native.nvim", build = "make" },
@@ -15,6 +14,21 @@ return {
telescope.setup({
defaults = {
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 = {
i = {
["<C-k>"] = actions.move_selection_previous, -- move to prev result

View File

@@ -43,11 +43,21 @@ return {
"yaml",
"ruby",
},
-- Add standard treesitter configuration
highlight = {
enable = true,
additional_vim_regex_highlighting = false,
},
indent = {
enable = true,
},
},
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
require("nvim-treesitter").install(opts.ensure_installed)
-- register and start parsers for filetypes
for _, parser in ipairs(opts.ensure_installed) do
local filetypes = parser -- In this case, parser is the filetype/language name
@@ -56,7 +66,10 @@ return {
vim.api.nvim_create_autocmd({ "FileType" }, {
pattern = filetypes,
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
@@ -87,25 +100,30 @@ return {
return
end
-- Try to get existing parser (helpful check if filetype was returned above)
local parser_configs = require("nvim-treesitter.parsers")
if not parser_configs[parser_name] then
return -- Parser not available, skip silently
local parser_configs = require("nvim-treesitter.parsers")
if not parser_configs[parser_name] then
return -- Parser not available, skip silently
end
local parser_installed = pcall(vim.treesitter.get_parser, bufnr, parser_name)
if not parser_installed then
-- If not installed, install parser synchronously
local ok, _ = pcall(function()
require("nvim-treesitter.install").install(parser_name)
end)
if not ok then
return
end
end
local parser_installed = pcall(vim.treesitter.get_parser, bufnr, parser_name)
-- let's check again
parser_installed = pcall(vim.treesitter.get_parser, bufnr, parser_name)
if not parser_installed then
-- If not installed, install parser synchronously
require("nvim-treesitter").install({ parser_name }):wait(30000)
end
-- let's check again
parser_installed = pcall(vim.treesitter.get_parser, bufnr, parser_name)
if parser_installed then
-- Start treesitter for this buffer
vim.treesitter.start(bufnr, parser_name)
end
if parser_installed then
-- Start treesitter for this buffer
pcall(vim.treesitter.start, bufnr, parser_name)
end
end,
})
end,
@@ -115,7 +133,6 @@ return {
event = "BufRead",
dependencies = {
"nvim-treesitter/nvim-treesitter",
event = "BufRead",
},
opts = {
multiwindow = true,
@@ -124,6 +141,7 @@ return {
{
"nvim-treesitter/nvim-treesitter-textobjects",
branch = "main",
dependencies = { "nvim-treesitter/nvim-treesitter" },
keys = {
{
"af",