Skip to content
This repository was archived by the owner on Feb 27, 2024. It is now read-only.
This repository was archived by the owner on Feb 27, 2024. It is now read-only.

af should include blank line after function (if any), ac should include blank line after class (if any) #17

Open
@jeetsukumaran

Description

@jeetsukumaran

Consider the following fragment:

def f1():     # :1
    code      # :2
    code      # :3
    code      # :4
              # :5
              # :6
def f2():     # :7
    code      # :8
    code      # :9
    code      # :10

If on line 3, the af text object spans lines 1 through 4, inclusive.
I think the text object should span lines 1 through 5, inclusive, unless line 5 is non-blank (i.e., there is not space between the functions).

This is for consistency with the way Vim's other text objects behave. Most of Vim's other text objects also include the subsequent line/space when in a mode.
E.g., in the above example, vap will select lines 1 though 5.
The same principle holds with words, e.g. in the sentence "the quick brown fox", if the cursor is on "quick", while viw will select "quick", but vaw will select "quick_", i.e. "quick" and the subsequent space.

Of course, if there is NO blank line following the function/class, then the object should be restricted as currently (otherwise it will include elements of the next function/class etc)

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