Auto sync: 2025-08-18 15:31:09 (5 files changed)
M lazy-lock.json M lua/custom/configs/lspconfig.lua D lua/custom/language_specific_commands/markdown.lua A lua/custom/language_specific_commands/markdown_and_tex.lua M lua/custom/plugins.lua
This commit is contained in:
parent
c2872eae66
commit
4028ceade0
@ -15,6 +15,8 @@
|
|||||||
"indent-blankline.nvim": { "branch": "master", "commit": "b7aa0aed55887edfaece23f7b46ab22232fc8741" },
|
"indent-blankline.nvim": { "branch": "master", "commit": "b7aa0aed55887edfaece23f7b46ab22232fc8741" },
|
||||||
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
|
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
|
||||||
"mason.nvim": { "branch": "main", "commit": "7dc4facca9702f95353d5a1f87daf23d78e31c2a" },
|
"mason.nvim": { "branch": "main", "commit": "7dc4facca9702f95353d5a1f87daf23d78e31c2a" },
|
||||||
|
"nabla.nvim": { "branch": "master", "commit": "9b69b709063ccf40ac36fabb4fff7d90b3736475" },
|
||||||
|
"neo-tree.nvim": { "branch": "main", "commit": "bbeda076c8a2e7d16614287cd70239f577e5bf55" },
|
||||||
"nvim-autopairs": { "branch": "master", "commit": "23320e75953ac82e559c610bec5a90d9c6dfa743" },
|
"nvim-autopairs": { "branch": "master", "commit": "23320e75953ac82e559c610bec5a90d9c6dfa743" },
|
||||||
"nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" },
|
"nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" },
|
||||||
"nvim-colorizer.lua": { "branch": "master", "commit": "51cf7c995ed1eb6642aecf19067ee634fa1b6ba2" },
|
"nvim-colorizer.lua": { "branch": "master", "commit": "51cf7c995ed1eb6642aecf19067ee634fa1b6ba2" },
|
||||||
|
|||||||
@ -34,5 +34,5 @@ lspconfig.marksman.setup {
|
|||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
filetypes = { "markdown" },
|
filetypes = { "markdown" },
|
||||||
require "custom.language_specific_commands.markdown",
|
require "custom.language_specific_commands.markdown_and_tex",
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,27 +0,0 @@
|
|||||||
vim.keymap.set(
|
|
||||||
"n",
|
|
||||||
"<leader>mi",
|
|
||||||
"<M-i><!The quick brown fox jumps over the lazy dog. The dog takes a nice nap. :)>",
|
|
||||||
{ desc = "Print a standard 80 character string for Markdown formatting." }
|
|
||||||
)
|
|
||||||
-- Create an autocommand for markdown filetype using Neovim's Lua API
|
|
||||||
vim.api.nvim_create_autocmd("FileType", {
|
|
||||||
pattern = { "markdown", "tex" },
|
|
||||||
-- Only for files with filetype 'markdown'
|
|
||||||
callback = function()
|
|
||||||
-- Enable spell checking locally for the buffer
|
|
||||||
vim.opt_local.spell = true
|
|
||||||
-- Optionally, set the spell language (e.g., US English)
|
|
||||||
vim.opt_local.spelllang = "en_us"
|
|
||||||
-- You can add additional buffer-local settings here if needed
|
|
||||||
-- Set the conceal level to 2 to render links in a pretty way
|
|
||||||
vim.wo.conceallevel = 2
|
|
||||||
-- and set it to conceal in normal and command modes
|
|
||||||
vim.wo.concealcursor = "nc"
|
|
||||||
-- wrap text at 80 chars and show a visual line guide
|
|
||||||
vim.opt_local.textwidth = 60
|
|
||||||
vim.opt_local.formatoptions:append "t"
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
print "Markdown Keybinds Loaded"
|
|
||||||
71
lua/custom/language_specific_commands/markdown_and_tex.lua
Normal file
71
lua/custom/language_specific_commands/markdown_and_tex.lua
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
-- Efficient Markdown/TeX + Nabla integration
|
||||||
|
local grp = vim.api.nvim_create_augroup("MarkdownTexWithNabla", { clear = true })
|
||||||
|
|
||||||
|
-- 1) Set buffer-local stuff ONCE (spell, textwidth, formatoptions, keymaps) on FileType
|
||||||
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
|
group = grp,
|
||||||
|
pattern = { "markdown", "tex" },
|
||||||
|
callback = function(args)
|
||||||
|
local ft = vim.bo[args.buf].filetype
|
||||||
|
-- Buffer-local basics (only once per buffer)
|
||||||
|
vim.opt_local.spell = true
|
||||||
|
vim.opt_local.spelllang = "en_us"
|
||||||
|
vim.opt_local.formatoptions:append "t"
|
||||||
|
|
||||||
|
if ft == "markdown" then
|
||||||
|
vim.opt_local.textwidth = 60
|
||||||
|
else -- tex
|
||||||
|
vim.opt_local.textwidth = 80
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Buffer-local Nabla keymaps (define once)
|
||||||
|
if not vim.b[args.buf].nabla_keys then
|
||||||
|
local ok_nabla, nabla = pcall(require, "nabla")
|
||||||
|
if ok_nabla then
|
||||||
|
local bufopts = { buffer = args.buf, silent = true }
|
||||||
|
vim.keymap.set("n", "<leader>mnve", function()
|
||||||
|
nabla.enable_virt()
|
||||||
|
end, vim.tbl_extend("force", bufopts, { desc = "Nabla: render math (virtual text)" }))
|
||||||
|
vim.keymap.set("n", "<leader>mnvd", function()
|
||||||
|
nabla.disable_virt()
|
||||||
|
end, vim.tbl_extend("force", bufopts, { desc = "Nabla: clear rendering" }))
|
||||||
|
vim.keymap.set("n", "<leader>mnp", function()
|
||||||
|
nabla.popup()
|
||||||
|
end, vim.tbl_extend("force", bufopts, { desc = "Nabla: popup under cursor" }))
|
||||||
|
-- Enable once initially and mark as active
|
||||||
|
nabla.enable_virt()
|
||||||
|
vim.b[args.buf].nabla_enabled = true
|
||||||
|
end
|
||||||
|
vim.b[args.buf].nabla_keys = true
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- 2) Window-local conceal settings (apply per window that views the buffer)
|
||||||
|
vim.api.nvim_create_autocmd("BufWinEnter", {
|
||||||
|
group = grp,
|
||||||
|
callback = function(args)
|
||||||
|
local ft = vim.bo[args.buf].filetype
|
||||||
|
if ft ~= "markdown" and ft ~= "tex" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
-- Window-local: set each time the buffer is shown in a window
|
||||||
|
vim.wo[args.win].conceallevel = 2
|
||||||
|
vim.wo[args.win].concealcursor = "ic" -- reveal on hover in normal mode
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- 3) Re-enable Nabla only after writes (some tools clear virt text on save)
|
||||||
|
vim.api.nvim_create_autocmd("BufWritePost", {
|
||||||
|
group = grp,
|
||||||
|
pattern = { "*.md", "*.mdx", "*.markdown", "*.tex", "*.ltx" },
|
||||||
|
callback = function(args)
|
||||||
|
if not vim.b[args.buf].nabla_enabled then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local ok_nabla, nabla = pcall(require, "nabla")
|
||||||
|
if ok_nabla then
|
||||||
|
nabla.enable_virt()
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
@ -19,6 +19,9 @@ local plugins = {
|
|||||||
"stylua",
|
"stylua",
|
||||||
"clang-format",
|
"clang-format",
|
||||||
"fourmolu",
|
"fourmolu",
|
||||||
|
|
||||||
|
--- other
|
||||||
|
"tree-sitter-cli",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -186,6 +189,12 @@ local plugins = {
|
|||||||
vim.g.vimtex_view_method = "zathura"
|
vim.g.vimtex_view_method = "zathura"
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"jbyuki/nabla.nvim",
|
||||||
|
lazy = true,
|
||||||
|
ft = { "markdown", "tex" }, -- load only when editing Markdown/TeX
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
return plugins
|
return plugins
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user