Bug: Making «<sc» abbreviation is not possible

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

Bug: Making «<sc» abbreviation is not possible

Nikolay Aleksandrovich Pavlov
Trying to make an abbreviation using
    iabbrev <sc test
    iabbrev <lt>sc test
    iabbrev \<sc test
    iabbrev <lt><Char-115>c test
    iabbrev <script> <lt>sc test
    set cpoptions-=<
    iabbrev <sc test
    iabbrev <script> <sc test
    iabbrev <special> <lt>sc test
Results in
    E474: Invalid argument
at least on empty file. Strange, but it succeeds if I open a help window and
define this abbreviation while being in it, though this abbreviation works only
in help window.

Tested on vim-7.2.303, vim-7.2.444, vim-7.3a. Behavior in help window tested
only on vim-7.2.303.

signature.asc (205 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Bug: Making «< sc» abbreviation is not possible

James Vega-3
On Wed, Jun 30, 2010 at 8:30 AM, ZyX <[hidden email]> wrote:

> Trying to make an abbreviation using
>    iabbrev <sc test
>    iabbrev <lt>sc test
>    iabbrev \<sc test
>    iabbrev <lt><Char-115>c test
>    iabbrev <script> <lt>sc test
>    set cpoptions-=<
>    iabbrev <sc test
>    iabbrev <script> <sc test
>    iabbrev <special> <lt>sc test
> Results in
>    E474: Invalid argument
> at least on empty file. Strange, but it succeeds if I open a help window and
> define this abbreviation while being in it, though this abbreviation works only
> in help window.

The abbreviation doesn't work in an empty buffer because "<sc" is not a
valid abbreviation format.  Paraphrasing from ":help abbreviations",
there are three valid formats.

1) full-id - All characters in the abbr are listed in the 'iskeyword' option
2) end-id - Only the last character in the abbr is listed in the
   'iskeyword' option
3) non-id - Only the last character in the abbr is not listed in the
   'iskeyword' option

By default, the "<" character is not a keyword character, where as "<"
is included in 'iskeyword' for help buffers.

--
James
GPG Key: 1024D/61326D40 2003-09-02 James Vega <[hidden email]>

--
You received this message from the "vim_dev" 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
Reply | Threaded
Open this post in threaded view
|

Re: Bug: Making «<sc» abbreviation is not possible

Bram Moolenaar
In reply to this post by Nikolay Aleksandrovich Pavlov

ZyX (?) wrote:

> Trying to make an abbreviation using
>     iabbrev <sc test
>     iabbrev <lt>sc test
>     iabbrev \<sc test
>     iabbrev <lt><Char-115>c test
>     iabbrev <script> <lt>sc test
>     set cpoptions-=<
>     iabbrev <sc test
>     iabbrev <script> <sc test
>     iabbrev <special> <lt>sc test
> Results in
>     E474: Invalid argument
> at least on empty file. Strange, but it succeeds if I open a help window and
> define this abbreviation while being in it, though this abbreviation works only
> in help window.
>
> Tested on vim-7.2.303, vim-7.2.444, vim-7.3a. Behavior in help window tested
> only on vim-7.2.303.

Most likely has something to do with keyword characters, since
'iskeyword' has a different value in help files.

It also helps if you pinpoint the line that causes the error, it should
be mentioned if you source a script with these lines.

--
hundred-and-one symptoms of being an internet addict:
250. You've given up the search for the "perfect woman" and instead,
     sit in front of the PC until you're just too tired to care.

 /// Bram Moolenaar -- [hidden email] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

--
You received this message from the "vim_dev" 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
Reply | Threaded
Open this post in threaded view
|

Re: Bug: Making «<sc» abbreviation is not possible

Nikolay Aleksandrovich Pavlov
Ответ на сообщение «Re: Bug: Making «< sc» abbreviation is not possible»,
присланное в 00:10:21 01 июля 2010, Четверг,
отправитель Bram Moolenaar:

> Most likely has something to do with keyword characters, since
> 'iskeyword' has a different value in help files.

Yes, James Vega already pointed me that I should have «<» in «iskeyword» option
in order to be able to make this abbreviation. Now I understand that it is not a
bug, but I think that error message should be more verbose, like:

    Exxx: Invalid abbreviation: <sc

and *Exxx* tag before the line «There are three types of abbreviations».

Текст сообщения:

> ZyX (?) wrote:
> > Trying to make an abbreviation using
> >
> >     iabbrev <sc test
> >     iabbrev <lt>sc test
> >     iabbrev \<sc test
> >     iabbrev <lt><Char-115>c test
> >     iabbrev <script> <lt>sc test
> >     set cpoptions-=<
> >     iabbrev <sc test
> >     iabbrev <script> <sc test
> >     iabbrev <special> <lt>sc test
> >
> > Results in
> >
> >     E474: Invalid argument
> >
> > at least on empty file. Strange, but it succeeds if I open a help window
> > and define this abbreviation while being in it, though this abbreviation
> > works only in help window.
> >
> > Tested on vim-7.2.303, vim-7.2.444, vim-7.3a. Behavior in help window
> > tested only on vim-7.2.303.
>
> Most likely has something to do with keyword characters, since
> 'iskeyword' has a different value in help files.
>
> It also helps if you pinpoint the line that causes the error, it should
> be mentioned if you source a script with these lines.

signature.asc (205 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Bug: Making «< sc» abbreviation is not possible

Matt Wozniski-2
On Thu, Jul 1, 2010 at 10:55 AM, ZyX wrote:

> Ответ на сообщение <<Re: Bug: Making <<< sc>> abbreviation is not possible>>,
> присланное в 00:10:21 01 июля 2010, Четверг,
> отправитель Bram Moolenaar:
>
>> Most likely has something to do with keyword characters, since
>> 'iskeyword' has a different value in help files.
>
> Yes, James Vega already pointed me that I should have <<<>> in <<iskeyword>> option
> in order to be able to make this abbreviation. Now I understand that it is not a
> bug, but I think that error message should be more verbose, like:
>
>    Exxx: Invalid abbreviation: <sc
>
> and *Exxx* tag before the line <<There are three types of abbreviations>>.

I second this - in this case, we do have enough information to know
exactly why it's an invalid argument, and - unlike most times when
E474 is thrown - it's not always immediately obvious to even trained
eyes what the error is, since it depends on buffer-local options.  An
error message just for this case would be a Good Thing.

~Matt

--
You received this message from the "vim_dev" 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