From 640176cad22ebcf8f98396202df6b2d3ffc1c2eb Mon Sep 17 00:00:00 2001 From: alzalia1 Date: Sun, 17 Aug 2025 17:42:12 +0200 Subject: [PATCH] fix: better fold --- lazy-lock.json | 3 ++- lua/configs/conform.lua | 32 +++++++++++++++++------------ lua/custom/configs/highlight.lua | 10 --------- lua/custom/plugins/nvim-origami.lua | 13 ------------ lua/custom/plugins/nvim-ufo.lua | 20 ++++++++++++++++++ lua/mappings.lua | 12 ++--------- lua/options.lua | 2 ++ 7 files changed, 45 insertions(+), 47 deletions(-) delete mode 100644 lua/custom/configs/highlight.lua delete mode 100644 lua/custom/plugins/nvim-origami.lua create mode 100644 lua/custom/plugins/nvim-ufo.lua diff --git a/lazy-lock.json b/lazy-lock.json index f02efa8..cad6819 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -27,11 +27,12 @@ "nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" }, "nvim-jdtls": { "branch": "master", "commit": "4d77ff02063cf88963d5cf10683ab1fd15d072de" }, "nvim-lspconfig": { "branch": "master", "commit": "b0caeef0d835fbe19df6ad71dbc4345eaaea649c" }, - "nvim-origami": { "branch": "main", "commit": "7601195576615ba209d79f3dccc764f82d802b5c" }, "nvim-tree.lua": { "branch": "master", "commit": "f0e9951778802526b14c934f7bf746e1e0ae5ed0" }, "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, + "nvim-ufo": { "branch": "main", "commit": "d31e2a9fd572a25a4d5011776677223a8ccb7e35" }, "nvim-web-devicons": { "branch": "master", "commit": "c2599a81ecabaae07c49ff9b45dcd032a8d90f1a" }, "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, + "promise-async": { "branch": "main", "commit": "119e8961014c9bfaf1487bf3c2a393d254f337e2" }, "telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" }, "todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" }, "ui": { "branch": "v3.0", "commit": "af4407decaf6528cb21a7b0fd8925664c8e573c0" }, diff --git a/lua/configs/conform.lua b/lua/configs/conform.lua index 0d56be6..b466dd9 100644 --- a/lua/configs/conform.lua +++ b/lua/configs/conform.lua @@ -1,18 +1,24 @@ local options = { - formatters_by_ft = { - lua = { "stylua" }, - css = { "prettier" }, - html = { "prettier" }, - typescript = { "prettier" }, - typescriptreact = { "prettier" }, - javascript = { "prettier" }, - javascriptreact = { "prettier" }, - }, + formatters_by_ft = { + lua = { "stylua" }, + css = { "prettier" }, + html = { "prettier" }, + typescript = { "prettier" }, + typescriptreact = { "prettier" }, + javascript = { "prettier" }, + javascriptreact = { "prettier" }, + }, - format_on_save = { - timeout_ms = 500, - lsp_fallback = true, - }, + format_on_save = { + timeout_ms = 500, + lsp_fallback = true, + }, + + formatters = { + prettier = { + append_args = { "--tab-width", "4" }, + }, + }, } return options diff --git a/lua/custom/configs/highlight.lua b/lua/custom/configs/highlight.lua deleted file mode 100644 index f79b168..0000000 --- a/lua/custom/configs/highlight.lua +++ /dev/null @@ -1,10 +0,0 @@ -local highlight = { - "CatppuccinRed", - "CatppuccinPeach", - "CatppuccinYellow", - "CatppuccinGreen", - "CatppuccinBlue", - "CatppuccinPurple", -} - -return highlight diff --git a/lua/custom/plugins/nvim-origami.lua b/lua/custom/plugins/nvim-origami.lua deleted file mode 100644 index abac4b0..0000000 --- a/lua/custom/plugins/nvim-origami.lua +++ /dev/null @@ -1,13 +0,0 @@ -return { - "chrisgrieser/nvim-origami", - event = "VeryLazy", - opts = { - foldKeymaps = { setup = false }, - }, -- needed even when using default config - - -- recommended: disable vim's auto-folding - init = function() - vim.opt.foldlevel = 99 - vim.opt.foldlevelstart = 99 - end, -} diff --git a/lua/custom/plugins/nvim-ufo.lua b/lua/custom/plugins/nvim-ufo.lua new file mode 100644 index 0000000..0745b11 --- /dev/null +++ b/lua/custom/plugins/nvim-ufo.lua @@ -0,0 +1,20 @@ +return { + "kevinhwang91/nvim-ufo", + event = "BufReadPost", + dependencies = { + "kevinhwang91/promise-async", + "nvim-treesitter/nvim-treesitter", + }, + init = function() + vim.o.foldenable = true + vim.o.foldcolumn = "auto:9" + vim.o.foldlevel = 99 + vim.o.foldlevelstart = 99 + vim.o.fillchars = "eob: ,fold: ,foldopen:,foldsep:│,foldclose:" + end, + opts = { + provider_selector = function() + return { "treesitter", "indent" } + end, + }, +} diff --git a/lua/mappings.lua b/lua/mappings.lua index 5c74ee1..e2d5d23 100644 --- a/lua/mappings.lua +++ b/lua/mappings.lua @@ -15,16 +15,8 @@ map("n", "K", "Lspsaga hover_doc", { desc = "Displays doc" }) -- toogle terminal map("n", "", function() - term.toggle() + term.toggle() end) map("t", "", function() - term.toggle() -end) - --- folds -map("n", "", function() - require("origami").h() -end) -map("n", "", function() - require("origami").l() + term.toggle() end) diff --git a/lua/options.lua b/lua/options.lua index 7d62dbe..9b74d40 100644 --- a/lua/options.lua +++ b/lua/options.lua @@ -4,3 +4,5 @@ require "nvchad.options" local o = vim.o o.shiftwidth = 4 o.tabstop = 4 + +-- vim.wo.number = true