Vim User Manual 阅读笔记 usr_21.txt Go away and come back 跳转去跳转回来

|21.1| Suspend and resume

Ctrl-Z 或者 :suspand 命令挂起 vim 回到shell

GUI 下最小化 vim

回到vim,用 fg

|21.2| Executing shell commands

To execute a single shell command from Vim use ":!{command}"

:!{program} execute {program}

:r !{program} execute {program} and read its output

:w !{program} execute {program} and send text to its input

:range!{program} filter text through {program}

使用 :shell 新起一个shell

|21.3| Remembering information; viminfo 保存了

Command-line and Search pattern history

Text in registers

Marks for various files

The buffer list

Global variables

各种设置的限制,保存在 set viminfo 中

GETTING BACK TO WHERE YOU STOPPED VIM

退出之后,重新进入回到上一次工作位置

`0 回到那一行,那一列

'0 回到那一行行首

这些若干位置,倒排序依次为 `0 `1 `2 `3

也可以用 :marks 查看。实际上都是marks

GETTING BACK TO SOME FILE 回到某个文件

方法一: :oldfiles ,观察文件编号,然后用 :e #<2 或者 :split #<3 进行编辑

方法二: :browse oldfiles 输入需要查看的文件编号Enter

MOVE INFO FROM ONE VIM TO ANOTHER

保存和读取寄存器内容,可以实现跨instance 互通。use the ":wviminfo" and ":rviminfo" commands to save and restore theinformation while still running Vim. This is useful for exchanging registercontents between two instances of Vim

也可以用来为不同目的 purpose 设置不同viminfo,进行保存和读取

:wviminfo! ~/tmp/viminfo 此处 ! 表示强制覆盖

:rviminfo! ~/tmp/viminfo 此处 ! 表示 全部读取,如果不用感叹号,则仅采用未 set

|21.4| Sessions

创建 Create Session

:mksession vimbook.vim

restore session

:source vimbook.vim

start Vim and restore a specific session 启动Vim并打开特定Session。 The 'S' stands for

session

vim -S vimbook.vim

'sessionoptions' option 中的一些设置

blank keep empty windows

buffers all buffers, not only the ones in a window

curdir the current directory

folds folds, also manually created ones

help the help window

options all options and mappings

tabpages all tab pages

winsize window sizes

terminal include terminal windows

:wall "保存所有改写过的文件

:mksession! ~/.vim/secret.vim "保存当前Session

:source ~/.vim/boring.vim "读取boring session

UNIX AND MS-WINDOWS

如果需要频繁切换UNIX环境和windows环境,则应设置

:set sessionoptions+=unix,slash

windows可以较好地读取UNIX文本,反之不行。

Windows可以较好地理解 / 分割名字,UNXI不能很好地理解 \

SESSIONS AND VIMINFO

Session 不包括寄存器、书签和命令历史------ not the position of marks, contents of registers and the c ommand line history. You need to use the viminfo feature for these things.------这些保存在 viminfo中

|21.5| Views

session保存整个vim的外观,view保存单一窗口的属性

:mkview 1 "保存当前窗口

:loadview 1 "可以为一个文件配置不同的view设置, 以数字命名多达9个------windows下似乎权限问题,无法写入

另一个方法

save the view of the current file: >

:mkview ~/.vim/main.vim

You can restore it with: >

:source ~/.vim/main.vim

|21.6| Modelines

告知编辑器,对特定格式文件采取特定设置。

The 'modelines' option specifies how many lines at the start and end of the file are inspected for containing a modeline. To inspect ten lines: 设置文本首部或者末尾多少行之内,检查包含modeline

:set modelines=10

The 'modeline' option can be used to switch this off. Do this when you are

working as root on Unix or Administrator on MS-Windows, or when you don't

trust the files you are editing: >

:set nomodeline

设置的格式

any-text vim:set {option}={value} ... : any-text

Any-text 可以是任意文本,例如 注释符号 /* */

第二个冒号 : 之后的文本被忽略

例如

/* vim:set shiftwidth=4: */

相关推荐
RainCity3 天前
Java Swing 自定义组件库分享(十二)
java·笔记·后端
LinXunFeng10 天前
Obsidian - 使用 Share Note 分享笔记并自部署
前端·笔记·github
VidDown14 天前
VidDown 工具站:免费、本地优先的开发者工具箱
javascript·编辑器·音视频·视频编解码·视频
闪闪发亮的小星星14 天前
高斯光以及高斯光公式解释
笔记
cqbzcsq14 天前
CellFlow虚拟细胞论文阅读
论文阅读·人工智能·笔记·学习·生物信息
VidDown14 天前
显卡处理视频技术详解:从硬解码到 NVENC,GPU 如何让视频处理起飞?
javascript·编辑器·音视频·视频编解码·视频
阿米亚波14 天前
【Windows】QEMU 启动 openEuler aarch64/arm64 架构系统 + 离线软件源
linux·windows·经验分享·笔记·架构·arm
自传.14 天前
尚硅谷 Vibe Coding|第三章(1) Claude Code深度使用与进阶技巧 学习笔记
笔记·学习·尚硅谷·vibecoding
.千余14 天前
【C++】模板进阶全解:非类型参数|全特化|偏特化|分离编译完全指南
开发语言·c++·笔记·学习·其他
自传.14 天前
尚硅谷 Vibe Coding|第二章 AI编程工具生态 学习笔记
笔记·学习·ai编程·尚硅谷·vibe coding