Diff to HTML by rtfpessoa

Files changed (2) hide show
  1. runtime/doc/cmdline.txt +80 -29
  2. runtime/doc/usr_10.txt +3 -1
runtime/doc/cmdline.txt CHANGED
@@ -1,4 +1,4 @@
1
- *cmdline.txt* For Vim version 9.1. Last change: 2025 Sep 10
2
 
3
 
4
  VIM REFERENCE MANUAL by Bram Moolenaar
@@ -745,16 +745,17 @@ Some Ex commands accept a line range in front of them. This is noted as
745
 
746
  The basics are explained in section |10.3| of the user manual.
747
 
748
- In |Vim9| script a range needs to be prefixed with a colon to avoid ambiguity
749
  with continuation lines. For example, "+" can be used for a range but is also
750
  a continuation of an expression: >
751
  var result = start
752
  + print
753
- If the "+" is a range then it must be prefixed with a colon: >
754
- var result = start
 
755
  :+ print
756
  <
757
- *:,* *:;*
758
  When separated with ';' the cursor position will be set to that line
759
  before interpreting the next line specifier. This doesn't happen for ','.
760
  Examples: >
@@ -764,36 +765,86 @@ Examples: >
764
  < from line 5 till match with "that line" after line 5.
765
 
766
  The default line specifier for most commands is the cursor position, but the
767
- commands ":write" and ":global" have the whole file (1,$) as default.
768
-
769
- If more line specifiers are given than required for the command, the first
770
- one(s) will be ignored.
771
-
 
 
 
 
772
  Line numbers may be specified with: *:range* *{address}*
773
  {number} an absolute line number *E1247*
774
- . the current line *:.*
775
- $ the last line in the file *:$*
776
- % equal to 1,$ (the entire file) *:%*
777
- 't position of mark t (lowercase) *:'*
778
- 'T position of mark T (uppercase); when the mark is in
779
- another file it cannot be used in a range
780
- /{pattern}[/] the next line where {pattern} matches *:/*
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
781
  also see |:range-pattern| below
782
- ?{pattern}[?] the previous line where {pattern} matches *:?*
783
  also see |:range-pattern| below
784
- \/ the next line where the previously used search
785
- pattern matches
786
- \? the previous line where the previously used search
787
- pattern matches
788
- \& the next line where the previously used substitute
789
- pattern matches
 
 
 
790
 
791
  *:range-offset*
792
- Each may be followed (several times) by '+' or '-' and an optional number.
793
- This number is added or subtracted from the preceding line number. If the
794
- number is omitted, 1 is used. If there is nothing before the '+' or '-' then
795
- the current line is used.
796
- *:range-closed-fold*
 
 
 
 
 
 
 
 
 
 
 
 
797
  When a line number after the comma is in a closed fold it is adjusted to the
798
  last line of the fold, thus the whole fold is included.
799
 
 
1
+ *cmdline.txt* For Vim version 9.1. Last change: 2025 Sep 15
2
 
3
 
4
  VIM REFERENCE MANUAL by Bram Moolenaar
 
745
 
746
  The basics are explained in section |10.3| of the user manual.
747
 
748
+ In |Vim9| script, a range needs to be prefixed with a colon to avoid ambiguity
749
  with continuation lines. For example, "+" can be used for a range but is also
750
  a continuation of an expression: >
751
  var result = start
752
  + print
753
+ <If the "+" is a range, as it is here, in Vim9 script it must be prefixed
754
+ with a colon (otherwise you will get error |E1050|): >
755
+ vim9script
756
  :+ print
757
  <
758
+ *:,* *:;*
759
  When separated with ';' the cursor position will be set to that line
760
  before interpreting the next line specifier. This doesn't happen for ','.
761
  Examples: >
 
765
  < from line 5 till match with "that line" after line 5.
766
 
767
  The default line specifier for most commands is the cursor position, but the
768
+ commands ":write" and ":global" have the whole buffer (1,$) as default.
769
+
770
+ If more line specifiers are given than required for the command, when comma
771
+ separated, the leftmost one(s) will be ignored, e.g., the -2,+ in this: >
772
+ :-2,+,-2,. print
773
+ <When semicolon separated, the leftmost specifier to the penultimate one are
774
+ summed, e.g., -4 + 3 - 1 = -2, in this: >
775
+ :-4;+3;-1;+2 print
776
+ <
777
  Line numbers may be specified with: *:range* *{address}*
778
  {number} an absolute line number *E1247*
779
+ . the current line *:.*
780
+ $ the last line of the buffer *:$*
781
+ % equal to 1,$ (the entire buffer) *:%*
782
+ * equal to '<,'> (the lines of the last
783
+ selected Visual area; see |:star| below)
784
+ 'x the line of the position of mark x *:'x*
785
+ (where x is any {a-z} mark)
786
+ 'X the line of the position of mark X *:'X*
787
+ (where X is any {A-Z0-9} mark, though
788
+ when X is in another buffer it cannot
789
+ be used in a range)
790
+ '[ the first line of the most recent *:'[*
791
+ change or yank
792
+ '] the last line of the most recent *:']*
793
+ change or yank
794
+ '< the first line of the most recently *:'<*
795
+ selected Visual area
796
+ '> the last line of the most recently *:'>*
797
+ selected Visual area
798
+ '' the line of the position before the *:''*
799
+ latest jump, or where the last "m'"/"m`"
800
+ command was given (though '' is 1 if it
801
+ isn't in the current buffer)
802
+ '" the line of the cursor position when *:'quote*
803
+ last exiting the buffer
804
+ '^ the line of the cursor position the *:'^*
805
+ last time Insert mode was stopped
806
+ '. the line of the cursor position when the *:'.*
807
+ buffer was last changed
808
+ '( the line of the first character of the *:'(*
809
+ current sentence
810
+ ') the line of the first character after *:')*
811
+ the end of the current sentence
812
+ '{ the first empty line before the *:'{*
813
+ paragraph containing the cursor
814
+ '} the first empty line after the *:'}*
815
+ paragraph containing the cursor
816
+ /{pattern}[/] the next line where {pattern} matches *:/*
817
  also see |:range-pattern| below
818
+ ?{pattern}[?] the previous line where {pattern} matches *:?*
819
  also see |:range-pattern| below
820
+ \/ the next line where the most recent
821
+ search pattern matches
822
+ \? the previous line where the most recent
823
+ search pattern matches
824
+ \& the next line where the most recent
825
+ substitute pattern matches
826
+
827
+ Note: "next line" and "previous line" do not include matches appearing
828
+ in the current line.
829
 
830
  *:range-offset*
831
+ Each line specifier may be followed by one or more '+' or '-' and an optional
832
+ number. That value is added or subtracted from the preceding line number.
833
+ So, for example, 'x+2 is two lines after the line containing mark x. If the
834
+ number is omitted, +1 is used for each '+' and -1 for each '-' so, e.g., 'x++
835
+ and 'x+2 are synonymous. If there is nothing before the '+' or '-', for the
836
+ first line number in [range] the current line is used as the relative
837
+ starting point. So, -,. means, "the line before the current line to the
838
+ current line". The value of the second line number in [range] depends on
839
+ whether a comma or semicolon separates the line numbers (see |:,| and |:;|).
840
+ Examples: If the cursor is within the line below this one, any of these
841
+ commands will print the tag line ":range-offset" and the line, "Each...": >
842
+ :-11;+1 print
843
+ :-----------,-10 print
844
+ :?Each line?-;+ print
845
+ :'{+,'{+2 print
846
+ :'{+1;')-1 print
847
+ < *:range-closed-fold*
848
  When a line number after the comma is in a closed fold it is adjusted to the
849
  last line of the fold, thus the whole fold is included.
850
 
runtime/doc/usr_10.txt CHANGED
@@ -1,4 +1,4 @@
1
- *usr_10.txt* For Vim version 9.1. Last change: 2024 Nov 12
2
 
3
  VIM USER MANUAL - by Bram Moolenaar
4
 
@@ -339,6 +339,8 @@ then ":". For example, when you type "5:", you will get: >
339
  Now you can type the command you want to use. It will use the range "."
340
  (current line) until ".+4" (four lines down). Thus it spans five lines.
341
 
 
 
342
  ==============================================================================
343
  *10.4* The global command
344
 
 
1
+ *usr_10.txt* For Vim version 9.1. Last change: 2025 Sep 15
2
 
3
  VIM USER MANUAL - by Bram Moolenaar
4
 
 
339
  Now you can type the command you want to use. It will use the range "."
340
  (current line) until ".+4" (four lines down). Thus it spans five lines.
341
 
342
+ See also |:range|, for an overview of all possible ways to specify a range.
343
+
344
  ==============================================================================
345
  *10.4* The global command
346