From 92b654756e6cfbed6321baaf5c322361f1b03304 Mon Sep 17 00:00:00 2001 From: ray Date: Sun, 24 Jul 2022 17:07:15 +0100 Subject: [PATCH] nvim-ufo cold folding --- init.plugins.vim | 4 ++++ lua/init-lsp.lua | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/init.plugins.vim b/init.plugins.vim index ba0c85e..ab8c046 100644 --- a/init.plugins.vim +++ b/init.plugins.vim @@ -10,6 +10,10 @@ call plug#begin('~/.config/nvim/bundle') " https://github.com/simrat39/rust-tools.nvim Plug 'simrat39/rust-tools.nvim' +" https://github.com/kevinhwang91/ +Plug 'kevinhwang91/promise-async' +Plug 'kevinhwang91/nvim-ufo' + " colorscheme (temporary) Plug 'https://github.com/marko-cerovac/material.nvim', { 'branch': 'main' } let g:material_style = 'lighter' diff --git a/lua/init-lsp.lua b/lua/init-lsp.lua index e9ba36a..97d12cd 100644 --- a/lua/init-lsp.lua +++ b/lua/init-lsp.lua @@ -113,6 +113,11 @@ end local capabilities = vim.lsp.protocol.make_client_capabilities() capabilities = require('cmp_nvim_lsp').update_capabilities(capabilities) capabilities.textDocument.completion.completionItem.snippetSupport = true +-- nvim-ufo +capabilities.textDocument.foldingRange = { + dynamicRegistration = false, + lineFoldingOnly = true +} for _, lsp in ipairs(servers) do nvim_lsp[lsp].setup { @@ -122,6 +127,12 @@ for _, lsp in ipairs(servers) do } end +-- nvim-ufo +require('ufo').setup() +vim.keymap.set('n', 'gH', function() + local winid = require('ufo').peekFoldedLinesUnderCursor() +end) + local runtime_path = vim.split(package.path, ';') table.insert(runtime_path, "lua/?.lua") table.insert(runtime_path, "lua/?/init.lua")