Skip to content

vim: gS on dict access dot incorrectly adds space #207

@flwyd

Description

@flwyd

Given the vimscript code l:my_dict.my_key, using splitjoin's gS at the . character produces

l:my_dict
      \ .my_key

When vim's scriptversion is 1 this creates ambiguity between dict key lookup and string concatenation due to the space between \ and .my_key. (The dot is an attractive split point when writing vim script with an object-oriented style: l:object.SomeMethod(arg, list).AnotherMethod(more, args).)

Vim seems to gracefully handle the \ .my_key ambiguity by checking if the type of l:my_dict is Dict, but NeoVim produces an E731: using Dictionary as a String error. :help expr-entry says "There must not be white space before or after the dot." It would be nice if splitting on a dot without space around it would result in a semantically identical split like

l:my_dict
      \.my_key

(note the lack of space in \.).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions