291 lines
537 KiB
HTML
291 lines
537 KiB
HTML
|
<!DOCTYPE html>
|
|||
|
<html lang="zh"><head><title>Vim 参考手册</title><meta charset="utf-8"/><link rel="preconnect" href="https://fonts.googleapis.com"/><link rel="preconnect" href="https://fonts.gstatic.com"/><link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=IBM Plex Mono&family=Noto Serif Simplified Chinese:wght@400;700&family=Source Sans Pro:ital,wght@0,400;0,600;1,400;1,600&display=swap"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><meta property="og:title" content="Vim 参考手册"/><meta property="og:description" content="提供 Vim 的详尽参考手册,涵盖光标移动、插入模式、编辑文本、选择文本、寄存器、标记、宏等高级命令。."/><meta property="og:image" content="https://wiki.7wate.com/static/og-image.png"/><meta property="og:width" content="1200"/><meta property="og:height" content="675"/><link rel="icon" href="../../../../static/icon.png"/><meta name="description" content="提供 Vim 的详尽参考手册,涵盖光标移动、插入模式、编辑文本、选择文本、寄存器、标记、宏等高级命令。."/><meta name="generator" content="Quartz"/><link href="../../../../index.css" rel="stylesheet" type="text/css" spa-preserve/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.9/katex.min.css" rel="stylesheet" type="text/css" spa-preserve/><script src="../../../../prescript.js" type="application/javascript" spa-preserve></script><script type="application/javascript" spa-preserve>const fetchData = fetch("../../../../static/contentIndex.json").then(data => data.json())</script></head><body data-slug="Technology/GettingStarted/命令行工具/Vim/5.Vim-参考手册"><div id="quartz-root" class="page"><div id="quartz-body"><div class="left sidebar"><h2 class="page-title"><a href="../../../..">🪴 X·Eden</a></h2><div class="spacer mobile-only"></div><div class="search"><button class="search-button" id="search-button"><p>搜索</p><svg role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 19.9 19.7"><title>Search</title><g class="search-path" fill="none"><path stroke-linecap="square" d="M18.5 18.3l-5.4-5.4"></path><circle cx="8" cy="8" r="7"></circle></g></svg></button><div id="search-container"><div id="search-space"><input autocomplete="off" id="search-bar" name="search" type="text" aria-label="搜索些什么" placeholder="搜索些什么"/><div id="search-layout" data-preview="true"></div></div></div></div><button class="darkmode" id="darkmode"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="dayIcon" x="0px" y="0px" viewBox="0 0 35 35" style="enable-background:new 0 0 35 35" xml:space="preserve" aria-label="暗色模式"><title>暗色模式</title><path d="M6,17.5C6,16.672,5.328,16,4.5,16h-3C0.672,16,0,16.672,0,17.5 S0.672,19,1.5,19h3C5.328,19,6,18.328,6,17.5z M7.5,26c-0.414,0-0.789,0.168-1.061,0.439l-2,2C4.168,28.711,4,29.086,4,29.5 C4,30.328,4.671,31,5.5,31c0.414,0,0.789-0.168,1.06-0.44l2-2C8.832,28.289,9,27.914,9,27.5C9,26.672,8.329,26,7.5,26z M17.5,6 C18.329,6,19,5.328,19,4.5v-3C19,0.672,18.329,0,17.5,0S16,0.672,16,1.5v3C16,5.328,16.671,6,17.5,6z M27.5,9 c0.414,0,0.789-0.168,1.06-0.439l2-2C30.832,6.289,31,5.914,31,5.5C31,4.672,30.329,4,29.5,4c-0.414,0-0.789,0.168-1.061,0.44 l-2,2C26.168,6.711,26,7.086,26,7.5C26,8.328,26.671,9,27.5,9z M6.439,8.561C6.711,8.832,7.086,9,7.5,9C8.328,9,9,8.328,9,7.5 c0-0.414-0.168-0.789-0.439-1.061l-2-2C6.289,4.168,5.914,4,5.5,4C4.672,4,4,4.672,4,5.5c0,0.414,0.168,0.789,0.439,1.06 L6.439,8.561z M33.5,16h-3c-0.828,0-1.5,0.672-1.5,1.5s0.672,1.5,1.5,1.5h3c0.828,0,1.5-0.672,1.5-1.5S34.328,16,33.5,16z M28.561,26.439C28.289,26.168,27.914,26,27.5,26c-0.828,0-1.5,0.672-1.5,1.5c0,0.414,0.168,0.789,0.439,1.06l2,2 C28.711,30.832,29.086,31,29.5,31c0.828,0,1.5-0.672,1.5-1.5c0-0.414-0.168-0.789-0.439-1.061L28.561,26.439z M17.5,29 c-0.829,0-1.5,0.672-1.5,1.5v3c0,0.828,0.671,1.5,1.5,1.5s1.5-0.672,1.5-1.5v-3C19,29.672,18.329,29,17.5,29z M17.5,7 C11.71,7,7,11.71,7,17.5S11.71,28,17.5,28S28,23.29,28,17.5S23.2
|
|||
|
<h2 id="全局">全局<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#全局" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h2>
|
|||
|
<figure data-rehype-pretty-code-figure><pre tabindex="0" data-language="vim" data-theme="github-light github-dark"><code data-language="vim" data-theme="github-light github-dark" style="display:grid;"><span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:h[elp] 关键字 </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">打开关键字帮助</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:sav[eas] 文件名 </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">另存为</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:clo[se] </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">关闭当前窗口</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:ter[minal] </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">打开一个shell窗口</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">K </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">打开光标所在单词的man页面</span></span></code></pre></figure>
|
|||
|
<p><em><strong>Tip</strong> 在终端中运行 vimtutor 以学习最基础的 Vim 命令。</em></p>
|
|||
|
<h2 id="移动光标">移动光标<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#移动光标" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h2>
|
|||
|
<figure data-rehype-pretty-code-figure><pre tabindex="0" data-language="vim" data-theme="github-light github-dark"><code data-language="vim" data-theme="github-light github-dark" style="display:grid;"><span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">h </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">左移光标</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">j </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">下移光标</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">k </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">上移光标</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">l </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">右移光标</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">gj </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">下移光标(折行文本)</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">gk </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">下移光标(折行文本)</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">H </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">移动到当前页面顶部</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">M </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">移动到当前页面中间</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">L </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">移动到当前页面底部</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">w </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">移动到下个单词开头</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">W </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">移动到下个单词开头(单词含标点)</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">e </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">移动到下个单词结尾</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">E </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">移动到下个单词结尾(单词含标点)</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">b </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">移动到上个单词开头</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">B </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">移动到上个单词开头(单词含标点)</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">ge </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">移动到上个单词结尾</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">gE </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">移动到上个单词结尾(单词含标点)</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">% </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">跳转到配对的符号(默认支持的配对符号组:: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'()'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'{}'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'[]'</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> 在vim中使用 :h </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">matchpairs</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> 获得更多信息)</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">0</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">移动到行首</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">^ </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">移动到行首的非空白符</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">$ </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">移动到行尾</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">g_ </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">移动到行内最后一个非空白符</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">gg </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">移动到文件第一行</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">G </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">移动到文件最后一行</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">5gg or 5G </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">移动到第五行</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">gd</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">跳转到局部定义</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">gD </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">跳转到全局定义</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">fx </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">移动到字符 x 下次出现的位置</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">tx</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">移动到字符 x 下次出现的位置的前一个字符</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">Fx </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">移动到字符 x 上次出现的位置</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">Tx </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">移动到字符 x 上次出现的位置的后一个字符</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">; </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">重复之前的f、t、F、T操作</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">反向重复之前的f、t、F、T操作</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">} </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">移动到下一个段落 (当编辑代码时则为函数/代码块)</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">{ </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">移动到上一个段落 (当编辑代码时则为函数/代码块)</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">zz </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">移动屏幕使光标居中</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">Ctrl </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">+</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> e </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">向下移动屏幕一行(保持光标不动)</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">Ctrl </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">+</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> y </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">向上移动屏幕一行(保持光标不动)</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">Ctrl </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">+</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> b </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">向上滚动一屏</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">Ctrl </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">+</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> f </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">向下滚动一屏</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">Ctrl </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">+</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> d </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">向下滚动半屏</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">Ctrl </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">+</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> u </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">向上滚动半屏</span></span></code></pre></figure>
|
|||
|
<h2 id="插入模式---插入追加文本">插入模式 - 插入/追加文本<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#插入模式---插入追加文本" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h2>
|
|||
|
<figure data-rehype-pretty-code-figure><pre tabindex="0" data-language="vim" data-theme="github-light github-dark"><code data-language="vim" data-theme="github-light github-dark" style="display:grid;"><span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">i </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">从光标前开始插入字符</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">I </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">从行首开始插入字符</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">a </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">从光标后开始插入字符</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">A </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">从行尾开始插入字符</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">o </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">在当前行之下另起一行, 开始插入字符</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">O </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">在当前行之上另起一行, 开始插入字符</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">ea</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">从当前单词末尾开始插入</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">Ctrl </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">+</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> h </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">在插入模式下,删除光标前的字符</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">Ctrl </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">+</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> w </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">在插入模式下,删除光标前的单词</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">Ctrl </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">+</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> j </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">在插入模式下,另起一行</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">Ctrl </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">+</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> t </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">在插入模式下,向右缩进,宽度由 </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">shiftwidth</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> 控制</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">Ctrl </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">+</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> d </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">在插入模式下,向左缩进,宽度由 </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">shiftwidth</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> 控制</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">Ctrl </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">+</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> n </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">在插入模式下,在光标之前插入自动补全的下一个匹配项</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">Ctrl </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">+</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> p </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">在插入模式下,在光标之前插入自动补全的上一个匹配项</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">Ctrl </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">+</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> rx </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">插入寄存器 x 的内容</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">Ctrl </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">+</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> ox </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">暂时进入正常模式以发出一个正常模式命令 x。</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">Esc </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">退出插入模式</span></span></code></pre></figure>
|
|||
|
<h2 id="编辑文本">编辑文本<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#编辑文本" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h2>
|
|||
|
<figure data-rehype-pretty-code-figure><pre tabindex="0" data-language="vim" data-theme="github-light github-dark"><code data-language="vim" data-theme="github-light github-dark" style="display:grid;"><span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">r </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">替换当前字符</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">R </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">在 ESC 按下之前,替换多个字符</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">J </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">将下一行合并到当前行, 并在两部分文本之间插入一个空格</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">gJ </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">将下一行合并到当前行, 两部分文本之间不含空格</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">gwip </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">重新调整段落</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">g</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">~</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">大小写转换操作修饰符</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">gu </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">小写操作修饰符</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">gU </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">大写操作修饰符</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">cc</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">将光标所在的行删除, 然后进入插入模式</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">c$ or C </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">将光标处到行尾删除, 然后进入插入模式</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">ciw </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">将光标所在的单词删除, 然后进入插入模式</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">cw or ce </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">从光标位置开始, 修改单词</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">s </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">删除当前字符, 然后进入插入模式</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">S </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">清空当前行, 然后进入插入模式 (同cc)</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">xp </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">当前字符后移</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">u </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">撤销</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">U </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">撤销上一次的改动行的操作</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">Ctrl </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">+</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> r </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">重做(取消撤销)</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">. </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">再次执行上个命令</span></span></code></pre></figure>
|
|||
|
<h2 id="选择文本可视化模式">选择文本(可视化模式)<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#选择文本可视化模式" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h2>
|
|||
|
<figure data-rehype-pretty-code-figure><pre tabindex="0" data-language="vim" data-theme="github-light github-dark"><code data-language="vim" data-theme="github-light github-dark" style="display:grid;"><span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">v </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">进入可视化模式, 移动光标高亮选择, 然后可以对选择的文本执行命令(比 y</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">复制)</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">V </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">进入可视化模式(行粒度选择)</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">o </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">切换光标到选择区开头/结尾</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">Ctrl </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">+</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> v </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">进入可视化模式(矩阵选择)</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">O </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">切换光标到选择区的角</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">aw</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">选择当前单词</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">ab </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">选择被 () 包裹的区域(含括号)</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">aB </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">选择被 {} 包裹的区域(含花括号)</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">at </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">选择被 <> 标签包裹的区域(含<>标签)</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">ib </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">选择被 () 包裹的区域(不含括号)</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">iB </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">选择被 {} 包裹的区域(不含花括号)</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">it </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">选择被 <> 标签包裹的区域(不含<>标签)</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">Esc </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">退出可视化模式</span></span></code></pre></figure>
|
|||
|
<p><em><strong>Tip</strong> 也可以使用 ( 和 { 分别代替 b 和 B</em></p>
|
|||
|
<h2 id="可视化模式命令">可视化模式命令<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#可视化模式命令" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h2>
|
|||
|
<figure data-rehype-pretty-code-figure><pre tabindex="0" data-language="vim" data-theme="github-light github-dark"><code data-language="vim" data-theme="github-light github-dark" style="display:grid;"><span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">> </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">向右缩进</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">< </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">向左缩进</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">y </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">复制</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">d </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">剪切</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">~</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">大小写切换</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">u </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">将选中文本转换为小写</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">U </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">将选中文本转换为大写</span></span></code></pre></figure>
|
|||
|
<h2 id="寄存器">寄存器<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#寄存器" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h2>
|
|||
|
<p>寄存器被存储在 ~/.viminfo 中, 在下次重启 vim 时仍会加载</p>
|
|||
|
<figure data-rehype-pretty-code-figure><pre tabindex="0" data-language="vim" data-theme="github-light github-dark"><code data-language="vim" data-theme="github-light github-dark" style="display:grid;"><span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:reg[isters] </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">显示寄存器内容</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">"xy - 复制内容到寄存器 x</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">"xp - 粘贴寄存器 x 中的内容</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">"+y - 复制内容到系统剪贴板寄存器</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">"+p - 粘贴系统剪贴板寄存器的内容</span></span></code></pre></figure>
|
|||
|
<p>特殊寄存器:</p>
|
|||
|
<figure data-rehype-pretty-code-figure><pre tabindex="0" data-language="vim" data-theme="github-light github-dark"><code data-language="vim" data-theme="github-light github-dark" style="display:grid;"><span data-line><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">0</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">上次复制</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">" - 未命名寄存器,上次复制或删除</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">%</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">当前文件名</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"># - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">轮换文件名</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">*</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">剪贴板内容 (X11 primary)</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">+ - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">剪贴板内容 (X11 </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">clipboard</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">/</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">上次搜索的pattern</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">上次执行的命令</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">上次插入的文本</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">-</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">上次剪切的短于一行的文本</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">= - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">表达式寄存器</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">_</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">黑洞寄存器</span></span></code></pre></figure>
|
|||
|
<h2 id="标记">标记<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#标记" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h2>
|
|||
|
<figure data-rehype-pretty-code-figure><pre tabindex="0" data-language="vim" data-theme="github-light github-dark"><code data-language="vim" data-theme="github-light github-dark" style="display:grid;"><span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:marks </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">标记列表</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">ma</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">设置当前位置为标记 a</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">`a </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">跳转到标记 a 的位置</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">y`a </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">复制当前位置到标记 a 的内容</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">`</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">0</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">跳转到上次 Vim 退出时的位置</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">`</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">" - 跳转到上次编辑该文件时的位置</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">`. </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">跳转到上次修改的位置</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">`` </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">跳转回上次跳转前的位置</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:ju[</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">mps</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">] </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">列出跳转历史记录</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">Ctrl </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">+</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> i </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">跳转至跳转历史中较晚的位置</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">Ctrl </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">+</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> o </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">跳转回跳转历史中较早的位置</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:changes </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">列出修改历史记录</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">g, </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">跳转至修改历史中较晚修改的位置</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">g; </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">跳转至修改历史中较早修改的位置</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">Ctrl </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">+</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> ] </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">跳转到当前光标位置对应的 </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">tag</span></span></code></pre></figure>
|
|||
|
<p><strong>Tip</strong> 可以使用反引号 (`) 或单引号 (’) 跳转至标记位置。使用单引号会跳转至该标记所在行行首 (首个非空白字符)。</p>
|
|||
|
<h2 id="宏">宏<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#宏" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h2>
|
|||
|
<figure data-rehype-pretty-code-figure><pre tabindex="0" data-language="vim" data-theme="github-light github-dark"><code data-language="vim" data-theme="github-light github-dark" style="display:grid;"><span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">qa </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">录制宏 a</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">q </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">停止录制宏</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">@a </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">执行宏 a</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">@@ </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">重新执行上次执行的宏</span></span></code></pre></figure>
|
|||
|
<h2 id="剪切-复制-粘贴">剪切, 复制, 粘贴<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#剪切-复制-粘贴" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h2>
|
|||
|
<figure data-rehype-pretty-code-figure><pre tabindex="0" data-language="vim" data-theme="github-light github-dark"><code data-language="vim" data-theme="github-light github-dark" style="display:grid;"><span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">yy </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">复制当前行</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">2yy </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">复制 </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">2</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> 行</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">yw </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">复制当前单词</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">yiw </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">复制光标处的单词</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">yaw </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">复制光标处的单词及其前后的空格</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">y$ or Y </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">复制, 从光标位置到行末</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">p </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">在光标后粘贴</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">P </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">在光标前粘贴</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">gp</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">在光标后粘贴并把光标定位于粘贴的文本之后</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">gP </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">在光标前粘贴并把光标定位于粘贴的文本之后</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">dd </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">剪切当前行</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">2dd </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">剪切 </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">2</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> 行</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">dw </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">剪切当前单词</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">diw </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">删除光标处的单词</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">daw </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">删除光标处的单词及其前后的空格</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">d$ or D </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">剪切, 从光标位置到行末 (同 D )</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">x </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">剪切当前字符</span></span></code></pre></figure>
|
|||
|
<h2 id="文字缩进">文字缩进<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#文字缩进" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h2>
|
|||
|
<figure data-rehype-pretty-code-figure><pre tabindex="0" data-language="vim" data-theme="github-light github-dark"><code data-language="vim" data-theme="github-light github-dark" style="display:grid;"><span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">>> </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">将当前行向右缩进,宽度由 </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">shiftwidth</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> 控制</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"><< </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">将当前行向左缩进,宽度由 </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">shiftwidth</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> 控制</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">>% </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">向右缩进 () 或 {} 内的区域 (光标需置于括号上)</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">>ib </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">向右缩进 () 内的区域</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">>at </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">向右缩进 <> 标签内的区域</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">3</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">==</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">自动缩进 </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">3</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> 行</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">% </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">自动缩进 () 或 {} 内的区域 (光标需置于括号上)</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">iB </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">自动缩进 {} 内的区域 (光标需置于括号上)</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">gg</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">G</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">自动缩进整个缓冲区</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">]p </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">粘贴并调整缩进至当前行</span></span></code></pre></figure>
|
|||
|
<h2 id="退出">退出<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#退出" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h2>
|
|||
|
<figure data-rehype-pretty-code-figure><pre tabindex="0" data-language="vim" data-theme="github-light github-dark"><code data-language="vim" data-theme="github-light github-dark" style="display:grid;"><span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:w </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">保存</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:w </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">!</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">sudo tee % </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">使用 sudo 保存当前文件</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:wq or :x or ZZ </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">保存并退出</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:q </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">退出(修改未保存时警告)</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:q</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">!</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> or ZQ </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">不保存强制退出</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:wqa </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">保存所有标签页并全部退出</span></span></code></pre></figure>
|
|||
|
<h2 id="查找替换">查找/替换<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#查找替换" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h2>
|
|||
|
<figure data-rehype-pretty-code-figure><pre tabindex="0" data-language="vim" data-theme="github-light github-dark"><code data-language="vim" data-theme="github-light github-dark" style="display:grid;"><span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">/pattern </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">查找 pattern</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">?</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">pattern </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">向上查找 pattern</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">\</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">vpattern </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">pattern 中的非字母数字字符被视为正则表达式特殊字符 (不需转义字符)</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">n </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">查找下一个</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">N </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">查找上一个</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:%s</span><span style="--shiki-light:#032F62;--shiki-dark:#DBEDFF;">/old/</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">new/g </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">替换全部</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:%s</span><span style="--shiki-light:#032F62;--shiki-dark:#DBEDFF;">/old/</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">new/gc </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(逐个)替换</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:noh[lsearch] </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">移除搜索结果的高亮显示</span></span></code></pre></figure>
|
|||
|
<h2 id="多文件搜索">多文件搜索<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#多文件搜索" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h2>
|
|||
|
<figure data-rehype-pretty-code-figure><pre tabindex="0" data-language="vim" data-theme="github-light github-dark"><code data-language="vim" data-theme="github-light github-dark" style="display:grid;"><span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:vim[grep] </span><span style="--shiki-light:#032F62;--shiki-dark:#DBEDFF;">/pattern/</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> {`{file}`} </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">在多个文件中搜索 pattern</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">e.g. :vim[grep] </span><span style="--shiki-light:#032F62;--shiki-dark:#DBEDFF;">/foo/</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> **/*</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:cn[ext] </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">移动至下一个</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">cp</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">[revious] </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">移动至上一个</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:cope[n] </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">打开搜索结果列表</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:ccl[ose] </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">关闭 quickfix 窗口</span></span></code></pre></figure>
|
|||
|
<h2 id="标签">标签<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#标签" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h2>
|
|||
|
<figure data-rehype-pretty-code-figure><pre tabindex="0" data-language="vim" data-theme="github-light github-dark"><code data-language="vim" data-theme="github-light github-dark" style="display:grid;"><span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:tabnew or :tabnew {page.words.file} </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">在新标签中打开文件</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">Ctrl </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">+</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> wT </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">将窗口变成标签</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">gt or :tabn[ext] </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">切换到下一个标签</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">gT or :tabp[revious] </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">切换到上一个标签</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">#</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">gt </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">切换到第 </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">#</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> 个标签</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:tabm[ove] </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">#</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">移动标签到第 </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">#</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> 位(下标从 </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">0</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> 开始)</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:tabc[lose] </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">关闭当前标签</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:tabo[nly] </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">关闭其他标签</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:tabdo </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">command</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">在所有标签中执行命令 (例如 :tabdo q 关闭所有标签)</span></span></code></pre></figure>
|
|||
|
<h2 id="多文件编辑">多文件编辑<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#多文件编辑" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h2>
|
|||
|
<figure data-rehype-pretty-code-figure><pre tabindex="0" data-language="vim" data-theme="github-light github-dark"><code data-language="vim" data-theme="github-light github-dark" style="display:grid;"><span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:e[dit] 文件名 </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">新建缓冲区打开 filename</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:bn[ext] </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">切换到下个缓冲区</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:bp[revious] </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">切换到上个缓冲区</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:bd[elete] </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">关闭缓冲区</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:b[uffer]</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">#</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">切换到第 </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">#</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> 个缓冲区</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:b[uffer] file </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">用文件名切换缓冲区</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">ls</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> or :buffers </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">列出所有打开的缓冲区</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">sp</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">[lit] 文件名 </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">新建缓冲区打开 filename 并水平分割窗口</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:vs[plit] 文件名 </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">新缓冲区打开 filename 并垂直分割窗口</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:vert[ical] ba[ll] </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">垂直分割窗口编辑所有缓冲区</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:tab ba[ll] </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">标签页编辑所有缓冲区</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">Ctrl </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">+</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> ws</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">水平分割窗口</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">Ctrl </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">+</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> wv </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">垂直分割窗口</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">Ctrl </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">+</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> ww</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">在窗口间切换</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">Ctrl </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">+</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> wq </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">关闭窗口</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">Ctrl </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">+</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> wx </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">当前窗口与下一个窗口交换位置</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">Ctrl </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">+</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> w</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">令所有窗口高 & 宽一致</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">Ctrl </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">+</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> wh</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">切换到左侧窗口</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">Ctrl </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">+</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> wl </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">切换到右侧窗口</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">Ctrl </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">+</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> wj </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">切换到下侧窗口</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">Ctrl </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">+</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> wk </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">切换到上侧窗口</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">Ctrl </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">+</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> wH </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">使游标所在视窗全高并移至最左 (最左垂直视窗)</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">Ctrl </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">+</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> wL </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">使游标所在视窗全高并移至最右 (最右垂直视窗)</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">Ctrl </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">+</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> wJ </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">使游标所在视窗全宽并移至最下 (最下水平视窗)</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">Ctrl </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">+</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> wK </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">使游标所在视窗全宽并移至最上 (最上水平视窗)</span></span></code></pre></figure>
|
|||
|
<h2 id="diff">Diff<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#diff" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h2>
|
|||
|
<figure data-rehype-pretty-code-figure><pre tabindex="0" data-language="vim" data-theme="github-light github-dark"><code data-language="vim" data-theme="github-light github-dark" style="display:grid;"><span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">zf </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">定义折叠修饰符</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">zd </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">删除光标位置的折叠</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">za </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">展开 & 关闭光标位置的折叠</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">zo </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">展开光标位置的折叠</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">zc </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">关闭光标位置的折叠</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">zr </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">展开同级的所有折叠</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">zm </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">关闭同级的所有折叠</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">zi </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">开启 & 关闭折叠功能</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">]c </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">光标移至下一处差异</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">[c </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">光标移至上一处差异</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">do</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> or :diffg[</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">et</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">] </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">将另一缓冲区中的差异合并至当前缓冲区</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">dp or :diffpu[t] </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">将当前缓冲区中的差异推送至另一缓冲区</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:diffthis </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">令当前窗口成为 </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">diff</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> 模式的窗口之一</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:dif[fupdate] </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">强制刷新 </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">diff</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> 的高亮与折叠</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:diffo[</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">ff</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">] </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> - </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">令当前窗口退出 </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">diff</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> 模式</span></span></code></pre></figure>
|
|||
|
<p>折叠命令 (e.g. za) 只作用于当前级别。使用大写字母 (e.g. zA) 令命令作用于全部级别。</p>
|
|||
|
<p>可以直接在终端运行 vimdiff 查看文件间的不同。也可以将该程序设为 git difftool 的选项之一。</p></article><hr/><div class="page-footer"></div></div><div class="right sidebar"><div class="graph"><h3>关系图谱</h3><div class="graph-outer"><div id="graph-container" data-cfg="{"drag":true,"zoom":true,"depth":1,"scale":1.1,"repelForce":0.5,"centerForce":0.3,"linkDistance":30,"fontSize":0.6,"opacityScale":1,"showTags":true,"removeTags":[],"focusOnHover":false}"></div><button id="global-graph-icon" aria-label="Global Graph"><svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 55 55" fill="currentColor" xml:space="preserve"><path d="M49,0c-3.309,0-6,2.691-6,6c0,1.035,0.263,2.009,0.726,2.86l-9.829,9.829C32.542,17.634,30.846,17,29,17
|
|||
|
s-3.542,0.634-4.898,1.688l-7.669-7.669C16.785,10.424,17,9.74,17,9c0-2.206-1.794-4-4-4S9,6.794,9,9s1.794,4,4,4
|
|||
|
c0.74,0,1.424-0.215,2.019-0.567l7.669,7.669C21.634,21.458,21,23.154,21,25s0.634,3.542,1.688,4.897L10.024,42.562
|
|||
|
C8.958,41.595,7.549,41,6,41c-3.309,0-6,2.691-6,6s2.691,6,6,6s6-2.691,6-6c0-1.035-0.263-2.009-0.726-2.86l12.829-12.829
|
|||
|
c1.106,0.86,2.44,1.436,3.898,1.619v10.16c-2.833,0.478-5,2.942-5,5.91c0,3.309,2.691,6,6,6s6-2.691,6-6c0-2.967-2.167-5.431-5-5.91
|
|||
|
v-10.16c1.458-0.183,2.792-0.759,3.898-1.619l7.669,7.669C41.215,39.576,41,40.26,41,41c0,2.206,1.794,4,4,4s4-1.794,4-4
|
|||
|
s-1.794-4-4-4c-0.74,0-1.424,0.215-2.019,0.567l-7.669-7.669C36.366,28.542,37,26.846,37,25s-0.634-3.542-1.688-4.897l9.665-9.665
|
|||
|
C46.042,11.405,47.451,12,49,12c3.309,0,6-2.691,6-6S52.309,0,49,0z M11,9c0-1.103,0.897-2,2-2s2,0.897,2,2s-0.897,2-2,2
|
|||
|
S11,10.103,11,9z M6,51c-2.206,0-4-1.794-4-4s1.794-4,4-4s4,1.794,4,4S8.206,51,6,51z M33,49c0,2.206-1.794,4-4,4s-4-1.794-4-4
|
|||
|
s1.794-4,4-4S33,46.794,33,49z M29,31c-3.309,0-6-2.691-6-6s2.691-6,6-6s6,2.691,6,6S32.309,31,29,31z M47,41c0,1.103-0.897,2-2,2
|
|||
|
s-2-0.897-2-2s0.897-2,2-2S47,39.897,47,41z M49,10c-2.206,0-4-1.794-4-4s1.794-4,4-4s4,1.794,4,4S51.206,10,49,10z"></path></svg></button></div><div id="global-graph-outer"><div id="global-graph-container" data-cfg="{"drag":true,"zoom":true,"depth":-1,"scale":0.9,"repelForce":0.5,"centerForce":0.3,"linkDistance":30,"fontSize":0.6,"opacityScale":1,"showTags":true,"removeTags":[],"focusOnHover":true}"></div></div></div><div class="toc desktop-only"><button type="button" id="toc" class aria-controls="toc-content" aria-expanded="true"><h3>目录</h3><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="fold"><polyline points="6 9 12 15 18 9"></polyline></svg></button><div id="toc-content" class><ul class="overflow"><li class="depth-0"><a href="#vim-cheat-sheet" data-for="vim-cheat-sheet">Vim Cheat Sheet</a></li><li class="depth-0"><a href="#全局" data-for="全局">全局</a></li><li class="depth-0"><a href="#移动光标" data-for="移动光标">移动光标</a></li><li class="depth-0"><a href="#插入模式---插入追加文本" data-for="插入模式---插入追加文本">插入模式 - 插入/追加文本</a></li><li class="depth-0"><a href="#编辑文本" data-for="编辑文本">编辑文本</a></li><li class="depth-0"><a href="#选择文本可视化模式" data-for="选择文本可视化模式">选择文本(可视化模式)</a></li><li class="depth-0"><a href="#可视化模式命令" data-for="可视化模式命令">可视化模式命令</a></li><li class="depth-0"><a href="#寄存器" data-for="寄存器">寄存器</a></li><li class="depth-0"><a href="#标记" data-for="标记">标记</a></li><li class="depth-0"><a href="#宏" data-for="宏">宏</a></li><li class="depth-0"><a href="#剪切-复制-粘贴" data-for="剪切-复制-粘贴">剪切, 复制, 粘贴</a></li><li class="depth-0"><a href="#文字缩进" data-for="文字缩进">文字缩进</a></li><li class="depth-0"><a href="#退出" data-for="退出">退出</a></li><li class="depth-0"><a href="#查找替换" data-for="查找替换">查找/替换</a></li><li class="depth-0"><a href="#多文件搜索" data-for="多文件搜索">多文件搜索</a></li><li class="depth-0"><a href="#标签" data-for="标签">标签</a></li><li class="depth-0"><a href="#多文件编辑" data-for="多文件编辑">多文件编辑</a></li><li class="depth-0"><a href="#diff" data-for="diff">Diff</a></li></ul></div></div><div class="explorer mobile-only"><button type="button" id="explorer" data-behavior="collapse" data-collapsed="collapsed" data-savestate="true" data-tree="[{"path":"Personal","collapsed":true},{"path":"Personal/Blog","collapsed":true},{"path":"Personal/Blog/2018","collapsed":true},{"path":"Personal/Blog/2020","collapsed":true},{"path":"Personal/Blog/2021","collapsed":true},{"path":"Personal/Blog/2022","collapsed":true},{"path":"Personal/Blog/2023","collapsed":true},{"path":"Personal/Blog/2024","collapsed":true},{"path":"Personal/Book","collapsed":true},{"path":"Personal/Book/个人成长","collapsed":true},{"path":"Personal/Book/医学健康","collapsed":true},{"path":"Personal/Book/历史","collapsed":true},{"path":"Personal/Book/哲学宗教","collapsed":true},{"path":"Personal/Book/心理","collapsed":true},{"path":"Personal/Book/政治军事","collapsed":true},{"path":"Personal/Book/教育学习","collapsed":true},{"path&
|
|||
|
</script><script type="module">
|
|||
|
let mermaidImport = undefined
|
|||
|
document.addEventListener('nav', async () => {
|
|||
|
if (document.querySelector("code.mermaid")) {
|
|||
|
mermaidImport ||= await import('https://cdnjs.cloudflare.com/ajax/libs/mermaid/10.7.0/mermaid.esm.min.mjs')
|
|||
|
const mermaid = mermaidImport.default
|
|||
|
const darkMode = document.documentElement.getAttribute('saved-theme') === 'dark'
|
|||
|
mermaid.initialize({
|
|||
|
startOnLoad: false,
|
|||
|
securityLevel: 'loose',
|
|||
|
theme: darkMode ? 'dark' : 'default'
|
|||
|
})
|
|||
|
|
|||
|
await mermaid.run({
|
|||
|
querySelector: '.mermaid'
|
|||
|
})
|
|||
|
}
|
|||
|
});
|
|||
|
</script><script src="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.9/contrib/copy-tex.min.js" type="application/javascript"></script><script src="../../../../postscript.js" type="module"></script></html>
|