freeCodeCamp/guide/chinese/vim/split/index.md

37 lines
1.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

---
title: Split
localeTitle: 分裂
---
# 用拆分打开Vim中的文件
在Vim中可以水平和垂直打开或`split`文件,以便为给定文件创建附加窗口或视口。
### 命令键
用于创建水平拆分的命令:
`[N]split` `[file]`
`[N]sp` `[file]`
其中`sp`是`split`缩写。
用于创建垂直拆分的命令:
`[N]vsplit` `[file]`
`[N]vs` `[file]`
其中`vs`是`vsplit`的简短缩写和...
* `[N]`是高度(默认为当前窗口的一半)。
* `[file]`是要在新拆分窗口中打开的文件(如果没有给出,则使用当前文件)。
### 例子
在Vim中使用split的一些示例
* `sp`将当前窗口拆分为当前文件的相等水平窗口。
* `10sp`拆分当前窗口为当前文件创建一个高度为10的新窗口。
* `sp` `index.html`将当前窗口拆分为相等的水平窗口,并在新窗口中打开`index.html` 。
* `vs` `main.css`将当前窗口拆分为相等的垂直窗口,并在新窗口中打开`main.css` 。