home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / vim53os2.zip / vim-5.3 / doc / motion.txt < prev    next >
Text File  |  1998-08-30  |  31KB  |  813 lines

  1. *motion.txt*    For Vim version 5.3.  Last modification: 1998 Aug 16
  2.  
  3.  
  4.           VIM REFERENCE MANUAL    by Bram Moolenaar
  5.  
  6.  
  7. Cursor motions                    *cursor-motions*
  8.  
  9. These commands move the cursor position.  If the new position is off of the
  10. screen, the screen is scrolled to show the cursor (see also 'scrolljump' and
  11. 'scrolloff' options).
  12.  
  13. 1. Motions and operators    |operator|
  14. 2. Left-right motions        |left-right-motions|
  15. 3. Up-down motions        |up-down-motions|
  16. 4. Word motions            |word-motions|
  17. 5. Text object motions        |object-motions|
  18. 6. Text object selection    |object-select|
  19. 7. Various motions        |various-motions|
  20.  
  21. ==============================================================================
  22. 1. motions and operators                *operator*
  23.  
  24. The motion commands can be used after an operator command, to have the command
  25. operate on the text that was moved over.  That is the text between the cursor
  26. position before and after the motion.  Operators are generally used to delete
  27. or change text.  The following operators are available:
  28.  
  29.     |c|    c    change
  30.     |d|    d    delete
  31.     |y|    y    yank into register (does not change the text)
  32.     |~|    ~    swap case (only if 'tildeop' is set)
  33.     |g~|    g~    swap case
  34.     |gu|    gu    make lower case
  35.     |gU|    gU    make upper case
  36.     |!|    !    filter through an external program
  37.     |=|    =    filter through 'equalprg' or C-indenting if empty
  38.     |gq|    gq    text formatting
  39.     |>|    >    shift right
  40.     |<|    <    shift left
  41.  
  42. If the motion includes a count and the operator also had a count before it,
  43. the two counts are multiplied.  For example: "2d3w" deletes six words.
  44.  
  45.                         *linewise* *characterwise*
  46. The operator either affects whole lines, or the characters between the start
  47. and end position.  Generally, motions that move between lines affect lines
  48. (are linewise), and motions that move within a line affect characters (are
  49. characterwise).  However, there are some exceptions.
  50.  
  51. A character motion is either inclusive or exclusive. When inclusive, the start
  52. and end position of the motion are included in the operation.  When exclusive,
  53. the last character towards the end of the buffer is not included.  Linewise
  54. motions always include the start and end position.
  55.  
  56. Which motions are linewise, inclusive or exclusive is mentioned below.  There
  57. are however, two general exceptions:
  58. 1. If the motion is exclusive and the end of the motion is in column 1, the
  59.    end of the motion is moved to the end of the previous line and the motion
  60.    becomes inclusive.  Example: "}" ends at the first line after a paragraph,
  61.    but "V}" will not include that line.
  62. 2. If the motion is exclusive, the end of the motion is in column 1 and the
  63.    start of the motion was at or before the first non-blank in the line, the
  64.    motion becomes linewise.  Example: If a paragraph begins with some blanks
  65.    and you do "d}" while standing on the first non-blank, all the lines of
  66.    the paragraph are deleted, including the blanks.  If you do a put now, the
  67.    deleted lines will be inserted below the cursor position.
  68.  
  69. Note that when the operator is pending (the operator command is typed, but the
  70. motion isn't yet), a special set of mappings can be used.  See |:omap|.
  71.  
  72. Instead of first giving the operator and then a motion you can use Visual
  73. mode: mark the start of the text with "v", move the cursor to the end of the
  74. text that is to be affected and then hit the operator.  The text between the
  75. start and the cursor position is highlighted, so you can see what text will
  76. be operated upon.  This allows much more freedom, but requires more key
  77. strokes and has limited redo functionality.  See the chapter on Visual mode
  78. |Visual-mode|.
  79.  
  80. If you want to know where you are in the file use the "CTRL-G" command
  81. |CTRL-G| or the "g CTRL-G command |g_CTRL-G|.  If you set the 'ruler' option,
  82. the cursor position is continuously shown in the status line (which slows down
  83. Vim a little).
  84.  
  85. NOTE: Experienced users prefer the hjkl keys because they are always right
  86. under their fingers.  Beginners often prefer the arrow keys, because they
  87. do not know what the hjkl keys do.  The mnemonic value of hjkl is clear from
  88. looking at the keyboard.  Think of j as an arrow pointing downwards.
  89.  
  90. ==============================================================================
  91. 2. Left-right motions                    *left-right-motions*
  92.  
  93. h        or                    *h*
  94. <Left>        or                    *<Left>*
  95. CTRL-H        or                    *CTRL-H* *<BS>*
  96. <BS>            [count] characters to the left (exclusive).
  97.             Note: If you prefer <BS> to delete a character, use
  98.             the mapping:
  99.                 :map CTRL-V<BS>        X
  100.             (to enter "CTRL-V<BS>" type the CTRL-V key, followed
  101.             by the <BS> key)
  102.             See |:fixdel| if the <BS> key does not do what you
  103.             want.
  104.  
  105. l        or                    *l*
  106. <Right>        or                    *<Right>* *<Space>*
  107. <Space>            [count] characters to the right (exclusive).
  108.  
  109.                             *0*
  110. 0            To the first character of the line (exclusive).  When
  111.             moving up or down, stay in same screen column (if
  112.             possible).
  113.  
  114.                             *<Home>* *<kHome>*
  115. <Home>            To the first character of the line (exclusive).  When
  116.             moving up or down, stay in same text column (if
  117.             possible).  Works like "1|", which differs from "0"
  118.             when the line starts with a <Tab>.  {not in Vi}
  119.  
  120.                             *^*
  121. ^            To the first non-blank character of the line
  122.             (exclusive).
  123.  
  124.                             *$* *<End>* *<kEnd>*
  125. $  or <End>        To the end of the line and [count - 1] lines downward
  126.             (inclusive).
  127.  
  128.                             *g0* *g<Home>*
  129. g0 or g<Home>        When lines wrap ('wrap on): To the first character of
  130.             the screen line (exclusive).  Differs from "0" when a
  131.             line is wider than the screen.
  132.             When lines don't wrap ('wrap' off): To the leftmost
  133.             character of the current line that is on the screen.
  134.             Differs from "0" when the first character of the line
  135.             is not on the screen.  {not in Vi}
  136.  
  137.                             *g^*
  138. g^            When lines wrap ('wrap' on): To the first non-blank
  139.             character of the screen line (exclusive).  Differs
  140.             from "^" when a line is wider than the screen.
  141.             When lines don't wrap ('wrap' off): To the leftmost
  142.             non-blank character of the current line that is on the
  143.             screen.  Differs from "^" when the first non-blank
  144.             character of the line is not on the screen.  {not in
  145.             Vi}
  146.  
  147.                             *g$* *g<End>*
  148. g$ or g<End>        When lines wrap ('wrap' on): To the last character of
  149.             the screen line and [count - 1] screen lines downward
  150.             (inclusive).  Differs from "$" when a line is wider
  151.             than the screen.
  152.             When lines don't wrap ('wrap' off): To the rightmost
  153.             character of the current line that is visible on the
  154.             screen.  Differs from "$" when the last character of
  155.             the line is not on the screen or when a count is used.
  156.             {not in Vi}
  157.  
  158.                             *bar*
  159. |            To screen column [count] in the current line
  160.             (exclusive).
  161.  
  162.                             *f*
  163. f{char}            To [count]'th occurrence of {char} to the right.  The
  164.             cursor is placed on {char} (inclusive).
  165.  
  166.                             *F*
  167. F{char}            To the [count]'th occurrence of {char} to the left.
  168.             The cursor is placed on {char} (inclusive).
  169.  
  170.                             *t*
  171. t{char}            Till before [count]'th occurrence of {char} to the
  172.             right.  The cursor is placed on the character left of
  173.             {char} (inclusive).
  174.  
  175.                             *T*
  176. T{char}            Till after [count]'th occurrence of {char} to the
  177.             left.  The cursor is placed on the character right of
  178.             {char} (inclusive).
  179.  
  180.                             *;*
  181. ;            Repeat latest f, t, F or T [count] times.
  182.  
  183.                             *,*
  184. ,            Repeat latest f, t, F or T in opposite direction
  185.             [count] times.
  186.  
  187. These commands move the cursor to the specified column in the current line.
  188. They stop at the first column and at the end of the line, except "$", which
  189. may move to one of the next lines.  See 'whichwrap' option to make some of the
  190. commands move accross line boundaries.
  191.  
  192. ==============================================================================
  193. 3. Up-down motions                    *up-down-motions*
  194.  
  195. k        or                    *k*
  196. <Up>        or                    *<Up>* *CTRL-P*
  197. CTRL-P            [count] lines upward (linewise).
  198.  
  199. j        or                    *j*
  200. <Down>        or                    *<Down>*
  201. CTRL-J        or                    *CTRL-J*
  202. <NL>        or                    *<NL>* *CTRL-N*
  203. CTRL-N            [count] lines downward (linewise).
  204.  
  205. gk        or                    *gk* *g<Up>*
  206. g<Up>            [count] display lines upward (exclusive).  Differs
  207.             from 'k' when lines wrap, and when used with an
  208.             operator, because it's not linewise.  {not in Vi}
  209.  
  210. gj        or                    *gj* *g<Down>*
  211. g<Down>            [count] display lines downward (exclusive).  Differs
  212.             from 'j' when lines wrap, and when used with an
  213.             operator, because it's not linewise.  {not in Vi}
  214.  
  215.                             *-*
  216. -  <minus>        [count] lines upward, on the first non-blank
  217.             character (linewise).
  218.  
  219. +        or                    *+*
  220. CTRL-M        or                    *CTRL-M* *<CR>*
  221. <CR>            [count] lines downward, on the first non-blank
  222.             character (linewise).
  223.  
  224.                             *_*
  225. _  <underscore>        [count] - 1 lines downward, on the first non-blank
  226.             character (linewise).
  227.  
  228. <C-End>        or                    *G* *<C-End>*
  229. G            Goto line [count], default last line, on the first
  230.             non-blank character (linewise).  If 'startofline' not
  231.             set, keep the same column.
  232.  
  233. <C-Home>    or                    *gg* *<C-Home>*
  234. gg            Goto line [count], default first line, on the first
  235.             non-blank character (linewise).  If 'startofline' not
  236.             set, keep the same column.
  237.  
  238. :[range]        Set the cursor on the (last) specified line number
  239.             (cannot be used with an operator).
  240.  
  241.                             *N%*
  242. {count}%        Go to {count} percentage in the file, on the first
  243.             non-blank in the line (linewise).  To compute the new
  244.             line number this formula is used: {count} *
  245.             number-of-lines / 100.  See also 'startofline'
  246.             option.  {not in Vi}
  247.  
  248. These commands move to the specified line.  They stop when reaching the first
  249. or the last line.  The first two commands put the cursor in the same column
  250. (if possible) as it was after the last command that changed the column,
  251. except after the "$" command, then the cursor will be put on the last
  252. character of the line.
  253.  
  254. ==============================================================================
  255. 4. Word motions                        *word-motions*
  256.  
  257. <S-Right>    or                    *<S-Right>* *w*
  258. w            [count] words forward (exclusive).
  259.  
  260. <C-Right>    or                    *<C-Right>* *W*
  261. W            [count] WORDS forward (exclusive).
  262.  
  263.                             *e*
  264. e            Forward to the end of word [count] (inclusive).
  265.  
  266.                             *E*
  267. E            Forward to the end of WORD [count] (inclusive).
  268.  
  269. <S-Left>    or                    *<S-Left>* *b*
  270. b            [count] words backward (exclusive).
  271.  
  272. <C-Left>    or                    *<C-Left>* *B*
  273. B            [count] WORDS backward (exclusive).
  274.  
  275.                             *ge*
  276. ge            Backward to the end of word [count] (inclusive).
  277.  
  278.                             *gE*
  279. gE            Backward to the end of WORD [count] (inclusive).
  280.  
  281. These commands move over words or WORDS.
  282.                             *word*
  283. A word consists of a sequence of letters, digits and underscores, or a
  284. sequence of other non-blank characters, separated with white space (spaces,
  285. tabs, <EOL>).  This can be changed with the 'iskeyword' option.
  286.                             *WORD*
  287. A WORD consists of a sequence of non-blank characters, separated with white
  288. space.  An empty line is also considered to be a word and a WORD.
  289.  
  290. Special case: "cw" and "cW" are treated like "ce" and "cE" if the cursor is
  291. on a non-blank.  This is because "cw" is interpreted as change-word, and a
  292. word does not include the following white space.  {Vi: "cw" when on a blank
  293. followed by other blanks changes only the first blank; this is probably a
  294. bug, because "dw" deletes all the blanks}
  295.  
  296. Another special case: When using the "w" motion in combination with an
  297. operator and the last word moved over is at the end of a line, the end of
  298. that word becomes the end of the operated text, not the first word in the
  299. next line.
  300.  
  301. The original Vi implementation of "e" is buggy.  For example, the "e" command
  302. will stop on the first character of a line if the previous line was empty.
  303. But when you use "2e" this does not happen.  In Vim "ee" and "2e" are the
  304. same, which is more logical.  However, this causes a small incompatibility
  305. between Vi and Vim.
  306.  
  307. ==============================================================================
  308. 5. Text object motions                    *object-motions*
  309.  
  310.                             *(*
  311. (            [count] sentences backward (exclusive).
  312.  
  313.                             *)*
  314. )            [count] sentences forward (exclusive).
  315.  
  316.                             *{*
  317. {            [count] paragraphs backward (exclusive).
  318.  
  319.                             *}*
  320. }            [count] paragraphs forward (exclusive).
  321.  
  322.                             *]]*
  323. ]]            [count] sections forward or to the next '{' in the
  324.             first column.  When used after an operator, then the
  325.             '}' in the first column.  (linewise).
  326.  
  327.                             *][*
  328. ][            [count] sections forward or to the next '}' in the
  329.             first column (linewise).
  330.  
  331.                             *[[*
  332. [[            [count] sections backward or to the previous '{' in
  333.             the first column (linewise).
  334.  
  335.                             *[]*
  336. []            [count] sections backward or to the previous '}' in
  337.             the first column (linewise).
  338.  
  339. These commands move over three kinds of text objects.
  340.  
  341.                             *sentence*
  342. A sentence is defined as ending at a '.', '!' or '?' followed by either the
  343. end of a line, or by a space.  {Vi: two spaces} Any number of closing ')',
  344. ']', '"' and ''' characters my appear after the '.', '!' or '?' before the
  345. spaces or end of line.  A paragraph and section boundary is also a sentence
  346. boundary.  The definition of a sentence cannot be changed.
  347.  
  348.                             *paragraph*
  349. A paragraph begins after each empty line, and also at each of a set of
  350. paragraph macros, specified by the pairs of characters in the 'paragraphs'
  351. option.  The default is "IPLPPPQPP LIpplpipbp", which corresponds to the
  352. macros ".IP", ".LP", etc.  (These are nroff macros, so the dot must be in the
  353. first column).  A section boundary is also a paragraph boundary.  Note that
  354. this does not include a '{' or '}' in the first column.
  355.  
  356.                             *section*
  357. A section begins after a form-feed (<C-L>) in the first column and at each of
  358. a set of section macros, specified by the pairs of characters in the
  359. 'sections' option.  The default is "SHNHH HUnhsh", which defines a section to
  360. start at the nroff macros ".SH", ".NH", ".H", ".HU", ".nh" and ".sh".
  361.  
  362. The "]" and "[" commands stop at the '{' or '}' in the first column.  This is
  363. useful to find the start or end of a function in a C program.  Note that the
  364. first character of the command determines the search direction and the
  365. second character the type of brace found.
  366.  
  367. If your '{' or '}' are not in the first column, and you would like to use "[["
  368. and "]]" anyway, try these mappings:
  369. >  :map [[ ?{<CR>w99[{
  370. >  :map ][ /}<CR>b99]}
  371. >  :map ]] j0[[%/{<CR>
  372. >  :map [] k$][%?}<CR>
  373. [type these literally, see |<>|]
  374.  
  375. ==============================================================================
  376. 6. Text object selection            *object-select* *text-objects*
  377.  
  378. This is a series of commands that can only be used while in Visual mode or
  379. after an operator.  The commands that start with "a" select "a"n object
  380. including white space, the commands starting with "i" select an "inner" object
  381. without white space, or just the white space.  Thus the "inner" commands
  382. always select less text than the "a" commands.
  383.  
  384. These commands are {not in Vi}.
  385. These commands are not available when the |+textobjects| feature has been
  386. disabled at compile time.
  387.                             *v_aw*
  388. aw            "a word", select [count] words (see |word|).
  389.             Leading or trailing white space is included, but not
  390.             counted.
  391.  
  392.                             *v_iw*
  393. iw            "inner word", select [count] words (see |word|).
  394.             White space between words is counted too.
  395.  
  396.                             *v_aW*
  397. aW            "a WORD", select [count] WORDs (see |WORD|).
  398.             Leading or trailing white space is included, but not
  399.             counted.
  400.  
  401.                             *v_iW*
  402. iW            "inner WORD", select [count] WORDs (see |WORD|).
  403.             White space between words is counted too.
  404.  
  405.                             *v_as*
  406. as            "a sentence", select [count] sentences (see
  407.             |sentence|).
  408.  
  409.                             *v_is*
  410. is            "inner sentence", select [count] sentences (see
  411.             |sentence|).
  412.  
  413.                             *v_ap*
  414. ap            "a paragraph", select [count] paragraphs (see
  415.             |paragraph|).
  416.  
  417.                             *v_ip*
  418. ip            "inner paragraph", select [count] paragraphs (see
  419.             |paragraph|).
  420.  
  421. a]                            *v_a]* *v_a[*
  422. a[            "a [] block", select [count] '[' ']' blocks.  This
  423.             goes backwards to the [count] unclosed '[', and finds
  424.             the matching ']'.  The enclosed text is selected,
  425.             including the '[' and ']'.
  426.  
  427. i]                            *v_i]* *v_i[*
  428. i[            "inner [] block", select [count] '[' ']' blocks.  This
  429.             goes backwards to the [count] unclosed '[', and finds
  430.             the matching ']'.  The enclosed text is selected,
  431.             excluding the '[' and ']'.
  432.  
  433. a)                            *v_a)*
  434. a(                            *v_ab* *v_a(*
  435. ab            "a block", select [count] blocks, from "[count] [(" to
  436.             the matching ')', including the '(' and ')' (see
  437.             |[(|).
  438.  
  439. i)                            *v_i)*
  440. i(                            *v_ib* *v_i(*
  441. ib            "inner block", select [count] blocks, from "[count] [("
  442.             to the matching ')', excluding the '(' and ')' (see
  443.             |[(|).
  444.  
  445. a>                            *v_a>* *v_a<*
  446. a<            "a <> block", select [count] <> blocks, from the
  447.             [count]'th unmatched '<' backwards to the matching
  448.             '>', including the '<' and '>'.
  449.  
  450. i>                            *v_i>* *v_i<*
  451. i<            "inner <> block", select [count] <> blocks, from
  452.             the [count]'th unmatched '<' backwards to the matching
  453.             '>', excluding the '<' and '>'.
  454.  
  455. a}                            *v_a}*
  456. a{                            *v_aB* *v_a{*
  457. aB            "a Block", select [count] Blocks, from "[count] [{" to
  458.             the matching '}', including the '{' and '}' (see
  459.             |[{|).
  460.  
  461. i}                            *v_i}*
  462. i{                            *v_iB* *v_i{*
  463. iB            "inner Block", select [count] Blocks, from "[count] [{"
  464.             to the matching '}', excluding the '{' and '}' (see
  465.             |[{|).
  466.  
  467. When used after an operator:
  468. For non-block objects:
  469.     For the "a" commands: The operator applies to the object and the white
  470.     space after the object.  If there is no white space after the object
  471.     or when the cursor was in the white space before the object, the white
  472.     space before the object is included.
  473.     For the "inner" commands: If the cursor was on the object, the
  474.     operator applies to the object.  If the cursor was on white space, the
  475.     operator applies to the white space.
  476. For a block object:
  477.     The operator applies to the block where the cursor is in, or the block
  478.     on which the cursor is on one of the braces.  For the "inner" commands
  479.     the surrounding braces are excluded.  For the "a" commands, the braces
  480.     are included.
  481.  
  482. When used in Visual mode:
  483. When start and end of the Visual area are the same (just after typing "v"):
  484.     One object is selected, the same as for using an operator.
  485. When start and end of the Visual area are not the same:
  486.     For non-block objects the area is extended by one object or the white
  487.     space up to the next object, or both for the "a" objects.  The
  488.     direction in which this happens depends on which side of the Visual
  489.     area the cursor is.  For the block objects the block is extended one
  490.     level outwards.
  491.  
  492. For illustration, here is a list of delete commands, grouped from small to big
  493. objects.  Note that for a single character and a whole line the existing vi
  494. movement commands are used.
  495.     "dl"    delete character (alias: "x")        |dl|
  496.     "diw"    delete inner word            *diw*
  497.     "daw"    delete a word                *daw*
  498.     "diW"    delete inner WORD (see |WORD|)        *diW*
  499.     "daW"    delete a WORD (see |WORD|)        *daW*
  500.     "dd"    delete one line                |dd|
  501.     "dis"    delete inner sentence            *dis*
  502.     "das"    delete a sentence            *das*
  503.     "dib"    delete inner '(' ')' block        *dib*
  504.     "dab"    delete a '(' ')' block            *dab*
  505.     "dip"    delete inner paragraph            *dip*
  506.     "dap"    delete a paragraph            *dap*
  507.     "diB"    delete inner '{' '}' block        *diB*
  508.     "daB"    delete a '{' '}' block            *daB*
  509.  
  510. Note the difference between using a movement command and an object.  The
  511. movement command operates from here (cursor position) to where the movement
  512. takes us.  When using an object the whole object is operated upon, no matter
  513. where on the object the cursor is.  For example, compare "dw" and "da": "dw"
  514. deletes from the cursor position to the start of the next word, "da" deletes
  515. the word under the cursor and the space after or before it.
  516.  
  517. ==============================================================================
  518. 7. Various motions                *various-motions*
  519.  
  520.                         *m*
  521. m<a-zA-Z>        Set mark <a-zA-Z> at cursor position (does not move
  522.             the cursor, this is not a motion command).
  523.  
  524. m'  or  m`        Set the previous context mark.  This can be jumped to
  525.             with the "''" or "``" command (does not move the
  526.             cursor, this is not a motion command).
  527.  
  528.                         *:ma* *:mark*
  529. :[range]ma[rk] <a-zA-Z>    Set mark <a-zA-Z> at last line number in [range],
  530.             column 0.  Default is cursor line.
  531.  
  532.                         *:k*
  533. :[range]k<a-zA-Z>    Same as :mark, but the space before the mark name can
  534.             be omitted.
  535.  
  536.                         *'* *'a*
  537. '<a-z>            To the first non-blank character on the line with
  538.             mark <a-z> (linewise).
  539.                         *'A* *'0*
  540. '<A-Z0-9>        To the first non-blank character on the line with
  541.             mark <A-Z0-9> in the correct file (linewise when in
  542.             same file, not a motion command when in other file).
  543.             {not in Vi}
  544.  
  545.                         *`* *`a*
  546. `<a-z>            To the mark <a-z> (exclusive).
  547.                         *`A* *`0*
  548. `<A-Z0-9>        To the mark <A-Z0-9> in the correct file (exclusive
  549.             when in same file, not a motion command when in
  550.             other file).  {not in Vi}
  551.  
  552.                         *:marks*
  553. :marks            List all the current marks (not a motion command).
  554.             {not in Vi}
  555.  
  556. :marks {arg}        List the marks that are mentioned in {arg} (not a
  557.             motion command).  For example:
  558. >                :marks aB
  559.             to list marks 'a' and 'B'.  {not in Vi}
  560.  
  561. A mark is not visible in any way.  It is just a position in the file that is
  562. remembered.  Do not confuse marks with named registers, they are totally
  563. unrelated.
  564.  
  565. 'a - 'z        lowercase marks, valid within one file
  566. 'A - 'Z        uppercase marks, also called file marks, valid between files
  567. '0 - '9        numbered marks, set from .viminfo file
  568.  
  569. Lowercase marks 'a to 'z are remembered as long as the file remains in the
  570. buffer list.  If you remove the file from the buffer list, all its marks are
  571. lost.  If you delete a line that contains a mark, that mark is erased.
  572. Lowercase marks can be used in combination with operators.  For example: "d't"
  573. deletes the lines from the cursor position to mark 't'.  Hint: Use mark 't' for
  574. Top, 'b' for Bottom, etc..  Lowercase marks are restored when using undo and
  575. redo.
  576.  
  577. Uppercase marks 'A to 'Z include the file name.  {Vi: no uppercase marks} You
  578. can use them to jump from file to file.  You can only use an uppercase mark
  579. with an operator if the mark is in the current file.  The line number of the
  580. mark remains correct, even if you insert/delete lines or edit another file for
  581. a moment.  When the 'viminfo' option is not empty, uppercase marks are kept in
  582. the .viminfo file.  See |viminfo-file-marks|.
  583.  
  584. Numbered marks '0 to '9 are quite different.  They can not be set directly.
  585. They are only present when using a viminfo file |viminfo-file|.  Basically '0
  586. is the location of the cursor when you last exited Vim, '1 the last but one
  587. time, etc.  See |viminfo-file-marks|.
  588.  
  589.                             *'[*
  590. '[            To the first non-blank character on the first line
  591.             of the previously operated, inserted or putted text.
  592.             {not in Vi}
  593.  
  594.                             *`[*
  595. `[            To the first character of the previously operated,
  596.             inserted or putted text.  {not in Vi}
  597.  
  598.                             *']*
  599. ']            To the first non-blank character on the last line of
  600.             the previously operated, inserted  or putted text.
  601.             {not in Vi}
  602.  
  603.                             *`]*
  604. `]            To the last character of the previously operated,
  605.             inserted or putted text. {not in Vi}
  606.  
  607. After executing an operator the Cursor is put at the beginning of the text
  608. that was operated upon.  After a put command ("p" or "P") the cursor is
  609. sometimes placed at the first inserted line and sometimes on the last inserted
  610. character.  The four commands above put the cursor at either end.  Example:
  611. After yanking 10 lines you want to go to the last one of them: "10Y']".  After
  612. inserting several lines with the "p" command you want to jump to the lowest
  613. inserted line: "p']".  This also works for text that has been inserted.
  614.  
  615. Note: After deleting text, the start and end positions are the same, except
  616. when using blockwise Visual mode.  These commands do not work when no
  617. operator, file-read or put command has been used yet in the current file.
  618.  
  619.                             *'<*
  620. '<            To the first non-blank character on the first line
  621.             of the last selected Visual area in the current
  622.             buffer.  {not in Vi}.
  623.  
  624.                             *`<*
  625. `<            To the first character of the last selected Visual
  626.             area in the current buffer.  {not in Vi}.
  627.  
  628.                             *'>*
  629. '>            To the first non-blank character on the last line
  630.             of the last selected Visual area in the current
  631.             buffer.  {not in Vi}.
  632.  
  633.                             *`>*
  634. `>            To the last character of the last selected Visual
  635.             area in the current buffer.  {not in Vi}.
  636.  
  637.                             *''*
  638. ''            To the first non-blank character of the line where
  639.             the cursor was before the latest jump, or where the
  640.             last "m'" or "m`" command was given (linewise).
  641.  
  642.                             *``*
  643. ``            To the position before latest jump, or where the last
  644.             "m'" or "m`" command was given (exclusive).
  645.  
  646.                             *'quote*
  647. '"            To the first non-blank character of the line where
  648.             the cursor was the last time the current buffer was
  649.             exited (linewise).  Defaults to the first line.  {not
  650.             in Vi}.
  651.  
  652.                             *`quote*
  653. `"            To the cursor position when last exiting the current
  654.             buffer (exclusive).  Defaults to the first character
  655.             of the first line.  {not in Vi}.
  656.  
  657. A "jump" is one of the following commands: "'", "`", "G", "/", "?", "n",
  658. "N", "%", "(", ")", "[[", "]]", "{", "}", ":s", ":tag", "L", "M", "H" and
  659. the commands that start editing a new file.  If you make the cursor "jump"
  660. with one of these commands, the position of the cursor before the jump is
  661. remembered.  You can return to that position with the "''" and "``" command,
  662. unless the line containing that position was changed or deleted.
  663.  
  664.                             *CTRL-O*
  665. CTRL-O            Go to [count] Older cursor position in jump list
  666.             (not a motion command).  {not in Vi}
  667.  
  668. <Tab>        or                    *CTRL-I* *<Tab>*
  669. CTRL-I            Go to [count] newer cursor position in jump list
  670.             (not a motion command).  {not in Vi}
  671.  
  672.                             *:ju* *:jumps*
  673. :ju[mps]        Print the jump list (not a motion command).  {not in
  674.             Vi}
  675.  
  676.                             *jumplist*
  677. Jumps are remembered in a jump list.  With the CTRL-O and CTRL-I command you
  678. can go to cursor positions before older jumps, and back again.  Thus you can
  679. move up and down the list.  There is a separate jump list for each window.
  680. The maximum number of entries is fixed at 50.
  681.  
  682. For example, after three jump commands you have this jump list:
  683.  
  684.   jump line  file
  685.     3      1  -current-
  686.     2     70  -current-
  687.     1  1154  -current-
  688.  >
  689.  
  690. You are currently in line 1167.  If you then use the CTRL-O command, the
  691. cursor is put in line 1154.  This results in:
  692.  
  693.   jump line  file
  694.     2      1  -current-
  695.     1     70  -current-
  696.  >  0  1154  -current-
  697.     1  1167  -current-
  698.  
  699. The pointer will be set at the last used jump position.  The next CTRL-O
  700. command will use the entry above it, the next CTRL-I command will use the
  701. entry below it.  If the pointer is below the last entry, this indicates that
  702. you did not use a CTRL-I or CTRL-O before.  In this case the CTRL-O command
  703. will cause the cursor position to be added to the jump list, so you can get
  704. back to the position before the CTRL-O.  In this case this is line 1167.
  705.  
  706. With more CTRL-O commands you will go to lines 70 and 1.  If you use CTRL-I
  707. you can go back to 1154 and 1167 again.  Note that the number in the "jump"
  708. column indicates the count for the CTRL-O or CTRL-I command that takes you to
  709. this position.
  710.  
  711. If you use a jump command, the current line number is inserted at the end of
  712. the jump list.  If the same line was already in the jump list, it is removed.
  713. The result is that when repeating CTRL-O you will get back to old positions
  714. only once.
  715.  
  716. After the CTRL-O command that got you into line 1154 you could give another
  717. jump command (e.g., "G").  The jump list would then become:
  718.  
  719.   jump line  file
  720.     4      1  -current-
  721.     3     70  -current-
  722.     2  1167  -current-
  723.     1  1154  -current-
  724.  >
  725.  
  726. The line numbers will be adjusted for deleted and inserted lines.  This fails
  727. if you stop editing a file without writing, like with ":n!".
  728.  
  729.                             *%*
  730. %            Find the next item in this line after or under the
  731.             cursor and jump to its match (inclusive).  Items can
  732.             be:
  733.             ([{}])        parenthesis or (curly/square) brackets
  734.                     (this can be changed with the
  735.                     'matchpairs' option)
  736.             /* */        start or end of C-style comment
  737.             #if, #ifdef, #else, #elif, #endif
  738.                     C preprocessor conditionals
  739.             Parens and braces preceded with a backslash are
  740.             ignored.  When the '%' character is not present in
  741.             'cpoptions', parens and braces inside double quotes
  742.             are ignored, unless the number of parens/braces in a
  743.             line is uneven and this line and the previous one does
  744.             not end in a backslash.  '(', '{', '[', ']', '}' and
  745.             ')' are also ignored (parens and braces inside single
  746.             quotes).  Note that this works fine for C, but not for
  747.             Perl, where single quotes are used for strings.
  748.             No count is allowed ({count}% jumps to a line {count}
  749.             percentage down the file).  Using '%' on
  750.             #if/#else/#endif makes the movement linewise.
  751.  
  752.                         *[(*
  753. [(            go to [count] previous unmatched '('.  {not in Vi}
  754.  
  755.                         *[{*
  756. [{            go to [count] previous unmatched '{'.  {not in Vi}
  757.  
  758.                         *])*
  759. ])            go to [count] next unmatched ')'.  {not in Vi}
  760.  
  761.                         *]}*
  762. ]}            go to [count] next unmatched '}'.  {not in Vi}
  763.  
  764. The above four commands can be used to go to the start or end of the current
  765. code block.  It is like doing "%" on the '(', ')', '{' or '}' at the other
  766. end of the code block, but you can do this from anywhere in the code block.
  767. Very useful for C programs.  Example: When standing on "case x:", "[{" will
  768. bring you back to the switch statement.
  769.  
  770.                         *[#*
  771. [#            go to [count] previous unmatched "#if" or "#else".
  772.             {not in Vi}
  773.  
  774.                         *]#*
  775. ]#            go to [count] next unmatched "#else" or "#endif".  {not
  776.             in Vi}
  777.  
  778. These two commands work in C programs that contain #if/#else/#endif
  779. constructs.  It brings you to the start or end of the #if/#else/#endif where
  780. the current line is included.  You can then use "%" to go to the matching line.
  781.  
  782.                         *[star* *[/*
  783. [*  or  [/        go to [count] previous start of a C comment "/*".  {not
  784.             in Vi}
  785.  
  786.                         *]star* *]/*
  787. ]*  or  ]/        go to [count] next end of a C comment "*/".  {not
  788.             in Vi}
  789.  
  790.  
  791.                         *H*
  792. H            To line [count] from top (Home) of screen (default:
  793.             first line on the screen) on the first non-blank
  794.             character (linewise).  See also 'startofline' option.
  795.             Cursor is adjusted for 'scrolloff' option.
  796.  
  797.                         *M*
  798. M            To Middle line of screen, on the first non-blank
  799.             character (linewise).  See also 'startofline' option.
  800.  
  801.                         *L*
  802. L            To line [count] from bottom of screen (default: Last
  803.             line on the screen) on the first non-blank character
  804.             (linewise).  See also 'startofline' option.
  805.             Cursor is adjusted for 'scrolloff' option.
  806.  
  807. <LeftMouse>        Moves to the position on the screen where the mouse
  808.             click is (inclusive).  See also |<LeftMouse>|.  If the
  809.             position is in a status line, that window is made the
  810.             active window and the cursor is not moved.  {not in Vi}
  811.  
  812.  vim:tw=78:ts=8:sw=8:
  813.