Oeasy teaches you to play VIM – 5 – # insert mode

Time:2022-5-24

Insert mode

Recall the last lesson

Oeasy teaches you to play VIM - 5 - # insert mode

  • We summarized the way of mode switching

    • Command modeNormal mode
    • Baseline command line modeCommand mode
  • How to open the help file correctly

    • :h
  • Using the mouse in a document

    • set mouse=a
    • It is recommended not to use the mouse
  • Use full keyboard to jump in and out hyperlinks

    • ctrl+]
    • ctrl+o
  • Two manuals for help files

    • User help manual
    • Reference help manual
  • This time, let’s insert the content and modify the document

Insert mode

If you want to insert content, you should enter the insert mode(Insert mode)

  • First, let’s open the last oneoeasy.txt
ls -l . > oeasy.txt
vi oeasy.txt
  • Then how to enter the insert mode?
  • We use:help insertSee if there are any orders

Oeasy teaches you to play VIM - 5 - # insert mode

  • We need to exit help mode first

    • :q
  • Then pressiEnter insert mode
  • After entering insertion mode

    • lower left quarterThe status bar displays--Insert--
    • This means that you have entered insertion mode
    • Always pay attention to the lower left corner
    • The lower left corner is like a small map
    • It is where the overall situation is managed

Oeasy teaches you to play VIM - 5 - # insert mode

  • If you don’t enter insert mode

    • Maybe it’s because I’m in the new help
    • before:qExit help

Insert text

  • In insert mode, we can type at will
  • The key is no longer a command, but a character
  • You can type a colon when you enter

Oeasy teaches you to play VIM - 5 - # insert mode

  • What if you want to move the position after input?

    • escReturn to command modeNormal mode
    • perhapsctrl+cReturn to command modeNormal mode
    • Try to choosectrl+cBecause you can keep your hands in the right position
    • Right little fingerctrl+Right index fingerc
  • Note that after returning to command mode

    • The status bar in the lower left corner is no longer displayed--Insert--
    • Instead, it goes back to blank
  • Observe the lower left corner
  • Always pay attention

Document details

Oeasy teaches you to play VIM - 5 - # insert mode

  • Note that where there is content, it is the specific text content
  • Where there is no content
  • There will betilder(~)Prompt
  • tilder(~)It means nothing, just nothing

useiCommand to enter insert mode

  • PressiEnter the insertion mode again
  • Pressescorctrl+cReturn to command mode

Oeasy teaches you to play VIM - 5 - # insert mode

  • Can useiandctrl+cSwitch mode repeatedly
  • Observe the lower left corner

Help details

  • iWhat exactly does that mean?
  • sure:hGive him a minute
  • :h inamelyhelponceiWhat exactly does the order do

Oeasy teaches you to play VIM - 5 - # insert mode

  • thatctrl+cWhat do you mean?

Query shortcut

  • What won’t:hwhat
  • :h ctrl-cJust help us find itctrl-cWhat do shortcuts do

Oeasy teaches you to play VIM - 5 - # insert mode

  • Similarly, there are:h ctrl-g

Oeasy teaches you to play VIM - 5 - # insert mode

  • CTRL+GCorresponding to:f[ile]command
  • You can view the current file information

Try to exit

  • input:qWish to quit
  • But the screen is shown below

Oeasy teaches you to play VIM - 5 - # insert mode

  • Input according to his requirements:q!
  • cat oeasy.txtThe display file has not been modified
  • original:q!Force quit without saving
  • Embarrassing, although it hasn’t been saved successfully
  • But it was really inserted!
  • Let’s summarize first

summary

  • This time we are in insert mode
  • Using commands in normal modei
  • Use in insert modeescReturn to normal mode
  • use:!qDo not force exit
  • Hey ~ it seems that we can only save it next time
  • We’ll talk about it next time!