# Tag Info

0

Instead of using the zf Normal mode command, it's easier if you use the :fold Ex command, which takes a range and fits naturally in a function. So you can easily fold the block starting on the first line that has Copyright and going up to the next line with CONNECTION using the following: function! FoldLicense() silent! /Copyright/,/CONNECTION/fold ...

4

You might want to consider adopting the vimtex plug-in, which improves support for TeX files in Vim. Among its features, it supports custom folding, which is able to recognize LaTeX blocks delimited with \begin{...} and \end{...} and use them to define folding. Furthermore, it recognizes {{{ and }}} but only within comments. See vimtex's documentation under :...

0

A more general approach (not just for QuickNotes but for all files) would be as follows: " Save and restore manual folds when we exit a file augroup SaveManualFolds autocmd! au BufWinLeave, BufLeave ?* silent! mkview au BufWinEnter ?* silent! loadview augroup END For more information, see the view-sessions, section with includes ...

0

Catch BufWinEnter and set foldlevel appropriately augroup adjust_fold | au! autocmd BufWinEnter * let &l:foldlevel = line('$') > 100 ? 0 : line('$') > winheight(0) ? 1 : 99 augroup end

Top 50 recent answers are included