Oeasy teaches you to play VIM – 20 – display ruler

Time:2022-5-6

Display ruler

Recall the last lesson

  • 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?

Displays the current location

#First, let VI edit / etc / passwd in modeless mode
vi -u NONE /etc/passwd
  • ctrl + g
  • perhaps:f[ile]
  • It can be on the bottom line

    • See the currently edited file
    • And the location of the file

Oeasy teaches you to play VIM - 20 - display ruler

Display ruler

  • If you want to display the cursor position all the time

    • You need a ruler
    • RulerIt’s aSwitch option
  • What is a switch?

    • It’s where you can turn it on or off
  • RulerThe name of the switch isrulerruler

    • You can turn on the ruler
    • You can also turn off the ruler
  • How does this switch open and close?

Make settings

  • rulerThe label can be used:setSet in this way

    • :se[t] ru[ler]You can set the ruler to be visible
    • :se[t] noru[ler]You can set the ruler invisible
  • numberLabels can also be used:setSet in this way

    • :se[t] nu[mber]You can set the line number
    • :se[t] nonu[mber]You can set the line number invisible
  • It can also be opened together

    • :se nu ru
  • Or both close together

    • :se noru nonu
  • It’s all some blue cotton curtain

Oeasy teaches you to play VIM - 20 - display ruler

About switch

  • The switch isoptions

    • You can set whether the ruler is displayed in the current document
    • You can also set whether the current document wraps automatically
    • The switch is not directly related to the document we edit
    • But it determines the current display status
  • have access to:options

    • openoptions.txtseeAllSwitch of
    • /rulerFind in current filerulerThis switch

Oeasy teaches you to play VIM - 20 - display ruler

  • How do I knowRuler switchCurrent status?

View switch

  • View switch status?
  • Can I pass? To view the switch status

    • :set number?
    • :set ruler?
  • You can try

Oeasy teaches you to play VIM - 20 - display ruler

  • If I want to reset the switch to the initial state
  • What should I do?

Reset switch&

  • Reset switch status&
  • Directly reset the switch to the default value

    • :set number&
    • :set ruler&

Oeasy teaches you to play VIM - 20 - display ruler

Ruler details

  • :optionsYou can get a simple explanation in one line
  • If you want more detailed information
  • You can also pass:h 'ruler'Find the details of this option switch

Oeasy teaches you to play VIM - 20 - display ruler

Ruler details

Oeasy teaches you to play VIM - 20 - display ruler

  • You can see the ruler in the lower right corner
  • The ruler places the cursor at80*24Clearly marked on the screen
  • Separate with commasLine numberandColumn number
  • Line numberThe display switch is:se nu
  • Column numberIs the sequence number of the column where the current cursor is located

Jump

  • Jump to line

    • 2 9 GThe command jumps to line 29
    • :33Quick jump to line 33
  • Jump to column

    • 19 |
    • Jump to column 19 with command

Oeasy teaches you to play VIM - 20 - display ruler

Ruler details

  • There are some words written on the right side of the ruler

    • Sometimes inTop, line 1 of the file is at the top of the screen
    • Sometimes inbottom, the last line of the file is at the bottom of the screen
    • Sometimes inwhole, the file is very short, and the whole screen is displayed

Oeasy teaches you to play VIM - 20 - display ruler

Display command

  • use:set showcmdYou can see the command used on the left side of the ruler

    • showdisplay
    • cmdcommand
  • 1 9 GCommand jump line number
  • Press character by character
  • observe variances
  • In this way, we can see the command input

Oeasy teaches you to play VIM - 20 - display ruler

Jump in percentage

  • There is a percentage after the row and column number
  • Sometimes it is a percentage. The scale is the cursor line number divided by the total line number of the file
  • have access to29 %Skip to entire file29%Location of

Oeasy teaches you to play VIM - 20 - display ruler

Set the number of history records

  • :set history=100
  • In this way, you can find the commands that have been executed up and down the keyboard
  • :h 'history'

Oeasy teaches you to play VIM - 20 - display ruler

summary

  • We studied the ruler this time
  • Ruler

    • opense ru
    • closese noru
  • Line number

    • opense nu
    • closese nonu
  • Command location

    • opense showcmd
    • closese noshowcmd
  • Jump

    • use29 GJump line number
    • use19 |Jump column number
    • use29 %Skip to 29% of the entire file
  • Is there anything else interesting?
  • Next time