Skip to content

Instantly share code, notes, and snippets.

@jsfaint
Created March 22, 2017 02:24
Show Gist options
  • Select an option

  • Save jsfaint/a016c98db954e6ae1ec5cecdb530a365 to your computer and use it in GitHub Desktop.

Select an option

Save jsfaint/a016c98db954e6ae1ec5cecdb530a365 to your computer and use it in GitHub Desktop.
simple vim completefunc just a demo
let s:month = {
\ '1': 'Jan',
\ '2': 'Feb',
\ '3': 'Mar',
\ '4': 'Apr',
\ '5': 'May',
\ '6': 'Jun',
\ '7': 'Jul',
\ '8': 'Aug',
\ '9': 'Sep',
\ '10': 'Oct',
\ '11': 'Nov',
\ '12': 'Dec'
\ }
function! month#complete(findstart, base) abort
if a:findstart
return match('<cword>', '[1-9]*$')
elseif empty(a:base)
return []
else
let l:match = get(s:month, a:base, '')
return [l:match]
endif
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment