> For the complete documentation index, see [llms.txt](https://kanneg881.gitbook.io/workspace/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kanneg881.gitbook.io/workspace/vim/ex-ming-ling-mo-shi-zhi-ling/shi-chuang.md).

# 視窗、標籤頁

## 視窗

| 命令                                   | 用途                      |
| ------------------------------------ | ----------------------- |
| `:[N]new [++opt] [+cmd]`             | 創建一個新視窗並且開始編輯一個空檔案      |
| `:[N]sp[lit] [++opt] [+cmd] [file]`  | 水平切分當前視窗，新視窗載入 {file}   |
| `:[N]vne[w] [++opt] [+cmd] [file]`   | 與 `:new` 命令相似，但是它垂直分割視窗 |
| `:[N]vs[plit] [++opt] [+cmd] [file]` | 垂直切分當前視窗，新視窗載入 {file}   |

### 關閉視窗

| 命令         | 用途                                   |
| ---------- | ------------------------------------ |
| `:clo[se]` | 關閉活動視窗                               |
| `:on[ly]`  | 只保留活動視窗，關閉其他所有視窗                     |
| `:q[uit]`  | 退出當前視窗。如果是最後的一個，退出 Vim。              |
| `:qa[ll]`  | <p>關閉所有視窗並退出 Vim<br>除非存在修改過的緩衝區</p>  |
| `:wq`      | <p>先執行 :w 再執行 :q<br>儲存後離開</p>        |
| `:wqa[ll]` | <p>先保存所有打開的檔案<br>再關閉所有視窗，並退出 vim</p> |

### 調整視窗

| 命令                        | 用途            |
| ------------------------- | ------------- |
| `:res[ize] +N`            | 當前視窗的高度增加 N 行 |
| `:res[ize] -N`            | 當前視窗的高度減少 N 行 |
| `:res[ize] N`             | 當前視窗的高度設為 N 行 |
| `:vert[ical] res[ize] +N` | 當前視窗的寬度增加 N 行 |
| `:vert[ical] res[ize] -N` | 當前視窗的寬度減少 N 行 |
| `:vert[ical] res[ize] N`  | 當前視窗的寬度設為 N 行 |

## 標籤頁

| 命令                                        | 用途                                                                                                                             |
| ----------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
| `:[count]tabe[dit] [++opt] [+cmd] {file}` | <p>打開新標籤頁並編輯 <code>{file}</code><br>如果給出 <code>\[count]</code><br>新標籤頁出現在第 <code>\[count]</code> 個<br>標籤頁之後，否則新標籤頁出現在當前頁之後</p> |
| `:tabc[lose][!]`                          | 關閉當前標籤頁                                                                                                                        |
| `:tabo[nly][!]`                           | 關閉所有其它的標籤頁                                                                                                                     |
| `:tabnew {file}`                          | <p>在一個新的標籤頁中打開 {file}<br>沒寫 {file} 則打開一個空的緩衝區</p>                                                                              |
| `:tabn[ext] {count}`                      | <p>轉到第 <code>{count}</code> 個標籤頁<br>首個標籤頁編號為一</p>                                                                              |
| `:tabn[ext]`                              | <p>轉到下一個標籤頁<br>最後一個標籤頁則迴繞到第一個</p>                                                                                              |
| `:tabp[revious]`                          | <p>轉到前一個標籤頁<br>首個標籤頁則迴繞到最後一個</p>                                                                                               |
| `:tabm[ove] [N]`                          | <p>把當前標籤頁移到<br>第 N 個標籤頁之後</p><p>0 使當前標籤頁成為首個標籤頁<br>如果沒有 N 當前標籤頁成為最後一個</p>                                                      |
| `:tab ba[ll]`                             | 將所有緩衝區變成標籤頁                                                                                                                    |
