Learn VIM
  • Vim Hands-On Tutorial (Learning Vi and Vims)
  • Vim Hands-On Tutorial(Learning Vim)
    • Chapter 1: Cursor Movement
    • Chapter 2: Opening Files, Finding Content
    • Chapter 3: Modifying and Saving Files
    • Chapter 4: Some Tips
    • Chapter 5: Splitting Windows and Tabs
    • Chapter 6: Block Operations
    • Chapter 7: Vim Macros
    • Vim Modes
    • Vim Plugins
    • plugins
      • Airline & Themes
      • EasyAlign
      • Plugin Recommendations
      • NERDTree
      • surround.vim
  • Vim 实操教程(Learning Vim)
    • 第一章:光标移动
    • 第二章:打开文件、查找内容
    • 第三章:文档的修改与保存
    • 第四章:一些小技巧
    • 第五章:分屏与标签页
    • 第六章:块操作
    • 第七章:Vim 中的宏
    • Vim 的模式
    • Vim 插件
    • plugins
      • Airline & Themes
      • EasyAlign
      • 插件推荐
      • NERDTree
      • surround.vim
Powered by GitBook
On this page
  • Move the cursor
  • Unit level
  • Word level
  • Block level

Was this helpful?

  1. Vim Hands-On Tutorial(Learning Vim)

Chapter 1: Cursor Movement

Welcome to Chapter 1, this chapter will learn simple cursor movement operations.

If you already have a certain foundation, this part can be skipped, directly G to the end of the document according to the operation into the next chapter.

Move the cursor

Unit level

  • h left one character

  • j line down

  • k line up

  • l right one character

Word level

  • w or W move right to the beginning of the word

  • e or E move right to the end of the word

  • b or B move left to the beginning of the word

Note: All lowercase words are word boundaries with word boundaries, uppercase letters with spaces as boundaries

Try to feel the various movements in the following character blocks!

This project's GitHub url is https://github.com/dofy/learn-vim
Please clone it to your local folder and open the first file which is
named chapter01.md via following command "vim chapter01.md"
and welcome to https://yahaha.net :)

Block level

  • gg to the first line of the document

  • G to the last line of the document

  • 0 to the beginning of the line (column 1)

  • ^ to the first non-whitespace character

  • $ to the end of the line

  • H move to the top of the screen

  • M move to the middle of the screen

  • L move to the bottom of the screen

  • Ctrl-d move down half a page

  • Ctrl-u move up half a page

  • Ctrl-f move down one page

  • Ctrl-b move up one page

  • :<N> or <N>gg jump to line N

  • :+<N> or <N>j jump down N lines

  • :-<N> or <N>k jump up N lines

Note: A number N can be added before all commands, which means that the command behind it is executed N times. For example, if you want to move down 3 lines, you can use :+3 or 3j to achieve the same effect. In addition, there are actually two commands above: one is executed immediately after typing, such as gg; the other is to enter : first (there will be a / first), this type of command needs to be executed after the input is completed. Press Enter, which is the same in the following tutorials.

Now you can swim in the current file. When you are familiar with various movement operations, you can locate the current document to the last line by pressing G and enter the next chapter according to the prompt.

PreviousVim Hands-On Tutorial(Learning Vim)NextChapter 2: Opening Files, Finding Content

Last updated 1 year ago

Was this helpful?

Place the cursor anywhere in the file name behind it and press the keyboard gf to enter .

Chapter 2