comparison runtime/doc/fold.txt @ 30634:f68f43043842

Update runtime files Commit: https://github.com/vim/vim/commit/f269eabc6c4f5bdcef989cd5b4b95ba8ccaa4d8a Author: Bram Moolenaar <Bram@vim.org> Date: Mon Oct 3 18:04:35 2022 +0100 Update runtime files
author Bram Moolenaar <Bram@vim.org>
date Mon, 03 Oct 2022 19:15:04 +0200
parents 586b5b3aacf9
children 15c80d8bc515
comparison
equal deleted inserted replaced
30633:a7462ca00059 30634:f68f43043842
1 *fold.txt* For Vim version 9.0. Last change: 2022 Jan 22 1 *fold.txt* For Vim version 9.0. Last change: 2022 Oct 01
2 2
3 3
4 VIM REFERENCE MANUAL by Bram Moolenaar 4 VIM REFERENCE MANUAL by Bram Moolenaar
5 5
6 6
501 501
502 :set foldtext=v:folddashes.substitute(getline(v:foldstart),'/\\*\\\|\\*/\\\|{{{\\d\\=','','g') 502 :set foldtext=v:folddashes.substitute(getline(v:foldstart),'/\\*\\\|\\*/\\\|{{{\\d\\=','','g')
503 503
504 This shows the first line of the fold, with "/*", "*/" and "{{{" removed. 504 This shows the first line of the fold, with "/*", "*/" and "{{{" removed.
505 Note the use of backslashes to avoid some characters to be interpreted by the 505 Note the use of backslashes to avoid some characters to be interpreted by the
506 ":set" command. It's simpler to define a function and call that: > 506 ":set" command. It is much simpler to define a function and call it: >
507 507
508 :set foldtext=MyFoldText() 508 :set foldtext=MyFoldText()
509 :function MyFoldText() 509 :function MyFoldText()
510 : let line = getline(v:foldstart) 510 : let line = getline(v:foldstart)
511 : let sub = substitute(line, '/\*\|\*/\|{{{\d\=', '', 'g') 511 : let sub = substitute(line, '/\*\|\*/\|{{{\d\=', '', 'g')
512 : return v:folddashes .. sub 512 : return v:folddashes .. sub
513 :endfunction 513 :endfunction
514
515 The advantage of using a function call without arguments is that it is faster,
516 see |expr-option-function|.
514 517
515 Evaluating 'foldtext' is done in the |sandbox|. The current window is set to 518 Evaluating 'foldtext' is done in the |sandbox|. The current window is set to
516 the window that displays the line. The context is set to the script where the 519 the window that displays the line. The context is set to the script where the
517 option was last set. 520 option was last set.
518 521