diff --git a/config/nvim/lua/custom/plugins/init.lua b/config/nvim/lua/custom/plugins/init.lua index 6b865a6..ef22920 100644 --- a/config/nvim/lua/custom/plugins/init.lua +++ b/config/nvim/lua/custom/plugins/init.lua @@ -3,6 +3,14 @@ -- -- See the kickstart.nvim README for more information return { + { + 'mgoral/vim-bw', + url = 'https://git.goral.net.pl/mgoral/vim-bw.git', + priority = 1000, + config = function () + vim.cmd.colorscheme 'bw-onedark' + end + }, { 'joaodubas/gitlinker.nvim', config = function () @@ -24,6 +32,65 @@ return { }) end }, + 'nvim-treesitter/nvim-treesitter-context', + { + 'kevinhwang91/nvim-ufo', + dependencies = { 'kevinhwang91/promise-async' }, + event = 'BufRead', + keys = function () + local ufo = require('ufo') + return { + { 'zR', ufo.openAllFolds, { desc = "Open all folds" } }, + { 'zM', ufo.closeAllFolds, { desc = "Close all folds" } }, + { 'zr', ufo.openFoldsExceptKinds, { desc = "Open fold" } }, + { 'zm', ufo.closeFoldsWith, { desc = "Close fold" } }, + } + end, + opts = function () + local handler = function (virtText, lnum, endLnum, width, truncate) + local newVirtText = {} + local suffix = (' 󰁂 %d '):format(endLnum - lnum) + local sufWidth = vim.fn.strdisplaywidth(suffix) + local targetWidth = width - sufWidth + local curWidth = 0 + for _, chunk in ipairs(virtText) do + local chunkText = chunk[1] + local chunkWidth = vim.fn.strdisplaywidth(chunkText) + if targetWidth > curWidth + chunkWidth then + table.insert(newVirtText, chunk) + else + chunkText = truncate(chunkText, targetWidth - curWidth) + local hlGroup = chunk[2] + table.insert(newVirtText, {chunkText, hlGroup}) + chunkWidth = vim.fn.strdisplaywidth(chunkText) + -- str width returned from truncate() may less than 2nd argument, need padding + if curWidth + chunkWidth < targetWidth then + suffix = suffix .. (' '):rep(targetWidth - curWidth - chunkWidth) + end + break + end + curWidth = curWidth + chunkWidth + end + table.insert(newVirtText, { suffix, 'MoreMsg' }) + return newVirtText + end + + return { + fold_virt_text_handler = handler, + provider_selector = function (_, _, _) + return { 'treesitter', 'indent' } + end + } + end, + }, + { + 'stevearc/oil.nvim', + dependencies = { "nvim-tree/nvim-web-devicons" }, + keys = { + { '-', 'Oil', desc = "Open parent directory" }, + }, + opts = {}, + }, { 'rest-nvim/rest.nvim', dependencies = { 'nvim-lua/plenary.nvim' }, @@ -69,7 +136,6 @@ return { } end }, - 'nvim-treesitter/nvim-treesitter-context', { 'akinsho/toggleterm.nvim', opts = { @@ -110,12 +176,4 @@ return { } end }, - { - 'stevearc/oil.nvim', - dependencies = { "nvim-tree/nvim-web-devicons" }, - keys = { - { '-', 'Oil', desc = "Open parent directory" }, - }, - opts = {}, - }, } diff --git a/patch/kickstart.nvim/updates.patch b/patch/kickstart.nvim/updates.patch index 8209164..91e9eb5 100644 --- a/patch/kickstart.nvim/updates.patch +++ b/patch/kickstart.nvim/updates.patch @@ -1,8 +1,41 @@ diff --git a/init.lua b/init.lua -index 1ff16af..2ef9591 100644 +index 6c6ae02..233e6b1 100644 --- a/init.lua +++ b/init.lua -@@ -266,7 +266,7 @@ require('lazy').setup({ +@@ -189,19 +189,19 @@ require('lazy').setup({ + }, + }, + +- { +- -- Theme inspired by Atom +- 'navarasu/onedark.nvim', +- priority = 1000, +- lazy = false, +- config = function() +- require('onedark').setup { +- -- Set a style preset. 'dark' is default. +- style = 'dark', -- dark, darker, cool, deep, warm, warmer, light +- } +- require('onedark').load() +- end, +- }, ++ -- { ++ -- -- Theme inspired by Atom ++ -- 'navarasu/onedark.nvim', ++ -- priority = 1000, ++ -- lazy = false, ++ -- config = function() ++ -- require('onedark').setup { ++ -- -- Set a style preset. 'dark' is default. ++ -- style = 'dark', -- dark, darker, cool, deep, warm, warmer, light ++ -- } ++ -- require('onedark').load() ++ -- end, ++ -- }, + + { + -- Set lualine as statusline +@@ -271,7 +271,7 @@ require('lazy').setup({ -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. -- -- For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins @@ -11,7 +44,7 @@ index 1ff16af..2ef9591 100644 }, {}) -- [[ Setting options ]] -@@ -276,11 +276,12 @@ require('lazy').setup({ +@@ -281,11 +281,12 @@ require('lazy').setup({ -- Set highlight on search vim.o.hlsearch = false @@ -27,22 +60,22 @@ index 1ff16af..2ef9591 100644 -- Sync clipboard between OS and Neovim. -- Remove this option if you want your OS clipboard to remain independent. -@@ -310,6 +311,14 @@ vim.o.completeopt = 'menuone,noselect' +@@ -315,6 +316,14 @@ vim.o.completeopt = 'menuone,noselect' -- NOTE: You should make sure your terminal supports this vim.o.termguicolors = true +-- Set foldmethod +-- See `:help foldmethod` -+vim.opt.foldmethod = 'expr' -+vim.opt.foldexpr = 'v:lua.vim.treesitter.foldexpr()' -+vim.opt.foldnestmax = 5 -+vim.opt.foldlevel = 1 -+vim.opt.foldenable = false ++vim.o.foldcolumn = '1' ++vim.o.foldlevel = 99 ++vim.o.foldlevelstart = 99 ++vim.o.foldenable = true ++vim.o.fillchars = [[eob: ,fold: ,foldopen:,foldsep: ,foldclose:]] + -- [[ Basic Keymaps ]] -- Keymaps for better default experience -@@ -423,8 +432,31 @@ vim.keymap.set('n', 'sr', require('telescope.builtin').resume, { desc = +@@ -428,8 +437,31 @@ vim.keymap.set('n', 'sr', require('telescope.builtin').resume, { desc = vim.defer_fn(function() require('nvim-treesitter.configs').setup { -- Add languages to be installed here that you want installed for treesitter @@ -76,7 +109,7 @@ index 1ff16af..2ef9591 100644 -- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!) auto_install = false, -- Install languages synchronously (only applied to `ensure_installed`) -@@ -568,13 +600,16 @@ require('mason-lspconfig').setup() +@@ -573,13 +605,16 @@ require('mason-lspconfig').setup() -- If you want to override the default filetypes that your language server will attach to you can -- define the property 'filetypes' to the map in question. local servers = { @@ -100,7 +133,7 @@ index 1ff16af..2ef9591 100644 lua_ls = { Lua = { workspace = { checkThirdParty = false }, -@@ -583,6 +618,8 @@ local servers = { +@@ -588,6 +623,8 @@ local servers = { -- diagnostics = { disable = { 'missing-fields' } }, }, }, @@ -109,7 +142,7 @@ index 1ff16af..2ef9591 100644 } -- Setup neovim lua configuration -@@ -601,12 +638,23 @@ mason_lspconfig.setup { +@@ -606,12 +643,23 @@ mason_lspconfig.setup { mason_lspconfig.setup_handlers { function(server_name)