frawor / test / fwccompletetests.dat

!complete
:let s:list=['abc', 'ab-c', 'def-ghi', 'adb']
:let s:list2=['abc', 'def-b', 'geh']
:let s:list3=['foo', 'bar', 'baz']
:let s:listr=['\v(', '\v)', 'abc']
:let s:dict={'abc': 1, 'adb': 1, 'aef': 1}
#▶1 Built-in completion functions
#▶2 in
`in list
  @+
  =s:list

  @b
  abc ab-c adb

  @j
  =[]
#▶2 key
`key dict
  @+
  =sort(keys(s:dict))

  @a
  abc adb aef

  @g
  =[]
#▶2 take
`take dict exact
  @+
  =sort(keys(s:dict))

  @a
  abc adb aef

  @g
  =[]
#▶2 either
`either in list, key dict
  @+
  =s:list+sort(keys(s:dict))

  @d
  def-ghi
`either ((in list match /b/), (key dict match /e/))
  @+
  abc ab-c adb aef

`either (in list3, either ((in list match /b/), (key dict match /e/)))
  @+
  foo bar baz abc ab-c adb aef
#▶2 first
`first in list, key dict
  @+
  =s:list

  @d
  def-ghi

  @ae
  aef
#▶2 if
`if match/^a/
+   in dict
+   in list3
  @+
  =s:list3

  @a
  =sort(keys(s:dict))
#▶1 Completion+check composition
\function s:.startswitha(str)
\    return a:str[0] is 'a'
:endfunction

`(in list match /^a/)
  @+
  =filter(copy(s:list), 'v:val[0] is "a"')

`(in list match /^a/ match /d/)
  @+
  =filter(copy(s:list), 'v:val[0] is "a" && stridx(v:val, "d")!=-1')

`(in listr isreg)
  @+
  abc

`(in list ?*startswitha)
  @+
  =filter(copy(s:list), 'v:val[0] is "a"')
#▶1 Different sections
#▶2 {required}
`in list
  @+
  =s:list

  @b+
  =[]
`in list in list2
  @+
  =s:list

  @b+
  =s:list2
#▶2 {optional}
`[in list in list2 [key dict]]
  @+
  =s:list

  @-+
  =s:list2

  @- -+
  =sort(keys(s:dict))

`[in list  in list2] [key dict]
  @+
  =s:list+sort(keys(s:dict))

  @a+
  =s:list2

`[(in list  match /e/)] [(key dict  match /b/]
  @+
  def-ghi abc adb

`[in list [in list2]]
  @+
  =s:list

  @abc+
  =s:list2
#▶2 {prefixes}
`{   abc  in list
+    def  in list2
+   !ghi
+ +2*jkl  key dict in list2}
  @+
  abc def ghi noghi jkl

  @a b+
  abc def ghi noghi jkl

  @j 1 2+
  abc def ghi noghi jkl

  @a+
  =s:list

  @j+
  =sort(keys(s:dict))

  @j 1+
  =s:list2

  @j 1 2 3+
  =s:list2

  @n
  noghi
#▶2 {next}
`+ in list
  @+
  =s:list

  @b+
  =s:list
#▶2 {actions}
`<abc in list
+ dbf in list2
+ gh (in list2  key dict)>
  @+
  abc dbf gh

  @b
  abc dbf

  @a+
  =s:list

  @d+
  =s:list2

  @g+
  =s:list2

  @g a+
  =sort(keys(s:dict))

`<abc in list
+ dbf in list2
+ gh (in list2  key dict)
+ - (key dict  in list)>
  @+
  =["abc", "dbf", "gh"]+sort(keys(s:dict))

  @a+
  =s:list

  @x+
  =s:list

`<abc in list
+ - <def in list2>>
  @+
  abc def

  @d+
  =s:list2

`<abc in list
+ -   +in list2>
  @+
  =["abc"]+s:list2
#▶2 {next}+{actions}
`+ in list
+<abc in list2
+ def ->
  @+
  =s:list+['abc', 'def']

  @a+
  =s:list2

  @abc d+
  =[]
#▶2 {prefixes}+{next}
`{foo in list} + in list2
  @+
  =["foo"]+s:list2

  @foo
  foo

  @d
  def-b

  @foo+
  =s:list
#▶2 {optional}+{next}
`[in list] + in list2
  @+
  =s:list+s:list2

  @abc+
  =s:list2
`[in list [in list2]] + in list3
  @+
  =s:list+s:list3

  @abc+
  =s:list2+s:list3
#▶2 {optional}+{prefixes}
`[in list] {!allfolds}
  @+
  =s:list+["allfolds", "noallfolds"]

  @abc+
  allfolds noallfolds
#▶1 Messages
:let s:_messages={'test': 'Test message'}
`(in list #test match /^a/)
  @+
  =filter(copy(s:list), 'v:val[0] is "a"')

`(#test in list match /^a/)
  @+
  =filter(copy(s:list), 'v:val[0] is "a"')
# vim: cms=#%s fmr=▶,▲ sw=2 ts=2 sts=2 et ft=conf
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.