Vimscript: Sample codes for command completions

Sample Code

 

" Sample functions {{{
function! Varg(foo)
    "echom a:0
    "echom a:1
    "echom a:2
    echom a:foo
    let cmd_str = "git ls-remote ssh://wall.lge.com/" . a:foo . " | head -n 10"
    let r = system(cmd_str)
    !echo r
endfunction

function! Vargs2(foo, ...)
    "echom a:foo
    "echom a:0
    " echom a:1
    echo a:0
endfunction

function! Assign(foo)
    " let a:foo = "Nope"
    let foo_tmp = a:foo
    let foo_tmp = "Yep"
    echom a:foo
    endfunction
" }}}

com! -complete=custom,ListUserstwo -nargs=1 Sunjoo2 call Varg("")
fun! ListUserstwo(A,L,P)
    return "starfish/build-starfish\nwebos-pro/meta-lg-webos"
endfun

Sunjoo2: Command name

call Varg(“”): Vim command triggered when calling a command

ListUserstwo: Function that returns a list of strings for parameter completion

Advertisements

Author: all4dich

http://webchat.freenode.net/?channels=node.js

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s