I have found a vim's short-key list https://hea-www.harvard.edu/~fine/Tech/vi.html. But, I don't understand the m command's role.

enter image description here

  • first of all : this list is either not for vim or very outdated. read :help mark-motions for details about m
    – Naumann
    Feb 12 '18 at 6:33

From :h m:

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

And a little bit under that:

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

Which means that with mx (where x is any letter) you can put a mark on a bufffer, this way you can go back to this place in the buffer whenever you want with 'x.

Note that:

  • lower case marks are local to a buffer while upper case marks can reach anyfile
  • You can use `x instead of 'x to reach the column where you put the mark
  • :marks list the current marks
  • :h mark-motions is a good place to start with marks.
  • I have a file containing This is a tutorial file text. I type mf when cursor is in column 0 then type 'f. Nothing is happened.
    – alhelal
    Feb 12 '18 at 8:45
  • 2
    move your cursor before typing 'f or ``f` Feb 12 '18 at 8:53
  • @alhelal Christian is right: create a second line in your buffer, go to this second line and then try to use the mark motion. Also, note that if you don't already use marks nothing force you to use them if they don't fit your workflow.
    – statox
    Feb 12 '18 at 9:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.