Quantcast

Insert mode completion for sentences

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Insert mode completion for sentences

Tuomas Pyyhtiä

I have studied and played around with the dictionary functionality and insert mode completion but didn't find out how to solve this:
In a file I've got ~10000 lines of short sentences (2-6 words) which I need to manually input every now and then; my personal dictionary full of compound words if you will.

I then tried scripts SuperTab and word_complete but so far I can only get them to complete words instead of sentences.

Any pointers to a script with an auto-completion feature that finishes those whole sentences as well, or any other suggestions how I get this done? Thanks!

--
Tuomas



--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Insert mode completion for sentences

Nazri Ramliy

On Wed, Feb 25, 2009 at 2:59 AM, Tuomas Pyyhtiä <[hidden email]> wrote:
> Any pointers to a script with an auto-completion feature that finishes
> those whole sentences as well, or any other suggestions how I get this
> done? Thanks!

Use abbreviations.

    he :abbreviations

example:

    :iab jas  just another sentence

nazri

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Insert mode completion for sentences

Tuomas Pyyhtiä

On Wed, 25 Feb 2009 04:46:45 +0200, Nazri Ramliy <[hidden email]> wrote:

>
> On Wed, Feb 25, 2009 at 2:59 AM, Tuomas Pyyhtiä <[hidden email]>  
> wrote:
>> Any pointers to a script with an auto-completion feature that finishes
>> those whole sentences as well, or any other suggestions how I get this
>> done? Thanks!
>
> Use abbreviations.
>
>     he :abbreviations
>
> example:
>
>     :iab jas  just another sentence
>

Thanks for the suggestion. Although abbreviations are great, they don't get the job done here as I would have to define and memorize 10000 abbreviations and that seems highly impractical. It seems to be that I am not alone with this problem as some other user has commented (last comment) a similar case here: http://vim.wikia.com/wiki/Dictionary_completions

If I come to a solution, I'll post it here.

--
Tuomas



--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Insert mode completion for sentences

Nazri Ramliy

On Thu, Feb 26, 2009 at 12:19 AM, Tuomas Pyyhtiä <[hidden email]> wrote:
> Thanks for the suggestion. Although abbreviations are great, they don't get
> the job done here as I would have to define and memorize 10000 abbreviations
> and that seems highly impractical. It seems to be that I am not alone with
> this problem as some other user has commented (last comment) a similar case
> here: http://vim.wikia.com/wiki/Dictionary_completions

Hmm, maybe this will help: Whole line completion. :he i_CTRL-X_CTRL-L

You can make an insert mode mapping to isolate the beginning portion of the
phrase that you would like to complete, and then perform an i_CTRL-X_CTRL-L
command on that. By isolate here I mean putting in on a single line of its own,
otherwise the whole-line completion wouldn't work. This should give you a nice
omni-completion window with the possible phrases to complete. Once you
complete the phrase you may need to have another mapping to join/format the
newly completed phrase into the previous sentence.

You'll also need to make use of the 'complete' option to tell vim
where to look for the
10000 phrases that you have (all in one file, one line each).

nazri.

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Insert mode completion for sentences

Ben Fritz
In reply to this post by Tuomas Pyyhtiä



On Feb 24, 12:59 pm, Tuomas Pyyhtiä <[hidden email]> wrote:
> I have studied and played around with the dictionary functionality and insert mode completion but didn't find out how to solve this:
> In a file I've got ~10000 lines of short sentences (2-6 words) which I need to manually input every now and then; my personal dictionary full of compound words if you will.
>
> I then tried scripts SuperTab and word_complete but so far I can only get them to complete words instead of sentences.
>
> Any pointers to a script with an auto-completion feature that finishes those whole sentences as well, or any other suggestions how I get this done? Thanks!
>

You may need to write your own.

:help 'omnifunc'
:help 'completefunc'
:help 'complete-functions'
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Loading...