Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misexplain the :g command (maybe) #160

Open
aidancz opened this issue Jan 27, 2023 · 0 comments
Open

Misexplain the :g command (maybe) #160

aidancz opened this issue Jan 27, 2023 · 0 comments

Comments

@aidancz
Copy link

aidancz commented Jan 27, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant