Skip to content

Proposal: Add '.' as a valid column number for :subst \%c patterns #8179

@aghast

Description

@aghast

I've been editing markdown formatted tables, and have made great use of the \%<23c zero-width pattern atoms.

My particular table had "structured" fields on the left, and "unstructured" text on the right. My changes were to the structured fields, so I spent some time using \%<23c as a constraint on my subst commands: "make these changes, but only in the structured fields!"

However, that number 23 can be hard to come by. The best "direct" method I came up with was to use the expression register, something like:

s/... \%< [Ctrl-r] =col(".") [Enter] c ... / ... /

The alternative was to try reading the number off the status line. But I've got a bunch of numbers there, and screwed that up a few times, too!

I think that adding just a dot character (.) as a valid column number, signifying "position of the cursor at the start of the command," would address this nicely. And it would make the subst more usable in '@'macros.

I thought about suggesting that \%c (and \%v) without numbers take the current position, but that lacks specificity. Typing the dot says "I mean to do this".

This change should probably apply to %v (virtual column) and %l (line number), as well.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions