本篇记录Vim相关的一些插件用法及使用中的问题作为参考文档。

Basic

vim-plug

vim插件管理器

junegunn/vim-plug: Minimalist Vim Plugin Manager

一个Vim插件管理器,利用异步并行可以快速地安装、更新和卸载插件。

  • 安装

    :PlugInstall

  • 卸载

    :PlugClean

  • 升级

    :PlugUpdate

  • 列表

    :PlugStatus

加速源:

VIM-Plug安装插件时,频繁更新失败,或报端口443被拒绝 - 知乎 (zhihu.com)

Just a moment… (fastgit.org)

GitHub: Where the world builds software · GitHub (gitfast.tk)

nerdtree

树形文件管理器

preservim/nerdtree: A tree explorer plugin for vim.

  • 呼出

    :NERDTree

可视模式下通过*搜索

nelstrom/vim-visual-star-search: Start a * or # search from a visual block (github.com)

tpope

Tim Pope 大神做的的几个vim必备插件

tpope/vim-surround: surround.vim: quoting/parenthesizing made simple

tpope/vim-commentary: commentary.vim: comment stuff out

tpope/vim-speeddating: speeddating.vim: use CTRL-A/CTRL-X to increment dates, times, and more

tpope/vim-repeat: repeat.vim: enable repeating supported plugin maps with “.”

vim-surround

自动环绕(围绕)

  • 新增()-ys

    假设inner word添加[]

    ysiw]

    假设line添加’()’

    yss(

  • 删除 - ds

    假设删除()

    ds{

  • 改变 - cs

  • 可视模式 - S

    S(

vim-commentary

快速注释

  • 注释行

    gcc

  • 注释对象

    gc+object

vim-speeddating

强化<C-A><C-X>,支持时间加减

vim-repeat

使用’.'重复以上插件的动作

easymotion

快速移动光标

easymotion/vim-easymotion: Vim motions on speed!

参考vim easymotion 瞬间移动大法[视频] - 知乎

Beautify

vim-airline

状态栏美化,且支持另外的多个插件

vim-airline/vim-airline: lean & mean status/tabline for vim that’s light as air

zoom

通过+-符号放大缩小Gvim

vim-scripts/zoom.vim: control gui font size with “+” or “-” keys.

Function

AutoComplPop

比较简单的一个自动补全插件

vim-scripts/AutoComplPop: Automatically opens popup menu for completions

load_template

载入模板插件

vim-scripts/load_template: Loading templates as html,makefile,class … and you can make template yourself!

VisIncr

数字列操作

vim-scripts/VisIncr: Produce increasing/decreasing columns of numbers, dates, or daynames

ALE

代码检查插件

dense-analysis/ale: Check syntax in Vim asynchronously and fix files, with Language Server Protocol (LSP) support

ALE作为verilog的代码检查工具时,外置Linter返回的文本在Windows系统下会存在问题(正则表达式不匹配),需要自行替换其正则表达式。详情可参考:

以我的为例(iverilog.vim):(可能出现的问题语句为C:\Users\Honk\AppData\Local\Temp\VIABCBF.tmp\PipelineMIPS.v:41: syntax error,原pattern无法匹配)

1
2
"let l:pattern = '^[^:]\+:\(\d\+\): \(warning\|error\|syntax error\)\(: \(.\+\)\)\?'
let l:pattern = '^.\+:\(\d\+\): \(warning\|error\|syntax error\)\(: \(.\+\)\)\?'

Draw

tablify

画表格

stormherz/tablify: Tablify is a VIM plugin that turns simple structured data into nice-looking tables

DrawIt

画ASCII图

vim-scripts/DrawIt: Ascii drawing plugin: lines, ellipses, arrows, fills, and more!

Mapping

快捷键mapping的各种配置方法

Vim快捷键映射mapping - 知乎 (zhihu.com)