Oeasy teaches you to play with VIM – 19 – using tags

Time:2022-5-8

Use tag

Recall the last lesson

  • Jump to line number

    • 200G
  • Set line number options

    • set number :se nu
    • Show relative line numbers:se rnu
  • How to jump from the command line:100
  • But sometimes I can’t remember how many lines I jump to
  • Can you make a mark and leave a mark?

Jump back to where you are

  • If I useGJump to final line
  • Then I want to go back to where I was before the jump

    • Not justGCorresponding jump package
    • It also includes line jump, search, etc
  • Where is the pre jump position?

    • We can useReturn to the position before the jump
    • `Position on keyboard1front
    • This character is our backquote
    • be calledopen single quote chararcter
    • You can try to play
  • Jump over and over
  • Repeated lateral jump
  • But this can only jump back and forth between two positions

Oeasy teaches you to play with VIM - 19 - using tags

  • I want to jump to where I was a long time ago
  • What shall I do?

Jump List

  • All previous jumps are in the jump list
  • For example, we are from

    • The first line jumps to33that ‘s ok
    • Then jump to the line starting with ^ the

Oeasy teaches you to play with VIM - 19 - using tags

  • Ctrl-o jump to

    • Older position
    • Last time
    • Last time last time
  • Ctrl-i jump to

    • another time
    • Next time next time

Oeasy teaches you to play with VIM - 19 - using tags

  • We used the jump position hereMark mark

Query help

Oeasy teaches you to play with VIM - 19 - using tags

  • useh(elp) m(arks)Query help on tags

    • have access tomaTo make a marka
    • Then you can use'aOr ` a to jump

Define and test

  • :se nuSet display line number
  • usemaMark the position of the current cursora
  • thenGJump to final line
  • You can’t see this mark in the document
  • :marksTo view all tags

    • Note that this mark contains the specific positions of rows and columns
    • A corresponds to 795 rows and 6 columns

Oeasy teaches you to play with VIM - 19 - using tags

Other tags

  • maWe defined it ourselvesasign
  • What do other marks mean?
  • We can use:h ''Look''Meaning of

Oeasy teaches you to play with VIM - 19 - using tags

More tags

  • ''Is the position of the cursor of the last jump operation
  • '"Is the location where the current file was last exited
  • '[Is the starting position of the last edit (delete, modify, etc.)
  • ']Is the end position of the last edit (delete, modify, etc.)
  • '.It is the last operation position of the last edit (delete, modify, etc.)

Oeasy teaches you to play with VIM - 19 - using tags

  • So, what’s the difference between the upper case, lower case and number marks?

Marking details

Oeasy teaches you to play with VIM - 19 - using tags

  • a lowercase lettera-zYou can mark the location coordinates inside this document
  • CapitalizeA-ZYou can mark location coordinates across files
  • number0-9In the configuration file.viminfoIn, you can keep the tag
  • We can also use:delm(arks) aTo deleteasign

summary

  • Define tag ama
  • Delete tag a:delm a
  • Jump to tag a'a

    • `A jumps to the row and column corresponding to a
    • ‘a jumps to the row corresponding to’ a ‘
  • View all tags:marks
  • Various marking types

    • ''Is the position of the cursor of the last jump operation
    • '"Is the location where the current file was last exited
    • '[Is the starting position of the last edit (delete, modify, etc.)
    • ']Is the end position of the last edit (delete, modify, etc.)
    • a lowercase lettera-zYou can mark the location coordinates inside this document
    • CapitalizeA-ZYou can mark location coordinates across files
    • number0-9In the configuration file~/.viminfoIn, you can keep the tag
  • Every timectrl + gDisplay coordinates
  • Can I always display coordinates?
  • Next time