Vim'的用例是什么;s括号([和])标记?

Vim'的用例是什么;s括号([和])标记?,vim,Vim,根据:h标记: m[ m] m[ or m] Set the '[ or '] mark. Useful when an operator is to be simulated by multiple commands. (does not move the cursor,

根据
:h标记

                                                m[ m]
m[  or  m]              Set the '[ or '] mark.  Useful when an operator is
                        to be simulated by multiple commands.  (does not move
                        the cursor, this is not a motion command).

m
非常有用,但是上面的描述对我来说太模糊了,我找不到任何示例。

正如Melpome所说,您可以使用vim中的
:help'[
命令查看以下区域:

                            *'[* *`[*
'[  `[          To the first character of the previously changed
            or yanked text.  {not in Vi}

                            *']* *`]*
']  `]          To the last character of the previously changed or
            yanked text.  {not in Vi}

After executing an operator the Cursor is put at the beginning of the text
that was operated upon.  After a put command ("p" or "P") the cursor is
sometimes placed at the first inserted line and sometimes on the last inserted
character.  The four commands above put the cursor at either end.  Example:
After yanking 10 lines you want to go to the last one of them: "10Y']".  After
inserting several lines with the "p" command you want to jump to the lowest
inserted line: "p']".  This also works for text that has been inserted.

Note: After deleting text, the start and end positions are the same, except
when using blockwise Visual mode.  These commands do not work when no change
was made yet in the current file.
在“大分数”一章中:

7. Marks                    *mark-motions* *E20* *E78*

Jumping to a mark can be done in two ways:
1. With ` (backtick):     The cursor is positioned at the specified location
              and the motion is |exclusive|.
2. With ' (single quote): The cursor is positioned on the first non-blank
              character in the line of the specified location and
              the motion is linewise.

                        *m* *mark* *Mark*
m{a-zA-Z}       Set mark {a-zA-Z} at cursor position (does not move
            the cursor, this is not a motion command).

                        *m'* *m`*
m'  or  m`      Set the previous context mark.  This can be jumped to
            with the "''" or "``" command (does not move the
            cursor, this is not a motion command).

                        *m[* *m]*
m[  or  m]      Set the |'[| or |']| mark.  Useful when an operator is
            to be simulated by multiple commands.  (does not move
            the cursor, this is not a motion command).

                        *m<* *m>*
m<  or  m>      Set the |'<| or |'>| mark.  Useful to change what the
            `gv` command selects.  (does not move the cursor, this
            is not a motion command).
            Note that the Visual mode cannot be set, only the
            start and end position.

                        *:ma* *:mark* *E191*
:[range]ma[rk] {a-zA-Z'}
            Set mark {a-zA-Z'} at last line number in [range],
            column 0.  Default is cursor line.

                        *:k*
:[range]k{a-zA-Z'}  Same as :mark, but the space before the mark name can
            be omitted.

                        *'* *'a* *`* *`a*
'{a-z}  `{a-z}      Jump to the mark {a-z} in the current buffer.

                        *'A* *'0* *`A* *`0*
'{A-Z0-9}  `{A-Z0-9}    To the mark {A-Z0-9} in the file where it was set (not
            a motion command when in another file).  {not in Vi}

                        *g'* *g'a* *g`* *g`a*
g'{mark}  g`{mark}
            Jump to the {mark}, but don't change the jumplist when
            jumping within the current buffer.  Example: >
                g`"
<           jumps to the last known position in a file.  See
            $VIMRUNTIME/vimrc_example.vim.
            Also see |:keepjumps|.
            {not in Vi}

                        *:marks*
:marks          List all the current marks (not a motion command).
            The |'(|, |')|, |'{| and |'}| marks are not listed.
            The first column has number zero.
            {not in Vi}
                        *E283*
:marks {arg}        List the marks that are mentioned in {arg} (not a
            motion command).  For example: >
                :marks aB
<           to list marks 'a' and 'B'.  {not in Vi}

                            *:delm* *:delmarks*
:delm[arks] {marks} Delete the specified marks.  Marks that can be deleted
            include A-Z and 0-9.  You cannot delete the ' mark.
            They can be specified by giving the list of mark
            names, or with a range, separated with a dash.  Spaces
            are ignored.  Examples: >
               :delmarks a        deletes mark a
               :delmarks a b 1    deletes marks a, b and 1
               :delmarks Aa       deletes marks A and a
               :delmarks p-z      deletes marks in the range p to z
               :delmarks ^.[]     deletes marks ^ . [ ]
               :delmarks \"       deletes mark "
<           {not in Vi}

:delm[arks]!        Delete all marks for the current buffer, but not marks
            A-Z or 0-9.
            {not in Vi}

A mark is not visible in any way.  It is just a position in the file that is
remembered.  Do not confuse marks with named registers, they are totally
unrelated.

'a - 'z     lowercase marks, valid within one file
'A - 'Z     uppercase marks, also called file marks, valid between files
'0 - '9     numbered marks, set from .viminfo file

Lowercase marks 'a to 'z are remembered as long as the file remains in the
buffer list.  If you remove the file from the buffer list, all its marks are
lost.  If you delete a line that contains a mark, that mark is erased.

Lowercase marks can be used in combination with operators.  For example: "d't"
deletes the lines from the cursor position to mark 't'.  Hint: Use mark 't' for
Top, 'b' for Bottom, etc..  Lowercase marks are restored when using undo and
redo.

Uppercase marks 'A to 'Z include the file name.  {Vi: no uppercase marks} You
can use them to jump from file to file.  You can only use an uppercase mark
with an operator if the mark is in the current file.  The line number of the
mark remains correct, even if you insert/delete lines or edit another file for
a moment.  When the 'viminfo' option is not empty, uppercase marks are kept in
the .viminfo file.  See |viminfo-file-marks|.

Numbered marks '0 to '9 are quite different.  They can not be set directly.
They are only present when using a viminfo file |viminfo-file|.  Basically '0
is the location of the cursor when you last exited Vim, '1 the last but one
time, etc.  Use the "r" flag in 'viminfo' to specify files for which no
Numbered mark should be stored.  See |viminfo-file-marks|.


                            *'[* *`[*
'[  `[          To the first character of the previously changed
            or yanked text.  {not in Vi}

                            *']* *`]*
']  `]          To the last character of the previously changed or
            yanked text.  {not in Vi}

After executing an operator the Cursor is put at the beginning of the text
that was operated upon.  After a put command ("p" or "P") the cursor is
sometimes placed at the first inserted line and sometimes on the last inserted
character.  The four commands above put the cursor at either end.  Example:
After yanking 10 lines you want to go to the last one of them: "10Y']".  After
inserting several lines with the "p" command you want to jump to the lowest
inserted line: "p']".  This also works for text that has been inserted.

Note: After deleting text, the start and end positions are the same, except
when using blockwise Visual mode.  These commands do not work when no change
was made yet in the current file.

                            *'<* *`<*
'<  `<          To the first line or character of the last selected
            Visual area in the current buffer.  For block mode it
            may also be the last character in the first line (to
            be able to define the block).  {not in Vi}.

                            *'>* *`>*
'>  `>          To the last line or character of the last selected
            Visual area in the current buffer.  For block mode it
            may also be the first character of the last line (to
            be able to define the block).  Note that 'selection'
            applies, the position may be just after the Visual
            area.  {not in Vi}.

                            *''* *``*
''  ``          To the position before the latest jump, or where the
            last "m'" or "m`" command was given.  Not set when the
            |:keepjumps| command modifier was used.
            Also see |restore-position|.

                            *'quote* *`quote*
'"  `"          To the cursor position when last exiting the current
            buffer.  Defaults to the first character of the first
            line.  See |last-position-jump| for how to use this
            for each opened file.
            Only one position is remembered per buffer, not one
            for each window.  As long as the buffer is visible in
            a window the position won't be changed.
            {not in Vi}.

                            *'^* *`^*
'^  `^          To the position where the cursor was the last time
            when Insert mode was stopped.  This is used by the
            |gi| command.  Not set when the |:keepjumps| command
            modifier was used.  {not in Vi}

                            *'.* *`.*
'.  `.          To the position where the last change was made.  The
            position is at or near where the change started.
            Sometimes a command is executed as several changes,
            then the position can be near the end of what the
            command changed.  For example when inserting a word,
            the position will be on the last character.
            To jump to older changes use |g;|.
            {not in Vi}

                            *'(* *`(*
'(  `(          To the start of the current sentence, like the |(|
            command.  {not in Vi}

                            *')* *`)*
')  `)          To the end of the current sentence, like the |)|
            command.  {not in Vi}

                            *'{* *`{*
'{  `{          To the start of the current paragraph, like the |{|
            command.  {not in Vi}

                            *'}* *`}*
'}  `}          To the end of the current paragraph, like the |}|
            command.  {not in Vi}

These commands are not marks themselves, but jump to a mark:

                            *]'*
]'          [count] times to next line with a lowercase mark below
            the cursor, on the first non-blank character in the
            line. {not in Vi}

                            *]`*
]`          [count] times to lowercase mark after the cursor. {not
            in Vi}

                            *['*
['          [count] times to previous line with a lowercase mark
            before the cursor, on the first non-blank character in
            the line. {not in Vi}

                            *[`*
[`          [count] times to lowercase mark before the cursor.
            {not in Vi}


:loc[kmarks] {command}                  *:loc* *:lockmarks*
            Execute {command} without adjusting marks.  This is
            useful when changing text in a way that the line count
            will be the same when the change has completed.
            WARNING: When the line count does change, marks below
            the change will keep their line number, thus move to
            another text line.
            These items will not be adjusted for deleted/inserted
            lines:
            - lower case letter marks 'a - 'z
            - upper case letter marks 'A - 'Z
            - numbered marks '0 - '9
            - last insert position '^
            - last change position '.
            - the Visual area '< and '>
            - line numbers in placed signs
            - line numbers in quickfix positions
            - positions in the |jumplist|
            - positions in the |tagstack|
            These items will still be adjusted:
            - previous context mark ''
            - the cursor position
            - the view of a window on a buffer
            - folds
            - diffs

:kee[pmarks] {command}                  *:kee* *:keepmarks*
            Currently only has effect for the filter command
            |:range!|:
            - When the number of lines after filtering is equal to
              or larger than before, all marks are kept at the
              same line number.
            - When the number of lines decreases, the marks in the
              lines that disappeared are deleted.
            In any case the marks below the filtered text have
            their line numbers adjusted, thus stick to the text,
            as usual.
            When the 'R' flag is missing from 'cpoptions' this has
            the same effect as using ":keepmarks".

                            *:keepj* *:keepjumps*
:keepj[umps] {command}
            Moving around in {command} does not change the |''|,
            |'.| and |'^| marks, the |jumplist| or the
            |changelist|.
            Useful when making a change or inserting text
            automatically and the user doesn't want to go to this
            position.  E.g., when updating a "Last change"
            timestamp in the first line: >

                :let lnum = line(".")
                :keepjumps normal gg
                :call SetLastChange()
                :keepjumps exe "normal " . lnum . "G"
<
            Note that ":keepjumps" must be used for every command.
            When invoking a function the commands in that function
            can still change the jumplist.  Also, for
            ":keepjumps exe 'command '" the "command" won't keep
            jumps.  Instead use: ":exe 'keepjumps command'"
7.标记*标记运动**E20**E78*
跳转到标记可以通过两种方式完成:
1.带`(倒勾):光标位于指定位置
这项动议是“排他性的”。
2.带“(单引号):光标位于第一个非空白位置
指定位置的行中的字符,以及
该动议是逐行的。
*m**马克**马克*
m{a-zA-Z}在光标位置设置标记{a-zA-Z}(不移动
光标,这不是运动命令)。
*m'**m`*
m'或m`设置上一个上下文标记。这可以跳到
使用“''”或“``”命令(不移动
光标,这不是运动命令)。
*m[**m]*
m[或m]设置|'[|或|']|标记。当运算符
由多个命令模拟。(不移动
光标,这不是运动命令)。
*m*
m<或m>设置|'
g`“
<跳转到文件中最后一个已知位置。请参阅
$VIMRUNTIME/vimrc_example.vim。
另请参见|:保持跳跃。
{不在Vi}
*:马克*
:标记列出所有当前标记(不是运动命令)。
|'(|,|')|,|'{|和|'}标记未列出。
第一列的数字为零。
{不在Vi}
*E283*
:marks{arg}列出{arg}中提到的标记(不是
运动命令)。例如:>
:马克aB
<列出标记“a”和“B”。{不在Vi中}
*:delm**:delmarks*
:delm[arks]{marks}删除指定的标记。可以删除的标记
包括A-Z和0-9。不能删除“标记”。
它们可以通过给出标记列表来指定
名称,或带范围,用破折号分隔。空格
被忽略。示例:>
:delmarks a删除标记a
:delmarks a b 1删除标记a、b和1
:delmarks Aa删除标记A和A
:delmarks p-z删除p到z范围内的标记
:delmarks^.[]删除标记^。[]
:delmarks \“删除标记”
<{不在Vi}
:delm[arks]!删除当前缓冲区的所有标记,但不删除标记
A-Z或0-9。
{不在Vi}
标记无论如何都不可见。它只是文件中的一个位置
记住。不要把标记和命名寄存器混淆,它们是完全相同的
无关的。
“a-”z小写标记,在一个文件中有效
“A-”Z大写标记,也称为文件标记,在文件之间有效
“0-”9个编号标记,从.viminfo文件设置
只要文件仍在文件中,小写标记“a到”z就会被记住
缓冲区列表。如果从缓冲区列表中删除该文件,则其所有标记都将被删除
丢失。如果删除包含标记的行,该标记将被删除。
小写标记可以与运算符结合使用。例如:“d't”
从光标位置删除标记“t”的行。提示:将标记“t”用于
顶部,“b”表示底部等。使用撤消和
重做。
大写标记“A到”Z包括文件名。{Vi:无大写标记}
可以使用它们从一个文件跳到另一个文件。只能使用大写标记
如果标记在当前文件中,则使用运算符。标记的行号
即使为其插入/删除行或编辑其他文件,标记仍保持正确
稍等。当“viminfo”选项不为空时,大写标记保留在
.viminfo文件。请参阅| viminfo文件标记|。
编号标记“0到”9完全不同。无法直接设置。
它们仅在使用viminfo文件| viminfo文件|时出现。基本上为“0”
上次退出Vim'1时光标的位置是最后一个,但只有一个吗
时间等。使用“viminfo”中的“r”标志指定没有
应存储带编号的标记。请参阅| viminfo file marks |。
*'[* *`[*
“[`[到先前更改的
或猛拉文本。{不在Vi}
*']* *`]*
“]`]到以前更改的或
猛拉文本。{不在Vi}
执行运算符后,光标放在文本的开头
在put命令(“p”或“p”)之后,光标
有时放在第一个插入的行上,有时放在最后一个插入的行上
字符。上面的四个命令将光标放在任意一端。示例:
拉下10行后,你想转到最后一行:“10Y']”。之后
使用“p”命令插入几行,以跳转到最低位置
插入行:“p']”。这也适用于已插入的文本。
注意:删除文本后,开始和结束位置相同,除了
当使用分块视觉模式时。这些命令在没有更改时不起作用
已在当前文件中创建。
*'*
“>`>到最后一个选定字符的最后一行或最后一个字符
当前缓冲区中的可视区域。对于块模式,它
也可以是最后一行的第一个字符(到
能够定义块)。请注意“选择”
应用时,该位置可能正好在可视
区域{不在Vi}。
*''* *``*
“``到之前的位置