Tuesday, August 23, 2016

Re: Create Autocompletion snippets for Custom Code

On Tuesday, August 23, 2016 at 11:45:30 AM UTC-5, Tumbler Terrall wrote:
> On Tuesday, August 23, 2016 at 11:38:19 AM UTC-5, Amit Christian wrote:
> > Is it possible to create your own autocompletion snippets using Vim functionalities or plugin? I have several custom code that I would like to create snippet for. I am using GVim on Windows. Most of existing autocomplete plugins like NeoComplete or YouCompleteMe etc do not work well on Windows. I am looking for something Vim native to do this.
> >
> > Any help, suggestions are appreciated.
> >
> > Thanks.
>
> Yes it is! Have a look at `:h complete` and `:h compl-functions`. They should get you pointed in the right direction. :)

Thanks Tumbler.

I started working on it. The Help had a example that I could work with.

inoremap <F5> <C-R>=ListMonths()<CR>

func! ListMonths()
call complete(col('.'),
['January
New line', 'February', 'March',
\ 'April', 'May', 'June', 'July', 'August', 'September',
\ 'October', 'November', 'December'])
return ''
endfunc

Is it possible to have completion triggers snippet with multiple lines? For example,

F5 > January will put

First Month.
January.

Something like that. Is it possible?

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: