Skip to content

Misexplain the :g command (maybe)Β #160

@aidancz

Description

@aidancz

Thank you for your work! It's a really helpful guide and I learned a lot from it

https://github.com/iggredible/Learn-Vim/blob/master/ch13_the_global_command.md#advanced-sort

However, in the section above, it says that This command also follows the form :g/pattern1/,/pattern2/command, but I can't find anything about this form from the doc

In my opinion, it should be illustrated like this:

  • :g is the global command pattern.
  • /\[/ is the only pattern. It matches a literal left square bracket "[".
  • +1,/\]/-1 is a range, it begins from the line below the current cursor position (current cursor is placed at [), to the line above ]. thus, if not abbreviated, it should be written as .+1,/\]/-1.
  • sort is the command-line command which the range applies.

If I add a dot before +1, it works well, that's why I think this explanation makes more sense.

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