BlockLune's Blog

首页 标签 关于 |

我的 Vim (以及 NeoVim) 配置

Vim 可以说是一个老古董了,但是在命令行文本编辑器这一领域,即使到目前,它说第二也没人能说第一。在这篇文章中,我们会进行一些简单的配置,让 Vim 更加好用。并且,我们还会谈到 NeoVim 相关的内容,通过安装和配置 LazyVim,来让 NeoVim 变为一个现代化的、全功能的 IDE。

Vim

首先备份你的 Vim 设置(如果你配置过的话):

mv .vimrc .vimrc.bak

接着,在开始下面的工作之前,记得配置好代理。因为下面的操作需要大量访问 GitHub。

安装 vim-plug,它是一个 Vim 插件管理器:

curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
    https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim

然后下载我的配置:

curl -o ~/.vimrc https://raw.githubusercontent.com/BlockLune/dotfiles/refs/heads/main/.vimrc

启动 Vim。这里会因为缺失插件报错,但我们启动它就是为了进去装插件的所以不用管,回车即可:

vim

最后,在 Vim 中运行 :PlugInstall 来安装这些插件。下面是部分插件的简介:

PluginBasic UsageLink
ack.vimSearch text in the project using :Ack commandGitHub
alePerform syntax checks while editing code with configured toolsGitHub
auto-pairsAutomatically insert closing brackets for opening bracketsGitHub
CamelCaseMotionPress <leader> followed by a motion command to move to the next/previous CamelCase wordGitHub
ctrlp.vimOpen CtrlP window with :CtrlP or <C-p>, then search and open filesGitHub
lightline.vimCustomize appearance and content of the statuslineGitHub
nerdtreeOpen NERDTree window with :NERDTree, navigate with hjkl keysGitHub
vim-commentaryComment/uncomment lines with gc or gC commandsGitHub
vim-draculaSwitch to Dracula theme with :colorscheme draculaGitHub
vim-easymotionTrigger EasyMotion with <Leader><Leader> and enter characters to jumpGitHub
vim-fugitiveView file status with :G status, commit changes with :G commit and so forthGitHub
vim-indent-guidesVisually display indent levels in VimGitHub
vim-sensibleConfigure Vim with sensible defaults for a pleasant editing experienceGitHub
vim-surroundChange surrounding characters with cst, delete surroundings with dst, and moreGitHub
vim-unimpairedProvides various useful mappings for manipulating vertical whitespace and moreGitHub
vim-visual-star-searchSearch for the visually selected text with * and # commandsGitHub
YouCompleteMeA code-completion engine for VimGitHub

NeoVim (LazyVim)

LazyVim 是一个 NeoVim 配置,它几乎已经是个 IDE 了。我基于 LazyVim 又进行了一些配置,你可以在 这里 找到。

其他软件中的 Vim 模式

TODO

参考和更多阅读资料