GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — FoldText/README.md at master · Konfekt/FoldText

Expand file tree

/

README.md

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
74 lines (58 loc) · 2.24 KB
/

README.md

Copy path

File metadata and controls

74 lines (58 loc) · 2.24 KB
Raw
Copy raw file
Download raw file
Outline
Edit and raw actions

This screenshot

Screenshot

shows a modification of the CustomFoldText function by Christian Brabandt that is more amenable to syntax folds. (Which in turn is a modification of the CustomFoldText function by Greg Sexton).

Usage

The plugin sets foldtext to CustomFoldText(). Each closed fold then shows its first non-blank line, indented by shiftwidth per fold level, and, flush with the right window border, the number of folded lines, absolute and relative to the buffer. The gap in between is filled with blanks; to fill it with another delimiter, such as · or -, set in your vimrc

set foldtext=CustomFoldText('·')

See :help FoldText for details.

Example settings

set foldmethod=syntax

" { Syntax Folding
  let g:vimsyn_folding='af'
  let g:tex_fold_enabled=1
  let g:xml_syntax_folding = 1
  let g:clojure_fold = 1
  let ruby_fold = 1
  let perl_fold = 1
  let perl_fold_blocks = 1
" }

set foldenable
set foldlevel=0
set foldlevelstart=0
" specifies for which commands a fold will be opened
set foldopen=block,hor,insert,jump,mark,percent,quickfix,search,tag,undo

nnoremap <silent> zr zr:<c-u>setlocal foldlevel?<CR>
nnoremap <silent> zm zm:<c-u>setlocal foldlevel?<CR>

nnoremap <silent> zR zR:<c-u>setlocal foldlevel?<CR>
nnoremap <silent> zM zM:<c-u>setlocal foldlevel?<CR>

" Change Option Folds
nnoremap zi  :<c-u>call <SID>ToggleFoldcolumn(1)<CR>
nnoremap coz :<c-u>call <SID>ToggleFoldcolumn(0)<CR>
nmap     cof coz

function! s:ToggleFoldcolumn(fold)
  if &foldcolumn
    let w:foldcolumn = &foldcolumn
    silent setlocal foldcolumn=0
    if a:fold | silent setlocal nofoldenable | endif
  else
      if exists('w:foldcolumn') && (w:foldcolumn!=0)
        silent let &l:foldcolumn=w:foldcolumn
      else
        silent setlocal foldcolumn=4
      endif
      if a:fold | silent setlocal foldenable | endif
  endif
  setlocal foldcolumn?
endfunction

Tests

Run test/run.sh to run the test suite headless in Vim and, if installed, Neovim.

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.