645 lines
500 KiB
HTML
645 lines
500 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 配置文件 vimrc 的管理,包括不同操作系统下的 vimrc 文件位置、基本结构、示例配置及插件管理。."/><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 配置文件 vimrc 的管理,包括不同操作系统下的 vimrc 文件位置、基本结构、示例配置及插件管理。."/><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/2.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.29,7,17.5
|
|||
|
<h3 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></h3>
|
|||
|
<p><code>vimrc</code> 文件是 Vim 的配置文件,用于存储用户的个人设置和定制。它的位置可能因操作系统而异:</p>
|
|||
|
<ul>
|
|||
|
<li><strong>Linux/Unix</strong>:通常在 <code>~/.vimrc</code> 或 <code>~/.vim/vimrc</code></li>
|
|||
|
<li><strong>MacOS</strong>:类似于 Linux,通常在 <code>~/.vimrc</code> 或 <code>~/.vim/vimrc</code></li>
|
|||
|
<li><strong>Windows</strong>:在 <code>C:\Users\<用户名>\_vimrc</code> 或 <code>C:\Users\<用户名>\vimfiles\vimrc</code></li>
|
|||
|
</ul>
|
|||
|
<p>在 Vim 中,可以通过以下命令查看 <code>vimrc</code> 文件的位置:</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;">:</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">echo</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> $MYVIMRC</span></span></code></pre></figure>
|
|||
|
<h3 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></h3>
|
|||
|
<p>一个典型的 <code>vimrc</code> 文件可能包含以下几部分:</p>
|
|||
|
<ol>
|
|||
|
<li><strong>全局设置</strong>:设置 Vim 的全局行为,例如编码、文件格式等。</li>
|
|||
|
<li><strong>界面设置</strong>:配置界面元素,例如行号、颜色主题、状态栏等。</li>
|
|||
|
<li><strong>编辑设置</strong>:调整编辑行为,例如自动缩进、搜索选项等。</li>
|
|||
|
<li><strong>插件设置</strong>:加载和配置 Vim 插件。</li>
|
|||
|
<li><strong>快捷键映射</strong>:自定义快捷键,提升编辑效率。</li>
|
|||
|
</ol>
|
|||
|
<h3 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></h3>
|
|||
|
<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:#6A737D;--shiki-dark:#6A737D;">" 全局设置</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">set</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> nocompatible</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> " 关闭与 Vi 的兼容模式</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">filetype</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> off</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> " 关闭文件类型检测</span></span>
|
|||
|
<span data-line> </span>
|
|||
|
<span data-line><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">" 界面设置</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">set</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> number</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> " 显示行号</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">syntax on</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> " 启用语法高亮</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">set</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> background</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">dark</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> " 设置背景色为暗色系</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">colorscheme</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> desert</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> " 使用 desert 颜色主题</span></span>
|
|||
|
<span data-line> </span>
|
|||
|
<span data-line><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">" 编辑设置</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">set</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> tabstop</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">4</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> " 设置 Tab 宽度为 4 个空格</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">set</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> shiftwidth</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">4</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> " 设置自动缩进的宽度为 4 个空格</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">set</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> expandtab</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> " 将 Tab 转换为空格</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">set</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> autoindent</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> " 自动缩进新行</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">set</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> hlsearch</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> " 高亮搜索结果</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">set</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> incsearch</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> " 增量搜索</span></span>
|
|||
|
<span data-line> </span>
|
|||
|
<span data-line><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">" 插件设置</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">call</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> plug#begin</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'~/.vim/plugged'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">Plug</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> 'scrooloose/nerdtree'</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> " 文件树插件</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">Plug</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> 'tpope/vim-fugitive'</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> " Git 集成插件</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">call</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> plug#end</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">()</span></span>
|
|||
|
<span data-line> </span>
|
|||
|
<span data-line><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">" 快捷键映射</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">nnoremap</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> <</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">C-n</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">> :NERDTreeToggle<</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">CR</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">></span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> " Ctrl+n 切换 NERDTree</span></span></code></pre></figure>
|
|||
|
<h3 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></h3>
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
<div class="table-container"><table><thead><tr><th>配置选项</th><th>说明</th><th>示例</th></tr></thead><tbody><tr><td><code>set nocompatible</code></td><td>关闭与 Vi 的兼容模式</td><td><code>set nocompatible</code></td></tr><tr><td><code>set number</code></td><td>显示行号</td><td><code>set number</code></td></tr><tr><td><code>set relativenumber</code></td><td>显示相对行号</td><td><code>set relativenumber</code></td></tr><tr><td><code>set tabstop</code></td><td>设置 Tab 宽度(以空格数表示)</td><td><code>set tabstop=4</code></td></tr><tr><td><code>set shiftwidth</code></td><td>设置自动缩进的宽度(以空格数表示)</td><td><code>set shiftwidth=4</code></td></tr><tr><td><code>set expandtab</code></td><td>将 Tab 转换为空格</td><td><code>set expandtab</code></td></tr><tr><td><code>set autoindent</code></td><td>自动缩进新行</td><td><code>set autoindent</code></td></tr><tr><td><code>set smartindent</code></td><td>智能缩进</td><td><code>set smartindent</code></td></tr><tr><td><code>set hlsearch</code></td><td>高亮搜索结果</td><td><code>set hlsearch</code></td></tr><tr><td><code>set incsearch</code></td><td>增量搜索</td><td><code>set incsearch</code></td></tr><tr><td><code>set ignorecase</code></td><td>搜索时忽略大小写</td><td><code>set ignorecase</code></td></tr><tr><td><code>set smartcase</code></td><td>智能大小写匹配</td><td><code>set smartcase</code></td></tr><tr><td><code>syntax on</code></td><td>启用语法高亮</td><td><code>syntax on</code></td></tr><tr><td><code>set background</code></td><td>设置背景色(dark 或 light)</td><td><code>set background=dark</code></td></tr><tr><td><code>colorscheme</code></td><td>设置颜色主题</td><td><code>colorscheme desert</code></td></tr><tr><td><code>set cursorline</code></td><td>高亮当前行</td><td><code>set cursorline</code></td></tr><tr><td><code>set wrap</code></td><td>自动换行显示长行</td><td><code>set wrap</code></td></tr><tr><td><code>set nowrap</code></td><td>禁止自动换行显示长行</td><td><code>set nowrap</code></td></tr><tr><td><code>set linebreak</code></td><td>在单词边界处换行</td><td><code>set linebreak</code></td></tr><tr><td><code>set showcmd</code></td><td>显示部分命令(在底部命令行显示)</td><td><code>set showcmd</code></td></tr><tr><td><code>set ruler</code></td><td>显示光标位置(行号和列号)</td><td><code>set ruler</code></td></tr><tr><td><code>set wildmenu</code></td><td>命令行补全增强</td><td><code>set wildmenu</code></td></tr><tr><td><code>set clipboard</code></td><td>使用系统剪贴板</td><td><code>set clipboard=unnamedplus</code></td></tr><tr><td><code>set backspace</code></td><td>设置退格键的行为</td><td><code>set backspace=indent,eol,start</code></td></tr><tr><td><code>set mouse</code></td><td>启用鼠标操作(a 为全部模式启用)</td><td><code>set mouse=a</code></td></tr><tr><td><code>set splitbelow</code></td><td>新窗口在当前窗口下方打开</td><td><code>set splitbelow</code></td></tr><tr><td><code>set splitright</code></td><td>新窗口在当前窗口右侧打开</td><td><code>set splitright</code></td></tr><tr><td><code>set foldmethod</code></td><td>设置折叠方法(syntax、indent 等)</td><td><code>set foldmethod=syntax</code></td></tr><tr><td><code>set foldlevel</code></td><td>设置折叠级别</td><td><code>set foldlevel=99</code></td></tr><tr><td><code>set termguicolors</code></td><td>启用真彩色支持(需要终端支持)</td><td><code>set termguicolors</code></td></tr><tr><td><code>set guifont</code></td><td>设置 GUI 字体(在 GUI Vim 中使用)</td><td><code>set guifont=Monaco:h12</code></td></tr><tr><td><code>set encoding</code></td><td>设置文件编码</td><td><code>set encoding=utf-8</code></td></tr><tr><td><code>filetype plugin indent on</code></td><td>启用文件类型检测和插件</td><td><code>filetype plugin indent on</code></td></tr><tr><td><code>set spell</code></td><td>启用拼写检查</td><td><code>set spell</c
|
|||
|
<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>
|
|||
|
<h3 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></h3>
|
|||
|
<p>Vim 提供了强大的快捷键映射功能,用户可以根据需要自定义快捷键。常用的映射命令有:</p>
|
|||
|
<ul>
|
|||
|
<li><code>map</code>:通用映射</li>
|
|||
|
<li><code>nmap</code>:普通模式下的映射</li>
|
|||
|
<li><code>imap</code>:插入模式下的映射</li>
|
|||
|
<li><code>vmap</code>:可视模式下的映射</li>
|
|||
|
</ul>
|
|||
|
<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:#D73A49;--shiki-dark:#F97583;">nnoremap</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> <</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">C-s</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">> :w<</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">CR</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">></span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> " 在普通模式下,Ctrl+s 保存文件</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">inoremap</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> <</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">C-c</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">> <</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">Esc</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">></span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> " 在插入模式下,Ctrl+c 切换到普通模式</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">vnoremap</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> <</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">C-c</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">> </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"+y "</span><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;">c 复制到系统剪贴板</span></span></code></pre></figure>
|
|||
|
<h3 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></h3>
|
|||
|
<p>以下是一些常用的快捷键示例,这些快捷键可以提高日常编辑的效率:</p>
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
<div class="table-container"><table><thead><tr><th>快捷键配置</th><th>模式</th><th>说明</th><th>示例</th></tr></thead><tbody><tr><td><code>nnoremap <C-s> :w<CR></code></td><td>普通模式</td><td><code>Ctrl+s</code> 保存文件</td><td><code>nnoremap <C-s> :w<CR></code></td></tr><tr><td><code>inoremap <C-c> <Esc></code></td><td>插入模式</td><td><code>Ctrl+c</code> 退出插入模式</td><td><code>inoremap <C-c> <Esc></code></td></tr><tr><td><code>vnoremap <C-c> "+y</code></td><td>可视模式</td><td><code>Ctrl+c</code> 复制到系统剪贴板</td><td><code>vnoremap <C-c> "+y</code></td></tr><tr><td><code>nnoremap <C-x> :q<CR></code></td><td>普通模式</td><td><code>Ctrl+x</code> 退出 Vim</td><td><code>nnoremap <C-x> :q<CR></code></td></tr><tr><td><code>nnoremap <C-t> :tabnew<CR></code></td><td>普通模式</td><td><code>Ctrl+t</code> 打开新标签</td><td><code>nnoremap <C-t> :tabnew<CR></code></td></tr><tr><td><code>nnoremap <C-n> :NERDTreeToggle<CR></code></td><td>普通模式</td><td><code>Ctrl+n</code> 切换 NERDTree 文件树</td><td><code>nnoremap <C-n> :NERDTreeToggle<CR></code></td></tr><tr><td><code>nnoremap <Leader>f :Files<CR></code></td><td>普通模式</td><td><code>Leader+f</code> 调用 FZF 查找文件</td><td><code>nnoremap <Leader>f :Files<CR></code></td></tr><tr><td><code>nnoremap <Leader>g :Gstatus<CR></code></td><td>普通模式</td><td><code>Leader+g</code> 调用 Git 状态</td><td><code>nnoremap <Leader>g :Gstatus<CR></code></td></tr><tr><td><code>nnoremap <Leader>w :w!<CR></code></td><td>普通模式</td><td><code>Leader+w</code> 强制保存文件</td><td><code>nnoremap <Leader>w :w!<CR></code></td></tr><tr><td><code>nnoremap <Leader>q :q!<CR></code></td><td>普通模式</td><td><code>Leader+q</code> 强制退出 Vim</td><td><code>nnoremap <Leader>q :q!<CR></code></td></tr><tr><td><code>nnoremap <Leader>r :source $MYVIMRC<CR></code></td><td>普通模式</td><td><code>Leader+r</code> 重新加载 <code>vimrc</code> 文件</td><td><code>nnoremap <Leader>r :source $MYVIMRC<CR></code></td></tr><tr><td><code>vnoremap <Leader>y "+y</code></td><td>可视模式</td><td><code>Leader+y</code> 复制选中文本到系统剪贴板</td><td><code>vnoremap <Leader>y "+y</code></td></tr><tr><td><code>nnoremap <Leader>p "+p</code></td><td>普通模式</td><td><code>Leader+p</code> 从系统剪贴板粘贴</td><td><code>nnoremap <Leader>p "+p</code></td></tr><tr><td><code>nnoremap <Leader>t :terminal<CR></code></td><td>普通模式</td><td><code>Leader+t</code> 打开终端</td><td><code>nnoremap <Leader>t :terminal<CR></code></td></tr><tr><td><code>nnoremap <C-j> :cnext<CR></code></td><td>普通模式</td><td><code>Ctrl+j</code> 跳到下一个 QuickFix 项</td><td><code>nnoremap <C-j> :cnext<CR></code></td></tr><tr><td><code>nnoremap <C-k> :cprev<CR></code></td><td>普通模式</td><td><code>Ctrl+k</code> 跳到上一个 QuickFix 项</td><td><code>nnoremap <C-k> :cprev<CR></code></td></tr><tr><td><code>nnoremap <Leader>n :nohlsearch<CR></code></td><td>普通模式</td><td><code>Leader+n</code> 取消搜索高亮</td><td><code>nnoremap <Leader>n :nohlsearch<CR></code></td></tr><tr><td><code>nnoremap <Leader>e :e ~/.vimrc<CR></code></td><td>普通模式</td><td><code>Leader+e</code> 打开 <code>vimrc</code> 文件</td><td><code>nnoremap <Leader>e :e ~/.vimrc<CR></code></td></tr><tr><td><code>nnoremap <Leader>d "_d</code></td><td>普通模式</td><td><code>Leader+d</code> 删除但不复制到寄存器</td><td><code>nnoremap <Leader>d "_d</code></td></tr></tbody></table></div>
|
|||
|
<h2 id="vim-插件管理">Vim 插件管理<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#vim-插件管理" 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>
|
|||
|
<h3 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></h3>
|
|||
|
<h4 id="vundle">Vundle<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#vundle" 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></h4>
|
|||
|
<p><a href="https://github.com/VundleVim/Vundle.vim" class="external">Vundle<svg aria-hidden="true" class="external-icon" viewBox="0 0 512 512"><path d="M320 0H288V64h32 82.7L201.4 265.4 178.7 288 224 333.3l22.6-22.6L448 109.3V192v32h64V192 32 0H480 320zM32 32H0V64 480v32H32 456h32V480 352 320H424v32 96H64V96h96 32V32H160 32z"></path></svg></a> 是一个流行的 Vim 插件管理工具,安装步骤如下:</p>
|
|||
|
<ol>
|
|||
|
<li>
|
|||
|
<p>克隆 Vundle 仓库到 Vim 的插件目录:</p>
|
|||
|
<figure data-rehype-pretty-code-figure><pre tabindex="0" data-language="shell" data-theme="github-light github-dark"><code data-language="shell" data-theme="github-light github-dark" style="display:grid;"><span data-line><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">$</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> git</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> clone</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> https://github.com/VundleVim/Vundle.vim.git</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> ~/.vim/bundle/Vundle.vim</span></span></code></pre></figure>
|
|||
|
</li>
|
|||
|
<li>
|
|||
|
<p>在 <code>vimrc</code> 文件中添加以下内容:</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:#D73A49;--shiki-dark:#F97583;">set</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> nocompatible</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> " 关闭 Vi 兼容模式</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">filetype</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> off</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> " 关闭文件类型检测</span></span>
|
|||
|
<span data-line> </span>
|
|||
|
<span data-line><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">" 设置 Vundle</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">set</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> rtp</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">+=~</span><span style="--shiki-light:#032F62;--shiki-dark:#DBEDFF;">/.vim/</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">bundle/Vundle.vim</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">call</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> vundle#begin</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:#D73A49;--shiki-dark:#F97583;">Plugin</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> 'VundleVim/Vundle.vim'</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">call</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> vundle#end</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">()</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> " 所有插件必须在这一行之前</span></span>
|
|||
|
<span data-line> </span>
|
|||
|
<span data-line><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">filetype</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> plugin indent on</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> " 启用文件类型检测</span></span></code></pre></figure>
|
|||
|
</li>
|
|||
|
</ol>
|
|||
|
<p><strong>基本使用</strong>:</p>
|
|||
|
<ul>
|
|||
|
<li>安装插件: 在 <code>vimrc</code> 中添加插件后,启动 Vim 并运行 <code>:PluginInstall</code>。</li>
|
|||
|
<li>更新插件: 启动 Vim 并运行 <code>:PluginUpdate</code>。</li>
|
|||
|
<li>删除插件: 从 <code>vimrc</code> 中移除插件行,启动 Vim 并运行 <code>:PluginClean</code>。</li>
|
|||
|
</ul>
|
|||
|
<h4 id="vim-plug">Vim-plug<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#vim-plug" 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></h4>
|
|||
|
<p><a href="https://github.com/junegunn/vim-plug" class="external">vim-plug<svg aria-hidden="true" class="external-icon" viewBox="0 0 512 512"><path d="M320 0H288V64h32 82.7L201.4 265.4 178.7 288 224 333.3l22.6-22.6L448 109.3V192v32h64V192 32 0H480 320zM32 32H0V64 480v32H32 456h32V480 352 320H424v32 96H64V96h96 32V32H160 32z"></path></svg></a> 是一个现代的 Vim 插件管理工具,安装步骤如下:</p>
|
|||
|
<ol>
|
|||
|
<li>
|
|||
|
<p>下载 vim-plug 并放入 <code>autoload</code> 目录:</p>
|
|||
|
<figure data-rehype-pretty-code-figure><pre tabindex="0" data-language="shell" data-theme="github-light github-dark"><code data-language="shell" data-theme="github-light github-dark" style="display:grid;"><span data-line><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">$</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> curl</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -fLo</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> ~/.vim/autoload/plug.vim</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --create-dirs</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim</span></span></code></pre></figure>
|
|||
|
</li>
|
|||
|
<li>
|
|||
|
<p>在 <code>vimrc</code> 文件中添加以下内容:</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:#D73A49;--shiki-dark:#F97583;">call</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> plug#begin</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'~/.vim/plugged'</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:#D73A49;--shiki-dark:#F97583;">Plug</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> 'junegunn/vim-plug'</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">call</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> plug#end</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">()</span></span></code></pre></figure>
|
|||
|
</li>
|
|||
|
</ol>
|
|||
|
<p><strong>基本使用</strong>:</p>
|
|||
|
<ul>
|
|||
|
<li>安装插件: 在 <code>vimrc</code> 中添加插件后,启动 Vim 并运行 <code>:PlugInstall</code>。</li>
|
|||
|
<li>更新插件: 启动 Vim 并运行 <code>:PlugUpdate</code>。</li>
|
|||
|
<li>删除插件: 从 <code>vimrc</code> 中移除插件行,启动 Vim 并运行 <code>:PlugClean</code>。</li>
|
|||
|
</ul>
|
|||
|
<h3 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></h3>
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
<div class="table-container"><table><thead><tr><th>插件</th><th>功能描述</th><th>安装配置示例(基于 vim-plug)</th><th>常用命令或快捷键</th></tr></thead><tbody><tr><td>NERDTree</td><td>文件树管理</td><td><code>Plug 'preservim/nerdtree'</code></td><td><code>:NERDTreeToggle</code></td></tr><tr><td>fzf.vim</td><td>模糊查找</td><td><code>Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }</code></td><td><code>:Files</code> <code>:Buffers</code></td></tr><tr><td>ctrlp.vim</td><td>文件和缓冲区切换</td><td><code>Plug 'ctrlpvim/ctrlp.vim'</code></td><td><code>:CtrlP</code></td></tr><tr><td>YouCompleteMe</td><td>代码补全</td><td><code>Plug 'ycm-core/YouCompleteMe'</code> (需要编译安装)</td><td>自动代码补全</td></tr><tr><td>Syntastic</td><td>语法检查</td><td><code>Plug 'vim-syntastic/syntastic'</code></td><td><code>:SyntasticCheck</code></td></tr><tr><td>vim-airline</td><td>状态栏美化</td><td><code>Plug 'vim-airline/vim-airline'</code> <code>Plug 'vim-airline/vim-airline-themes'</code></td><td>自动启用状态栏美化</td></tr><tr><td>vim-fugitive</td><td>Git 集成</td><td><code>Plug 'tpope/vim-fugitive'</code></td><td><code>:Gstatus</code> <code>:Gcommit</code> <code>:Gpush</code> <code>:Gpull</code></td></tr><tr><td>vim-surround</td><td>快速修改括号、引号等符号</td><td><code>Plug 'tpope/vim-surround'</code></td><td><code>ysiw]</code> <code>ds'</code> <code>cs"'</code></td></tr><tr><td>vim-commentary</td><td>快速注释代码</td><td><code>Plug 'tpope/vim-commentary'</code></td><td><code>gc</code> + 动作</td></tr><tr><td>vim-gitgutter</td><td>显示 Git 更改信息</td><td><code>Plug 'airblade/vim-gitgutter'</code></td><td>自动显示更改标记</td></tr></tbody></table></div>
|
|||
|
<h3 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></h3>
|
|||
|
<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:#D73A49;--shiki-dark:#F97583;">call</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> plug#begin</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'~/.vim/plugged'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span>
|
|||
|
<span data-line> </span>
|
|||
|
<span data-line><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">" 文件树管理</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">Plug</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> 'preservim/nerdtree'</span></span>
|
|||
|
<span data-line> </span>
|
|||
|
<span data-line><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">" 模糊查找</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">Plug</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> 'junegunn/fzf'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, { </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'do'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: { -> </span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">fzf#install</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">() } }</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">Plug</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> 'junegunn/fzf.vim'</span></span>
|
|||
|
<span data-line> </span>
|
|||
|
<span data-line><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">" 文件和缓冲区切换</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">Plug</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> 'ctrlpvim/ctrlp.vim'</span></span>
|
|||
|
<span data-line> </span>
|
|||
|
<span data-line><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">" 状态栏美化</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">Plug</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> 'vim-airline/vim-airline'</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">Plug</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> 'vim-airline/vim-airline-themes'</span></span>
|
|||
|
<span data-line> </span>
|
|||
|
<span data-line><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">" Git 集成</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">Plug</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> 'tpope/vim-fugitive'</span></span>
|
|||
|
<span data-line> </span>
|
|||
|
<span data-line><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">" 快速修改括号、引号等符号</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">Plug</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> 'tpope/vim-surround'</span></span>
|
|||
|
<span data-line> </span>
|
|||
|
<span data-line><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">" 快速注释代码</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">Plug</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> 'tpope/vim-commentary'</span></span>
|
|||
|
<span data-line> </span>
|
|||
|
<span data-line><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">" 显示 Git 更改信息</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">Plug</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> 'airblade/vim-gitgutter'</span></span>
|
|||
|
<span data-line> </span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">call</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> plug#end</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">()</span></span>
|
|||
|
<span data-line> </span>
|
|||
|
<span data-line><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">" 基本设置</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">set</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> nocompatible</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">set</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> number</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">set</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> relativenumber</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">set</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> tabstop</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">4</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">set</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> shiftwidth</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">4</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">set</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> expandtab</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">set</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> autoindent</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">set</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> hlsearch</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">set</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> incsearch</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">set</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> ignorecase</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">set</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> smartcase</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">syntax on</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">set</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> background</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">dark</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">colorscheme</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> desert</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">set</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> cursorline</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">set</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> wrap</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">set</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> showcmd</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">set</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> ruler</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">set</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> wildmenu</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">set</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> clipboard</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">unnamedplus</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">set</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> backspace</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">indent,</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">eol</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,start</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">set</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> mouse</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:#D73A49;--shiki-dark:#F97583;">set</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> splitbelow</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">set</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> splitright</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">set</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> foldmethod</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">syntax</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">set</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> foldlevel</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">99</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">set</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> termguicolors</span></span>
|
|||
|
<span data-line> </span>
|
|||
|
<span data-line><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">" 快捷键映射</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">nnoremap</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> <</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">C-n</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">> :NERDTreeToggle<</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">CR</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">></span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">nnoremap</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> <</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">C-p</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">> :CtrlP<</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">CR</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">></span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">nnoremap</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> <</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">Leader</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">>f :Files<</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">CR</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">></span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">nnoremap</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> <</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">Leader</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">>g :Gstatus<</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">CR</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">></span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">nnoremap</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> <</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">Leader</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">>w :w</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;">CR</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">></span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">nnoremap</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> <</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">Leader</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">>q :q</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;">CR</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">></span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">nnoremap</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> <</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">Leader</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">>r :</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">source</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> $MYVIMRC<</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">CR</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">></span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">vnoremap</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> <</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">Leader</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">>y </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"+y</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">nnoremap</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> <</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">Leader</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">>p </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"+p</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">nnoremap</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> <</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">Leader</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">>t :terminal<</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">CR</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">></span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">nnoremap</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> <</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">C-j</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">> :cnext<</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">CR</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">></span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">nnoremap</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> <</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">C-k</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">> :cprev<</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">CR</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">></span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">nnoremap</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> <</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">Leader</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">>n :</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">nohlsearch</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"><</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">CR</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">></span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">nnoremap</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> <</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">Leader</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">>e :e </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">~</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">/.vimrc<</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">CR</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">></span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">nnoremap</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> <</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">Leader</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">>d </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"_d</span></span>
|
|||
|
<span data-line> </span>
|
|||
|
<span data-line><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">" Airline 主题</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">let</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> g:airline_theme</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'luna'</span></span>
|
|||
|
<span data-line> </span>
|
|||
|
<span data-line><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">" GitGutter 配置</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">let</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> g:gitgutter_enabled </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> 1</span></span>
|
|||
|
<span data-line> </span></code></pre></figure></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="#vimrc-文件" data-for="vimrc-文件">vimrc 文件</a></li><li class="depth-1"><a href="#位置" data-for="位置">位置</a></li><li class="depth-1"><a href="#基本结构" data-for="基本结构">基本结构</a></li><li class="depth-1"><a href="#示例配置" data-for="示例配置">示例配置</a></li><li class="depth-1"><a href="#常用配置选项" data-for="常用配置选项">常用配置选项</a></li><li class="depth-0"><a href="#快捷键映射" data-for="快捷键映射">快捷键映射</a></li><li class="depth-1"><a href="#自定义快捷键" data-for="自定义快捷键">自定义快捷键</a></li><li class="depth-1"><a href="#常用快捷键示例" data-for="常用快捷键示例">常用快捷键示例</a></li><li class="depth-0"><a href="#vim-插件管理" data-for="vim-插件管理">Vim 插件管理</a></li><li class="depth-1"><a href="#插件管理工具" data-for="插件管理工具">插件管理工具</a></li><li class="depth-1"><a href="#常用插件" data-for="常用插件">常用插件</a></li><li class="depth-1"><a href="#配置示例" data-for="配置示例">配置示例</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":"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":"Pers
|
|||
|
</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>
|