Skip to content

你问我用什么Vim,我只能说LazyVim

About 962 wordsAbout 3 min

vimlazyvim

2025-09-17

从上大学那会就断断续续使用Vim,到现在也在使用,但是只是使用Vim的一些基本功能,也没有做积累,全靠平时工作使用,不用就会忘记。

说到LazyVim,我就要向大家推荐一下,我现在的LazyVim的配置文件,欢迎点赞:LazyVim Config

现在使用LazyVim,就是一个默认安装了许多插件的Vim工具,你也可以自己选择安装的插件并配置,但是使用默认的插件,简单的工作就能够适用了。

一、Install LazyVim

官方网站:LazyVim

直接参考官网的安装步骤:Installaton

  • Make a backup of your current Neovim files:

    # required
    mv ~/.config/nvim{,.bak}
    
    # optional but recommended
    mv ~/.local/share/nvim{,.bak}
    mv ~/.local/state/nvim{,.bak}
    mv ~/.cache/nvim{,.bak}
  • Clone the starter

    git clone https://github.com/LazyVim/starter ~/.config/nvim
  • Remove the .git folder, so you can add it to your own repo later

    rm -rf ~/.config/nvim/.git
  • Start Neovim!

    nvim

    Refer to the comments in the files on how to customize LazyVim.

二、Using

2.1、基本使用

LazyVim的配置文件目录:~/.config/nvim

:Lazy 进入到LazyVim的设置里面,有下面一下选项操作:

  • Install (I) :安装插件
  • Update (U) :更新配置中的插件
  • Sync (S) :
  • Clean (X) :
  • Check (C) :
  • Log (L) :
  • Restore (R):
  • Profile (P) :输出一下加载的内容
  • Debug (D)
  • Help (?)

2.2、LazyVim目录结构

主要目录 lua/config, lua/plugins

2.2.1、keymaps.lua

维护自己个性的自定义按键。

Java
-- Keymaps are automatically loaded on the VeryLazy event
-- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua
-- Add any additional keymaps here

2.2.2、options.lua

如果需要修改leader key,可以在lua/config/options.lua 里面修改,内容如下:

options.lua
-- Options are automatically loaded before lazy.nvim startup
-- Default options that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/options.lua
-- Add any additional options here
-- vim.g.mapleader = "\\"
vim.g.mapleader = "," -- 使用逗号当做leader key

local opt = vim.opt
opt.relativenumber = false -- 关闭相对行数

options文件在我们启动lazyvim的时候是默认加载的,下面给出了一个网址,我们可以看到里面一些默认的配置,在这个文件里面,我只是去修改了一下mapleader这个配置,默认是空格键,我将它设置成逗号。

三、Install Plugins

:Mason 来安装LSP

<leader> + cm mason s 开启跳转, ideavim里面是ss

ctrl + 上下左右来调整窗口的大小

<leader> + sh 打开帮助页

<leader> + ul 打开关闭行号

Ctrl + / 打开控制台

<leader> + fr 搜索最近打开的文件

3.1、nvim-neo-tree/neo-tree.nvim

一个目录树

使用:

3.1、LintaoAmons/easy-commands.nvim

统领快捷键

{
    "LintaoAmons/easy-commands.nvim",
    event = "VeryLazy",
    opts = {},
    -- use tag option to stay stable. This plugin is continues updating and adding more commands into it, pin to a tag should keep you stay where you are comfortable with.
    -- tag = "v0.8.0"
  }

:FormatCode , 格式化

3.2、folke/noice.nvim

LazyVim自带的消息通知。

  {
    "folke/noice.nvim",
    enabled = true,
  }

关闭插件 enabled = false

四、Question for LazyVim

4.1、Show hidden files in neo-tree

就是neo-tree目录树中显示隐藏文件,修改文件:.config/nvim/lua/plugins/default_plugin_config.lua

return {
  {
    "nvim-neo-tree/neo-tree.nvim",
    opts = {
      filesystem = {
        filtered_items = {
          hide_dotfiles = false,
        },
      },
    },
  },
}

4.2、LazyVim requires Neovim >= 0.11.2

因为更新了LazyVim导致现在的neovim版本不匹配,出现如下问题:

LazyVim requires Neovim >= 0.11.2
For more info, see: https://github.com/LazyVim/LazyVim/issues/6421

我的neovim现在是0.10.3,没有满足要求

(base) nvim nvim --version
NVIM v0.10.3
Build type: Release
LuaJIT 2.1.1736781742
Run "nvim -V1 -v" for more info

对neovim进行更新:

brew update
brew upgrade neovim

求求了,快滚去学习!!!

求求了求求了,快去学习吧!

【题单】贪心算法

不知道方向的时候,可以多看看书,书会给你指明下一步该干什么,加油!