feat: add code folding

This commit is contained in:
Stevan Freeborn
2025-03-08 18:42:12 -06:00
parent 75d4a6aa01
commit 785524fa68
3 changed files with 40 additions and 25 deletions
+24 -10
View File
@@ -67,16 +67,16 @@ return {
lspconfig.ts_ls.setup({
capabilities = capabilities,
init_options = {
plugins = {
{
name = "@vue/typescript-plugin",
location = vue_language_server,
languages = { "vue" },
}
}
},
filetypes = { "typescript", "javascript", "javascriptreact", "typescriptreact", "vue" }
init_options = {
plugins = {
{
name = "@vue/typescript-plugin",
location = vue_language_server,
languages = { "vue" },
},
},
},
filetypes = { "typescript", "javascript", "javascriptreact", "typescriptreact", "vue" },
})
lspconfig.html.setup({
@@ -160,6 +160,20 @@ return {
)
end
vim.api.nvim_create_autocmd({ "FileType" }, {
callback = function()
-- check if treesitter has parser
if require("nvim-treesitter.parsers").has_parser() then
-- use treesitter folding
vim.opt.foldmethod = "expr"
vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
else
-- use alternative foldmethod
vim.opt.foldmethod = "syntax"
end
end,
})
vim.keymap.set(
"n",
"<leader>ca",
+1
View File
@@ -13,6 +13,7 @@ vim.g.mapleader = " "
vim.g.maplocalleader = "\\"
vim.opt.wrap = false
vim.opt.shadafile = "NONE"
vim.opt.foldlevelstart = 99
vim.keymap.set("n", "<leader>y", '"+y', { desc = "Yank to system clipboard" })
vim.keymap.set("v", "<leader>y", '"+y', { desc = "Yank to system clipboard" })