Saturday, March 8, 2014

Re: Automatic completion from word list

On 07.03.14 16:30, Andre Majorel wrote:
> I would like to be able to type the first letter and some others
> of a word and have Vim automatically pull the matching word from
> my word list.
...

Some or most of your needs may be met by inherent Vim capability.
Have a look at: :h ins-completion

After glancing at that, I'm able to autocomplete "automatically" by
typing au<CTRL-X><CTRL-N> in this reply. OK, since that uses the current
file as dictionary, it also offered "autocomplete" as a second option.
If I had wanted that, then <CTRL-N> or <CTRL-P> provide rotation through
the offered alternatives.

But you asked for dictionary-driven autocompletion. That is described in
subsection 3. A look at: :h dictionary
as well, should sort that out for you.

By far the easiest way to sort a rated list, such as:

autocomplete 2
automatically 42
automaton 142
calipers 7

would be to pipe the file through "sort -nr". Doing it with just that
paragraph, within Vim, using "!}sort -nr" gave:

calipers 7
automaton 142
automatically 42
autocomplete 2

Yes, that should reduce the number of <CTRL-N>s needed to reach the most
common alternatives with common leading spelling. (Only one for "au",
with that dictionary.)

Erik

--
The UN also estimates that the current global population of 7.2 billion will
reach 9.6 billion by 2050. That is a faster rate of growth than previously
estimated. - http://www.bbc.co.uk/news/world-asia-22907307

--
--
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: