Oeasy teaches you to play VIM – 17 – # up and down


Up and down

Recall the last lesson

  • andfRelated is to jump to

    • towardsfrontJump to yesf
    • towardsafterJump to yesF
  • andtRelated is to stick

    • towardsfrontClose yest
    • towardsafterClose yesT
  • anda lowercase letterRelated isforward

    • forwardJump isf
    • forwardClose yest
  • andCapitalizeRelated isbackward

    • backwardJump isF
    • backwardClose yesT
  • And continueFind directionRelated is;,

    • Keep directionyes;
    • Change directionyes,

Up and down

  • This time, it is still in no parameter mode
  • :set nocompatibleSet to incompatiblevi

    • It means to usevimProcess commands in the same way
  • motionofMove left and rightThenMove up and down

    • have access toenterLine feed
    • You can also use the arrow keys up or down
    • More commonlyjk, because they are based on basic location

      • jIs down
      • kIt’s up
      • 5 jIs to move the cursor down five lines
      • 5 kIs to make the cursor up five lines
    • Keep turning down

Oeasy teaches you to play VIM - 17 - # up and down

Uplink and downlink head

Oeasy teaches you to play VIM - 17 - # up and down

  • pluspluscorresponding+

    • Corresponding keyboardshift + =
  • minus signminuscorresponding-
  • Jump up and down to the beginning of the line

    • +towardslowerAnd to the linefirstNon null character
    • -towardsupperAnd to the linefirstNon null character
  • Correspondence

    • +amount toj ^
    • -amount tok ^

First and last lines

Oeasy teaches you to play VIM - 17 - # up and down

  • g gcorrespondingFirst line
  • GcorrespondingBiko
  • If the article is very long, it is very convenient to jump directly
  • OneGRight thereGround
  • If you want to go back to the beginning, you can use itg g

    • I don’t know why these two letters are particularly skilled
    • Skilled people heartache!
  • There is another combinationGo
  • For example, add a long configuration fileG o

    • GGo straight to the end
    • oInsert in the next line
  • Two keysGoget up
  • ctrl+cReturn to normal mode
  • ggJust go back to the beginning

    • Another game

Auto indent

  • Of course, it’s not all painful memories
  • g gmatchGIt’s the most convenient automatic indentation I’ve ever seen

    • g g = GAuto indent from first line to last line
    • This file may have 500 lines,
    • But it’s all indented at once
  • Not only programs, web pages, CSS and configuration files can be automatically tightened

    • In this way, the code is sorted very quickly
  • Programmers work in normal mode more often

    • Browse, search, skip, copy, paste
    • Really focus on writing code and then switch to the insert state.
    • Other editors always have only one insert state
    • In fact, it wastes a lot of keyboard functions
    • This is also normal mode, which is called normal mode

      • The reason why it is regarded as the default mode.
  • g g = GThis is great!!!

Oeasy teaches you to play VIM - 17 - # up and down


  • Up and down

    • towardsloweryesj👇
    • towardsupperyesk👆
  • Uplink and downlink head

    • towardslowerTo non empty character at the beginning of line+
    • towardsupperTo non empty character at the beginning of line-
    • thesemotionCan be added[count]To double
  • First and last lines

    • The first line isg g
    • The last line isG
    • g g = GIs auto indent all
    • GThere seem to be other uses?
  • What usage?
  • Next time

Recommended Today

Description of SQL Server database renaming and data export

The first problem is renaming the database: you cannot rename the database directly in the enterprise manager, but only in the query analyzer Copy codeThe code is as follows: create proc killspid (@dbname varchar(20))         as         begin         declare     @sql     nvarchar(500),@temp   varchar(1000)     declare     @spid     int         set     @sql=’declare     getspid     cursor     for             select     […]