skip to content
Liu Yang's Blog

用 vim-plug 安装 Vim 插件

/ 1 min read

Updated:
Table of Contents

vim-plug 是一个轻量的 Vim 插件管理器。安装好 vim-plug 之后(方法见官方 README),装插件只需要三步。下面以 EasyMotion 为例。

1. 在 .vimrc 中声明插件

在用户目录下的 .vimrc 中加入:

call plug#begin('~/vimfiles/plugged')
Plug 'easymotion/vim-easymotion'
call plug#end()
" 与系统剪贴板共享
set clipboard=unnamedplus
" Leader 键设为空格
let mapleader = " "
" 空格 空格 w / b:向后 / 向前按单词跳转
nmap <Leader><Leader>w <Plug>(easymotion-w)
nmap <Leader><Leader>b <Plug>(easymotion-b)

~/vimfiles/plugged 是 Windows 下的习惯路径,Linux / macOS 上一般写 ~/.vim/plugged。

2. 安装插件

打开 Vim,执行:

:PlugInstall

3. 重启 Vim

重启后即可使用。按两下空格再按 w,屏幕上的单词会被标上字母,按对应字母就能直接跳过去。

多台机器之间同步 .vimrc 等配置,可以参考 用 Stow + Git 管理 dotfiles。