From 66954fc1250915614f06b20becd14cfd74944db4 Mon Sep 17 00:00:00 2001 From: Omixxx Date: Tue, 28 Feb 2023 12:45:10 +0100 Subject: [PATCH] update --- init.lua | 8 ++++++-- lua/custom/plugins/folding.lua | 36 ++++++++++++++++++++++++++++++++++ lua/custom/plugins/tabout.lua | 11 +++++++++++ 3 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 lua/custom/plugins/folding.lua create mode 100644 lua/custom/plugins/tabout.lua diff --git a/init.lua b/init.lua index 22f53650..c735eac9 100644 --- a/init.lua +++ b/init.lua @@ -96,7 +96,7 @@ require('lazy').setup({ { 'j-hui/fidget.nvim', opts = {} }, -- Additional lua configuration, makes nvim stuff amazing! - 'folkenvim_set_keymap/neodev.nvim', + 'folke/neodev.nvim', }, }, @@ -130,6 +130,7 @@ require('lazy').setup({ 'navarasu/onedark.nvim', }, + { -- Add indentation guides even on blank lines 'lukas-reineke/indent-blankline.nvim', -- Enable `lukas-reineke/indent-blankline.nvim` @@ -303,7 +304,7 @@ vim.api.nvim_set_keymap('n', 'cb', ':bd', { noremap = true, silent = vim.g.copilot_no_tab_map = true vim.api.nvim_set_keymap("i", "", 'copilot#Accept("")', { silent = true, expr = true }) --- vim.api.nvim_set_keymap('n', ':', 'FineCmdline', { noremap = true }) +vim.api.nvim_set_keymap('n', ':', 'FineCmdline', { noremap = true }) vim.api.nvim_set_keymap('n', 'hs', ':nohlsearch', { noremap = true, silent = true, desc = "toggle of search highlight" }) @@ -562,6 +563,7 @@ require('neodev').setup() local capabilities = vim.lsp.protocol.make_client_capabilities() capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities) + -- Setup mason so it can manage external tooling require('mason').setup() @@ -628,6 +630,8 @@ cmp.setup { { name = 'orgmode' }, }, } + + -- -- The line beneath this is called `modeline`. See `:help modeline` -- vim: ts=2 sts=2 sw=2 et diff --git a/lua/custom/plugins/folding.lua b/lua/custom/plugins/folding.lua new file mode 100644 index 00000000..62d269d6 --- /dev/null +++ b/lua/custom/plugins/folding.lua @@ -0,0 +1,36 @@ +return { + { 'kevinhwang91/nvim-ufo', + dependecies = 'kevinhwang91/promise-async' }, + config = function() + vim.o.foldcolumn = '1' -- '0' is not bad + vim.o.foldlevel = 99 -- Using ufo provider need a large value, feel free to decrease the value + vim.o.foldlevelstart = 99 + vim.o.foldenable = true + vim.opt.foldlevel = 20 + vim.opt.foldmethod = "expr" + vim.opt.foldexpr = "nvim_treesitter#foldexpr()" + + -- Using ufo provider need remap `zR` and `zM`. If Neovim is 0.6.1, remap yourself + vim.keymap.set('n', 'zR', require('ufo').openAllFolds) + vim.keymap.set('n', 'zM', require('ufo').closeAllFolds) + + + -- Option 2: nvim lsp as LSP client + -- Tell the server the capability of foldingRange, + -- Neovim hasn't added foldingRange to default capabilities, users must add it manually + local capabilities = vim.lsp.protocol.make_client_capabilities() + capabilities.textDocument.foldingRange = { + dynamicRegistration = false, + lineFoldingOnly = true + } + local language_servers = require("lspconfig").util.available_servers() -- or list servers manually like {'gopls', 'clangd'} + for _, ls in ipairs(language_servers) do + require('lspconfig')[ls].setup({ + capabilities = capabilities + -- you can add other fields for setting up lsp server in this table + }) + end + require('ufo').setup() + -- + end +} diff --git a/lua/custom/plugins/tabout.lua b/lua/custom/plugins/tabout.lua new file mode 100644 index 00000000..0d3cf07c --- /dev/null +++ b/lua/custom/plugins/tabout.lua @@ -0,0 +1,11 @@ +-- plugin which aim to provide better tabbing experience + +return { + "abecodes/tabout.nvim", + event = "VeryLazy", + dependencies = { + "nvim-treesitter/nvim-treesitter", + "hrsh7th/nvim-cmp", + }, + config = true, +}