Vim User Manual 阅读笔记 usr_22.txt Finding the file to edit 多文件编辑浏览

|22.1| The file browser

编辑目录

:edit .

按 F1 查看帮助

各类操作

P preview

To select files for display and editing: (with the cursor is atop a filename)

|-----------|--------------------------------------------------------|
| <enter> | Open the file in the current window. |netrw-cr| |
| 小写 o | Horizontally split window and display file |netrw-o| |
| 小写 v | Vertically split window and display file |netrw-v| |
| 小写 p | Use the |preview-window| |netrw-p| |
| 大写 P | Edit in the previous window |netrw-P| |
| 小写 t | Open file in a new tab |netrw-t| |

The following normal-mode commands may be used to control the browser display:

|------|-------------------------------------------------------------------------------------------------------------------|
| 小写 i | Controls listing style (thin, long, wide, and tree). The long listing includes size and date information. |
| 小写 s | Repeatedly pressing s will change the way the files are sorted; one may sort on name, modification time, or size. |
| 小写 r | Reverse the sorting order. |

As a sampling of extra normal-mode commands:

|-------|--------------------------------------------------------------------------------------------------------------------------------------|
| Cd | Change Vim's notion of the current directory to be the same as the browser directory. (see |g:netrw_keepdir| to control this, too) |
| R | Rename the file or directory under the cursor; a prompt will be issued for the new name. |
| D | Delete the file or directory under the cursor; a confirmation request will be issued. |
| mb gb | Make bookmark/goto bookmark |

One may also use command mode; again, just a sampling:

|------------------------|------------------------------------------------------------------------|
| :Explore [directory] | Browse specified/current directory |
| :NetrwSettings | A comprehensive list of your current netrw settings with help linkage. |

|22.2| The current directory

Cd

Pwd 等命令都可以用

Cd - 回到上一个用过的目录

Lcd 为当前窗体设置目录,同一个instance内其他窗口使用cd无法改变------不确定

Tcd 为当前tab设置目录,同一个tab内其他窗口使用cd无法改变------不确定

|22.3| Finding a file

找到当前位置的文件并打开 gf 或者 CTRL-w f

会根据当前path变量去找。有更具的搜索策略

:find 命令 在windows下不是很好用

|22.4| The buffer list

使用 buffer 概念描述编辑中的文件,实际上是文件的copy,编辑完成需要写到文件。

Buffers not only contain file contents, but also all the marks, settings, and other stuff that goes with it.

HIDDEN BUFFERS

:hide edit two.txt

Hide 操作不保存文件,只是隐藏。如果退出vim,可能丢失。

INACTIVE BUFFERS

|----------|-----------------------------------|
| Active | Appears in a window, text loaded. |
| Hidden | Not in a window, text loaded. |
| Inactive | Not in a window, no text loaded. |

LISTING BUFFERS

:buffers 或者 :ls

第一列编号,第二列flag

1 #h "help.txt" line 62 ~

2 %a + "usr_21.txt" line 1 ~

3 "usr_toc.txt" line 1 ~

EDITING A BUFFER

打开一个buffer

:buffer 编号

新开一个窗口打开某buffer

:sbuffer 编号

USING THE BUFFER LIST

You can move around in the buffer list with these commands:

Buffer 切换

:bnext go to next buffer

:bprevious go to previous buffer

:bfirst go to the first buffer

:blast go to the last buffer

To remove a buffer from the list, use this command: >

:bdelete 3

强制恢复buffer

Even after removing the buffer with ":bdelete" Vim still remembers it. It's actually made "unlisted", it no longer appears in the list from ":buffers". The ":buffers!" command will list unlisted buffers (yes, Vim can do the impossible). To really make Vim forget about a buffer, use ":bwipe".

相关推荐
&&Citrus4 小时前
【CPN学习笔记(二)】Chap2 非分层颜色 Petri 网——从一个简单协议开始读懂 CPN
笔记·学习·php·cpn·petri网
HXQ_晴天4 小时前
Linux 磁盘清理 & 查看常用指令笔记
笔记
小陈phd7 小时前
多模态大模型学习笔记(三十)—— 基于YOLO26 Pose实现车牌检测
笔记·学习
野指针YZZ8 小时前
XV6操作系统:trap机制学习笔记
笔记·学习
-许平安-10 小时前
MCP项目笔记九(插件 bacio-quote)
c++·笔记·ai·plugin·mcp
Xudde.10 小时前
班级作业笔记报告0x10
笔记·学习·安全·web安全·php
降临-max11 小时前
Git 协同开发与冲突解决
笔记·git
南境十里·墨染春水13 小时前
Linux学习进展 进程管理命令 及文件压缩解压
linux·运维·笔记·学习
航Hang*13 小时前
第2章:进阶Linux系统——第4节:配置与管理NFS服务器
linux·运维·服务器·笔记·学习·vmware
ZhiqianXia13 小时前
Pytorch 学习笔记(8): PyTorch FX
pytorch·笔记·学习