Oeasy teaches you to play VIM – 38 – # cooperate with mobile

Time:2022-4-14

Quick delete

Recall the last lesson

  • It was previously known that it can be used in the inserted statedelBackspaceDelete
  • Now we know that by defaultxDelete character

    • Can be inxFront use[count]Double

      • as 10x
      • Deleted characters are stored in""Register
      • Can use:regView register status
  • The default state can be usedXBackspace

    • Deleted characters are also""Register
  • We have mastered various methods to delete characters in VI
  • What else is there in the back?

Delete character

Oeasy teaches you to play VIM - 38 - # cooperate with mobile

  • We found that DD can delete a row
  • have a try?!

Deleted content

  • Where do you put the deleted things?:reg

Oeasy teaches you to play VIM - 38 - # cooperate with mobile

  • Put it in the default register""inside
  • You can also add[count]Double
  • 5ddYou can delete 5 lines. After deletion, you can still put the deleted content in the""register
  • So this D{motion}What does that mean?

Sports help

Oeasy teaches you to play VIM - 38 - # cooperate with mobile

  • We can checkmotionMy documents!!!
  • h motion
  • motionCursor movement
  • Like usGJust go straight to the last line of the document

    • dGIs to delete from the current position of the cursor to the last line. It’s great!
  • ggIt’s the first line

    • dggIt is deleted from the cursor position to the beginning!!!
  • ggdGIs to delete from beginning to end
  • 8GIt’s line 8

    • d8GIt is deleted from the cursor position to line 8
    • What if there are only four lines in total?
    • If there are four lines in total,8GIt’s the last line of the road
    • So, at this timed8GWhat is it, you know?
  • Give it a try

Up, down, left and right

  • How does the cursor movehjkl
  • These aremotion

Oeasy teaches you to play VIM - 38 - # cooperate with mobile

  • If the front isd
  • such asdj

    • D stands for deletion
    • J move to next line
    • DJ represents deletion from the current cursor line to the next line
    • Delete two lines in total
  • such asdl

    • Delete current cursor character
    • that isx
  • such asdh

    • Deletes the character in front of the current cursor
    • Backspace
    • that isX

Doubling factor

  • Ifd8j

    • dIs to delete
    • 8jFrom the current cursor position to the bottom8that ‘s ok
    • d8jDeleted everywhere
  • aliked7k
  • dYes delete
  • 7kIt’s seven lines up
  • 8 lines in total together with the current line
  • It’s all deleted from this scope
  • Think about it

    • d8hd4lWhat are they?

Delete by word

  • wbeRemember what that means?

    • If you don’t remember, justh w
  • If the cursor is at the beginning of the word

    • wIt’s to the next onewordBeginning of
    • bIt’s the last onewordBeginning of
    • eYes to the currentwordThe end of

Oeasy teaches you to play VIM - 38 - # cooperate with mobile

practice

  • So we know

    • dwDelete from current location to nextwordThe beginning of (including the middle space is deleted)
    • d3wYes, delete from the current location to the next 3wordBeginning of
    • 3dwIs done from the current location3seconddw
    • 3d2wYesd2wdo3second
    • deDelete from current location to current locationwordEnd of (no spaces removed)
    • d4eYes, delete from the current location to the next 4wordEnd of (including current word)
    • dbIs to delete the previousword
    • d2bIt’s the front2Word
  • The above is the current cursor at the beginning of the word
  • If the current cursor is in a word?

Cursor in word

  • If the cursor is in the word

    • wIt’s to the next onewordBeginning of
    • bYes to the currentwordBeginning of
    • eYes to the currentwordThe end of

Oeasy teaches you to play VIM - 38 - # cooperate with mobile

  • Delete it wherever you move it!
  • B is to retain the current cursor character and delete it forward
  • You have to pay attention to thiswordandWORDDifferences between

Big words and small words

Oeasy teaches you to play VIM - 38 - # cooperate with mobile

  • Definition of big and small words

    • wordInclude spaces and various punctuation as separators
    • WORDOnly spaces are recognized as delimiters
    • such astext-indent

      • namely3 words
      • Also1 word
    • dWYou can delete this directly. This is very convenient, especially when there are many underscores in the identifier
  • It’s no use talking about the sky. You have to practice this!

Beginning and end of line

Oeasy teaches you to play VIM - 38 - # cooperate with mobile

  • Wardrobe

    • ^Is the first non empty character to the line
    • 0Is the first character of the line, whether it is a space or not
  • End of line

    • $Skip to the last character of the line, even if it is a space
    • g_Is the last non empty character to the line
    • Press the two keys in turn
    • If you forget, you have to:hCheck it out
  • Delete?

    • d^It is to delete the first non empty character on the line and keep the current character
    • d0That is, delete the first character of the line from the current position (whether it is a space or not), and the current character is still retained
    • 2d^Is tod^implement2In fact, it’s no different from executing it once. Delete one line
    • d2^namelydreach2^anddreach^, in fact, the same, or delete a line
    • d $Delete from the cursor to the end of the line, including the current character where the cursor is located
  • d $There is another wayD

Delete to end of line

  • :h D

Oeasy teaches you to play VIM - 38 - # cooperate with mobile

  • DItself isd $
  • The positioning method also includes in-line search

In line lookup

Oeasy teaches you to play VIM - 38 - # cooperate with mobile

  • adoptfoJust jump to the rightocharacter
  • dfoFrom the current positiondreachfoLocation of

    • foThe position of is forward from the current positionfThe second day of arrival1individualoLocation of
    • The current character of the cursor is also deleted
  • d2foFrom the current positiondreach2foLocation of

    • foThe position of is forward from the current positionfThe second day of arrival2individualoLocation of
  • 2dfoIs todfoimplement2Times

    • dfoFrom the current positiondreachfoLocation of
    • foThe position of is forward from the current positionfThe second day of arrival1individualoLocation of
  • The two results are actually the same

Oeasy teaches you to play VIM - 38 - # cooperate with mobile

Reverse lookup

  • Reverse lookup isF

Oeasy teaches you to play VIM - 38 - # cooperate with mobile

  • dFoDelete from current location toFoLocation of

    • FoThe location of is found in reverse from the current locationFThe first1individualoLocation of
    • The character of the current cursor is reserved
  • dF2oThe location of is deleted from the current location toF2oLocation of

    • F2oThe location of is found in reverse from the current locationFThe first2individualoLocation of
    • Current character retention
  • 2dFoIs todFoimplement2Times

    • dFoFrom the current positiondreachFoLocation of
    • FoThe location of is the reverse search from the current locationFThe second day of arrival1individualoLocation of

Coordination repetition

Oeasy teaches you to play VIM - 38 - # cooperate with mobile

  • . you can repeat the last operation
  • DF >
  • . is to execute DF > again
  • Can be inoeasy.javaPractice inside

Intra line attachment

  • exceptfBesides, we havet
  • f eIs to move the cursor toeabove

    • Yes, jump to
  • t eIs to move the cursor toeAbove previous characters

    • It’s close to

Oeasy teaches you to play VIM - 38 - # cooperate with mobile

  • dt(Delete from current location tot(

    • t(It means close to(
    • tWho is who you want to stick to
  • Can this be doubled?

Close double

  • sure!
  • This can also be passed[count]Double
  • 2 to
  • till2ndo

Oeasy teaches you to play VIM - 38 - # cooperate with mobile

  • D2to can be deleted to the red L
  • D3to can be deleted to purple W
  • Not only can it double
  • And it can be repeated.
  • Use it when you can’t see the distance clearly.

Jump and lean

  • andfRelated is jumping

    • towardsfrontJump isf
    • towardsafterJump isF
  • andtRelated is the attachment

    • towardsfrontClose yest
    • towardsafterClose yesT
  • anda lowercase letterRelated isforward

    • forwardJump isf
    • forwardClose yest
  • andCapitalizeRelated isbackward

    • backwardJump isF
    • backwardClose yesT

Full text search

  • The two commands for full-text lookup are/and?
  • d/CodeHow?

    • Pressd, note the status bar
    • /Then the status bar displays only/
    • inputCodePay attention to the status bar
    • Search in the textCodeAnd highlight
    • PressenterMove from the current cursor to the highlightedCodeLocation of
  • Reverse search is?
  • It can be doubled[count]Are you?

    • tolerable3d/Code
  • And you can.Duplicate find delete
  • Try it!!!

Text block

  • Use {,} to move the cursor back and forth
  • Use (,) to move the cursor back and forth
  • have access to[count]Double
  • :h }To view the document

Oeasy teaches you to play VIM - 38 - # cooperate with mobile

Oeasy teaches you to play VIM - 38 - # cooperate with mobile

  • These are alsomotionCan anddcoordination
  • such asd{d3)

summary

  • We reviewed the whole subject in a big waymotion
  • Direct movement

    • h j k l
  • Line movement

    • First lineg g
    • Last lineG
    • Line nn G
  • Word movementwbe

    • wIt’s to the next onewordBeginning of
    • bYes to the currentwordBeginning of
    • eYes to the currentwordThe end of
    • exceptwordBesidesWORD
  • Beginning and end of line

    • ^Is the first non empty character to the line
    • 0Is the first character of the line, whether it is a space or not
    • g_Is the last non empty character to the line
    • $Skip to the last character of the line, even if it is a space
  • Intra line jumping and clinging

    • towardsfrontJump isf
    • towardsafterJump isF
    • towardsfrontClose yest
    • towardsafterClose yesT
  • Full text search

    • If you look for it/
    • Reverse search is?
  • Text block

    • {}Move by paragraph
    • ()Move by sentence
  • thesemotionFinedIt can be used together to complete the work of rapid deletion
  • It can also be used in the process[count]Double
  • Delete the content and put it in""Register
  • Can be repeated.
  • Then delete this thing
  • Put it in the register
  • I want to paste it somewhere else
  • What shall I do?
  • Next time

[GitHub address](https://github.com/overmind19…)
[gitee address](https://gitee.com/overmind198…)
[blue bridge experimental building invitation code fjwyimgb](https://www.lanqiao.cn/course…)