> For the complete documentation index, see [llms.txt](https://dofy.gitbook.io/learn-vim/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dofy.gitbook.io/learn-vim/zh-cn/chapter01.md).

# 第一章：光标移动

欢迎进入第一章，这一章将学习简单的光标移动操作。

如果你已经有了一定基础，这部分可以略过，直接 `G` 到文档尾部按照操作进入下一章。

## 移动光标

### 单位级

* `h` 向左一字符
* `j` 下一行
* `k` 上一行
* `l` 向右一字符

### 单词级

* `w` or `W` 向右移动到下一单词开头
* `e` or `E` 向右移动到单词结尾
* `b` or `B` 向左移动到单词开头

*注意：所有小写单词都是以分词符作为单词界限，大写字母以空格作为界限*

> 在下面字符块中感受一下各种移动吧！

```
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 :)
```

### 块级

* `gg` 到文档第一行
* `G` 到文档最后一行
* `0` 到行首（第 1 列）
* `^` 到第一个非空白字符
* `$` 到行尾
* `H` 移动到屏幕顶端
* `M` 移动到屏幕中间
* `L` 移动到屏幕底部
* `Ctrl-d` 向下移动半页
* `Ctrl-u` 向上移动半页
* `Ctrl-f` 向下移动一页
* `Ctrl-b` 向上移动一页
* `:<N>` or `<N>gg` 跳转到第 N 行
* `:+<N>` or `<N>j` 向下跳 N 行
* `:-<N>` or `<N>k` 向上跳 N 行

*注意：所有命令前都可以加一个数字 N，表示对后面的命令执行 N 次，例如你想向下移动 3 行，除了可以用 `:+3` 之外，还可以用 `3j` 来实现同样的效果。另外，上面实际上有 两种命令：一种是键入后立即执行的，比如 `gg`；还有一种是先输入 `:` 的（后面还会出 现先按 `/` 的），这类命令需要在输入完成后按回车执行，后面的教程中也是一样。*

> 现在你可以在当前文件中畅游了，当你熟悉了各种移动操作后就可以通过 `G` 定位到当 前文档到最后一行，按照提示进入下一章了。
>
> 将光标定位到后面文件名的任意位置上，直接敲键盘 `gf` 进 入[第二章](/learn-vim/zh-cn/chapter02.md)。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://dofy.gitbook.io/learn-vim/zh-cn/chapter01.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
