the treesitter code folding was not working for my needs.

Removed it, restored the old indent+custom foldtext method.
This commit is contained in:
Gabe Venberg 2022-02-18 16:50:42 -06:00
parent 0116f9e845
commit 43b15731f0
3 changed files with 16 additions and 21 deletions

View file

@ -0,0 +1,9 @@
"TODO: port to LUA!
function! Minimal_foldtext()
let lines_count = v:foldend - v:foldstart + 1
let lines_count_text = '+' . v:folddashes . '| ' . printf("%10S" , lines_count) . ' lines |'
let line_level_text = '| ' . printf("%8S" , 'level ' . v:foldlevel) . ' |'
let fold_text_end = line_level_text . repeat('-',8)
let fold_text_length = strlen(lines_count_text . fold_text_end) + &foldcolumn
return lines_count_text . repeat('-' , winwidth(0) - fold_text_length - 4) . fold_text_end
endfunction

View file

@ -55,17 +55,14 @@ require('cmp-lsp')
opt.hlsearch=true
opt.incsearch=true
--foling stuff
opt.foldmethod='expr'
opt.foldexpr='nvim_treesitter#foldexpr()'
opt.foldlevelstart=5
-- cmd([[source ~/.config/nvim/foldtext.vimrc]])
-- opt.foldmethod='indent'
-- opt.foldtext='minimal_foldtext()'
-- opt.fillchars='stl:=,stlnc: ,vert:|,fold:-'
-- opt.foldcolumn='4'
-- opt.foldenable=true
-- opt.foldminlines=2
-- opt.foldignore=''
cmd([[source ~/.config/nvim/foldtext.vimrc]])
opt.foldmethod='indent'
opt.foldtext='minimal_foldtext()'
opt.fillchars='stl:=,stlnc: ,vert:|,fold:-'
opt.foldcolumn='4'
opt.foldenable=true
opt.foldignore=''
--leader key is set through a variable, for some reason.
vim.g.mapleader = ';'

View file

@ -218,17 +218,6 @@ return require('packer').startup(function(use)
--language specific tools.
use{'eddiebergman/nvim-treesitter-pyfold',
config=function ()
require('nvim-treesitter.configs').setup {
pyfold = {
enable = true,
custom_foldtext = true -- Sets provided foldtext on window where module is active
}
}
end
}
use 'simrat39/rust-tools.nvim'
if Packer_Bootstrap then