dictionary completion for words including `@' sign

44 views
Skip to first unread message

Eric Smith

unread,
May 19, 2016, 2:40:40 PM5/19/16
to vim users
I don't only want to enjoy autocomplete of my contacts when in gmail, but also
for my mutt.

I have a file with all my email addresses and
set dict=emails.txt.

When I complete with dictionary completion (mapped to <tab>), then I only receive
the first part of the email addresses, like,

foo<tab>
foo.bar

How do I return
foo<tab>
foo...@baz.com

And if I go.
<tab>
it expands to
foo.bar
baz

Here are one of the many settings of isfname, that I tried, all
without a breakthrough;
set isfname=@,48-57,/,\\,.,-,_,+,,,#,$,%,{,},[,],:,@-@,!,~,=

what gives?

Eric

Nikolay Aleksandrovich Pavlov

unread,
May 19, 2016, 3:55:41 PM5/19/16
to vim...@googlegroups.com
> --
> --
> 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+u...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.


Why &isfname? Given that &dict option documentation speaks about
“words” and “keyword characters” I guess you need &iskeyword.

Note that altering this may break some syntax files. Also many syntax
and filetype files have no idea that &iskeyword is a *user* setting
and they should even use `:syntax iskeyword` and not `setlocal
iskeyword=…` (added only recently!).

Eric Smith

unread,
May 20, 2016, 3:56:43 AM5/20/16
to vim users

I worked exhaustively on iskeyword and then followed some advice
to set isfname. Neither of the help descriptions of these two
settings were clear descriptions of their function (to me).

It do not need syntax highlighting in my vims spawned from mutt,
but I do want email address completion!

So still, any takers?

ciao
E

>Why &isfname? Given that &dict option documentation speaks about
>“words” and “keyword characters” I guess you need &iskeyword.
>
>Note that altering this may break some syntax files. Also many syntax
>and filetype files have no idea that &iskeyword is a *user* setting
>and they should even use `:syntax iskeyword` and not `setlocal
>iskeyword=…` (added only recently!).


Eric Smith wrote on Thu-19-May 16 8:40PM
--
Eric Smith

Erik Christiansen

unread,
May 20, 2016, 4:50:49 AM5/20/16
to vim users
On 20.05.16 09:56, Eric Smith wrote:
> It do not need syntax highlighting in my vims spawned from mutt,
> but I do want email address completion!

If including '@' in a vim dictionary remains problematic, the fact that
you're using mutt provides an alternative method. Mutt email aliases
allow the user to work with more human-friendly recipient names than
long-winded and cryptic email addresses - all without swearword letters. ;-)

Once headed down the path of short aliases for recipients, there's also
groups, e.g. "family", "bicycle_club", or whatever, so one soon steps
back entirely from any concern over what the actual low-level email
address might be.

The ease of focusing on What, rather than How, leaves more mental energy
for other stuff, I find. I'm never going to remember the email address
of the local shire council, but mutt knows what I mean when I address a
missive to "council", and I don't need to use any effort or swearword
letters.

Erik

Bram Moolenaar

unread,
May 20, 2016, 5:17:45 AM5/20/16
to Nikolay Aleksandrovich Pavlov, vim...@googlegroups.com

Nikolay Pavlov wrote:

> 2016-05-19 21:40 GMT+03:00 Eric Smith <e...@fruitcom.com>:
> > I don't only want to enjoy autocomplete of my contacts when in gmail, but also
> > for my mutt.
> >
> > I have a file with all my email addresses and
> > set dict=emails.txt.
> >
> > When I complete with dictionary completion (mapped to <tab>), then I only receive
> > the first part of the email addresses, like,
> >
> > foo<tab>
> > foo.bar
> >
> > How do I return
> > foo<tab>
> > foo...@baz.com
> >
> > And if I go.
> > <tab>
> > it expands to
> > foo.bar
> > baz
> >
> > Here are one of the many settings of isfname, that I tried, all
> > without a breakthrough;
> > set isfname=@,48-57,/,\\,.,-,_,+,,,#,$,%,{,},[,],:,@-@,!,~,=
> >
> > what gives?
> >
> > Eric
>
> Why &isfname? Given that &dict option documentation speaks about
> “words” and “keyword characters” I guess you need &iskeyword.
>
> Note that altering this may break some syntax files. Also many syntax
> and filetype files have no idea that &iskeyword is a *user* setting
> and they should even use `:syntax iskeyword` and not `setlocal
> iskeyword=…` (added only recently!).

You can indeed set 'iskeyword', e.g.:
:set iskeyword+=.,@-@

However, this has many side effects. I had a vague plan to split
'iskeyword' into a group of options, where it applies in different
situations. But that didn't get realized yet.

A workaround is to remap certain keys, e.g. Tab, to set the option,
perform the operation, and restore the option.

--
Hacker: Someone skilled in computer programming (good guy).
Cracker: A hacker that uses his skills to crack software (bad guy).

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

Christian Brabandt

unread,
May 20, 2016, 8:28:47 AM5/20/16
to vim users
Hi Eric!

On Fr, 20 Mai 2016, Eric Smith wrote:

>
> I worked exhaustively on iskeyword and then followed some advice
> to set isfname. Neither of the help descriptions of these two
> settings were clear descriptions of their function (to me).
>
> It do not need syntax highlighting in my vims spawned from mutt,
> but I do want email address completion!

I have documented my vim and mutt setup here:
http://www.256bit.org/~chrisbra/cms/vim_as_e-mail_editor.html

Unfortunately, the last upgrade broke mod_userdir, so this page gives
currently 403. I am trying to get this back online, but it might take
some time.

The wayback machine has it still here:
https://web.archive.org/web/20150111032455/http://www.256bit.org/~chrisbra/cms/vim_as_e-mail_editor.html

Mit freundlichen Grüßen
Christian

Chong He

unread,
May 24, 2016, 5:02:24 AM5/24/16
to vim_use
It sounds like what snippet is for? Have you tried making snippets for the email addresses or even signature?

On Friday, May 20, 2016 at 2:40:40 AM UTC+8, Eric Smith wrote:
> How do I return
> foo<tab>
> foo...@baz.com
>
> And if I go.
> <tab>
> it expands to
> foo.bar
> baz
>

> what gives?
>
> Eric

Reply all
Reply to author
Forward
0 new messages