Thanks to visit codestin.com
Credit goes to github.com

Skip to content

"E474: Invalid argument" with abbreviation's lhs not in iskeyword #2810

@blueyed

Description

@blueyed

The following minimal vimrc will trigger E474: Invalid argument:

setlocal iskeyword-=_
abbr <expr> _dts strftime('%a, %d %b %Y %H:%M:%S %z')

I've noticed this with editing ~/.config/git/config, which triggers setlocal iskeyword-=_ from /runtime/syntax/gitconfig.vim via vim-plug when explicitly loading a plugin marked for autoloading in the vimrc (this triggers BufRead and then the FileType autocommand after setf gitconfig). This can/should be fixed in vim-plug (by not triggering the BufRead autocommand before VimEnter), but I think the issue is still valid.

I think that the lhs being entirely made of characters from &iskeyword should not get validated when definiing abbreviations, but only (silently) when using them (i.e. they would not expand).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions