frawor / test / rtp / plugin / commands.vim

ZyX_I 9bef657 
ZyX_I a3b2878 
































































execute frawor#Setup('0.0', {'@/commands': '0.0'})

W- String + no options
function Abc()
    W$ Abc
endfunction
let s:_functions+=['Abc']
call s:_f.command.add('Abc', 'call Abc()', {})
Abc

W- nargs
call s:_f.command.add('WF', 'call WriteFile(<q-args>)', {'nargs': '+'})
try
    WF
catch
    call WriteFile('caught '.matchstr(v:exception, 'E\d\+'))
endtry
WF$ WF

W- range
call s:_f.command.add('Def', 'call WriteFile(<line1>, <line2>)', {'range': '%'})
if line('$')==1
    call append('.', ['', '', ''])
endif
Def
.Def

W- count
call s:_f.command.add('Ghi', 'call WriteFile(<line1>, <line2>)',{'count': '20'})
2Ghi

W- bang
call s:_f.command.add('Jkl', 'call WriteFile("bang: ".<bang>0)', {'bang': 1})
Jkl
Jkl!

W- bar
call s:_f.command.add('Mno', 'call WriteFile(<q-args>)', {'nargs': '1',
            \                                             'bar': 0})
call s:_f.command.add('Pqr', 'call WriteFile(<q-args>)', {'nargs': '1'})
Mno 1 | Pqr 2
Pqr 3 | Mno 4

W- Fref + no options
call s:_f.command.add('Stu', function('Abc'), {})
Stu

W- rsplitfunc: regex
call s:_f.command.add('Vwx', function('WriteFile'), {'rsplitfunc': '-'})
Vwx abc-def-ghi
Vwx abc def

W- rsplitfunc: function
function Rsplit(cmdline)
    return split(a:cmdline, ':')
endfunction
let s:_functions+=['Rsplit']
call s:_f.command.add('Yz', function('WriteFile'),
            \         {'rsplitfunc': function('Rsplit')})
Yz abc:def:ghi
Yz abc def

W- rsplitfunc: 0
call s:_f.command.add('Zy', function('WriteFile'), {'rsplitfunc': 0,
            \                                       'nargs': '+'})
Zy abc:def:ghi
Zy abc def ghi
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.