This goes in: /.config/nvim/lua/user/plugins.lua (to install pretty-fold , look at lower line )
-- Install your plugins here return packer.startup(function(use) -- My plugins here use 'wbthomason/packer.nvim' -- Have packer manage itself use "nvim-lua/plenary.nvim" -- Useful lua functions used ny lots of plugins -- Automatically set up your configuration after cloning packer.nvim -- Put this at the end after all plugins if PACKER_BOOTSTRAP then require('packer').sync() end use { 'anuvyklack/pretty-fold.nvim', config = function() require('pretty-fold').setup() end } use { 'anuvyklack/fold-preview.nvim', requires = 'anuvyklack/keymap-amend.nvim', config = function() require('fold-preview').setup({ -- Your configuration goes here. -- }) end } end)
config for pretty-fold , need to have both in order to work
and then in init.vim set this
set foldmethod=indent nnoremap zf <cmd>setl fdm&<CR>zf xnoremap zf <cmd>setl fdm&<CR>zf lua require("user.plugins") set foldcolumn=1 highlight FoldColumn ctermbg=235 guibg=#262626 highlight FoldColumn ctermfg=white guifg=white
This is how it looks. Really neat :D
So this means:
za
: open/close the fold under the cursor
zR
: open all folds in the file
zM
: close all folds in the file
zf<motion>
- define your own manual fold, defined by <motion>
when you step the cursor on fold line (block..)
h
- to show a preview
l
- to open fold (same as za
, but more intuitive)
Top comments (0)