comparison runtime/doc/options.txt @ 452:01af1008a8d8

updated for version 7.0120
author vimboss
date Sat, 30 Jul 2005 22:43:24 +0000
parents 3709cf52b9b5
children d9d38102399f
comparison
equal deleted inserted replaced
451:f6b8170c9c9b 452:01af1008a8d8
1 *options.txt* For Vim version 7.0aa. Last change: 2005 Jul 29 1 *options.txt* For Vim version 7.0aa. Last change: 2005 Jul 30
2 2
3 3
4 VIM REFERENCE MANUAL by Bram Moolenaar 4 VIM REFERENCE MANUAL by Bram Moolenaar
5 5
6 6
1582 1582
1583 *'completefunc'* *'cfu'* 1583 *'completefunc'* *'cfu'*
1584 'completefunc' 'cfu' string (default: empty) 1584 'completefunc' 'cfu' string (default: empty)
1585 local to buffer 1585 local to buffer
1586 {not in Vi} 1586 {not in Vi}
1587 This option specifies a completion function to be used for CTRL-X 1587 {not available when compiled without the +eval
1588 CTRL-U. The function will be invoked with four arguments: 1588 or +insert_expand feature}
1589 a:line the text of the current line 1589 This option specifies a function to be used for CTRL-X CTRL-U
1590 completion. |i_CTRL-X_CTRL-U|
1591
1592 The function will be invoked with three arguments:
1593 a:findstart either 1 or 0
1594 a:col column in the cursor line where the completion ends,
1595 first column is zero
1590 a:base the text with which matches should match 1596 a:base the text with which matches should match
1591 a:col column in a:line where the cursor is, first column is 1597
1592 zero
1593 a:findstart either 1 or 0
1594 When the a:findstart argument is 1, the function must return the 1598 When the a:findstart argument is 1, the function must return the
1595 column of where the completion starts. It must be a number between 1599 column of where the completion starts. It must be a number between
1596 zero and "a:col". This involves looking at the characters in a:line 1600 zero and "a:col". This involves looking at the characters in the
1597 before column a:col and include those characters that could be part of 1601 cursor line before column a:col and include those characters that
1598 the completed item. 1602 could be part of the completed item. The text between this column and
1599 When the a:findstart argument is 0 the function must return a string 1603 a:col will be replaced with the matches. Return -1 if no completion
1600 with the matching words, separated by newlines. When there are no 1604 can be done.
1601 matches return an empty string. 1605
1606 When the a:findstart argument is 0 the function must return a List
1607 with the matching words. These matches should include the "a:base"
1608 text. When there are no matches return an empty List.
1609
1610 The function must not move the cursor!
1611
1602 An example that completes the names of the months: > 1612 An example that completes the names of the months: >
1603 fun! CompleteMonths(line, base, col, findstart) 1613 fun! CompleteMonths(findstart, col, base)
1604 if a:findstart 1614 if a:findstart
1605 " locate start column of word 1615 " locate the start of the word
1616 let line = getline('.')
1606 let start = a:col 1617 let start = a:col
1607 while start > 0 && a:line[start - 1] =~ '\a' 1618 while start > 0 && line[start - 1] =~ '\a'
1608 let start = start - 1 1619 let start -= 1
1609 endwhile 1620 endwhile
1610 return start 1621 return start
1611 else 1622 else
1612 " find months matching with "a:base" 1623 " find months matching with "a:base"
1613 let res = "Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec" 1624 let res = []
1614 if a:base != '' 1625 for m in split("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec")
1615 let res = substitute(res, '\c\<\(\(' . a:base . '.\{-}\>\)\|.\{-}\>\)', '\2', 'g') 1626 if m =~ '^' . a:base
1616 endif 1627 call add(res, m)
1617 let res = substitute(res, ' \+', "\n", 'g') 1628 endif
1629 endfor
1618 return res 1630 return res
1619 endif 1631 endif
1620 endfun 1632 endfun
1621 set completefunc=CompleteMonths 1633 set completefunc=CompleteMonths
1622 < Note that a substitute() function is used to reduce the list of 1634 <
1623 possible values and remove the ones that don't match the base. The
1624 part before the "\|" matches the base, the part after it is used
1625 when there is no match. The "\2" in the replacement is empty if the
1626 part before the "\|" does not match.
1627 1635
1628 *'confirm'* *'cf'* *'noconfirm'* *'nocf'* 1636 *'confirm'* *'cf'* *'noconfirm'* *'nocf'*
1629 'confirm' 'cf' boolean (default off) 1637 'confirm' 'cf' boolean (default off)
1630 global 1638 global
1631 {not in Vi} 1639 {not in Vi}