windows nvim lazy

安装git后

git clone https://github.com/folke/lazy.nvim.git $env:LOCALAPPDATA\nvim-data\lazy\lazy.nvim

编辑配置文件

复制代码
nvim $env:LOCALAPPDATA\nvim\init.lua

-- ================= 基础 =================
vim.g.mapleader = " "
vim.opt.number = true
vim.opt.relativenumber = true
vim.opt.cursorline = true
vim.opt.termguicolors = true
vim.opt.signcolumn = "yes"
vim.opt.updatetime = 100

-- ================= lazy =================
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
vim.opt.rtp:prepend(lazypath)

require("lazy").setup({

-- 🌙 主题
{
  "folke/tokyonight.nvim",
  priority = 1000,
  config = function()
    vim.cmd.colorscheme("tokyonight")
  end
},

-- 📂 文件树
{
  "nvim-tree/nvim-tree.lua",
  dependencies = {"nvim-tree/nvim-web-devicons"},
  config = function()
    require("nvim-tree").setup()
    vim.keymap.set("n", "<leader>e", ":NvimTreeToggle<CR>")
  end
},

-- 📊 状态栏
{
  "nvim-lualine/lualine.nvim",
  dependencies = {"nvim-tree/nvim-web-devicons"},
  config = function()
    require("lualine").setup({ options = { theme = "tokyonight" } })
  end
},

-- 📑 标签栏
{
  "akinsho/bufferline.nvim",
  dependencies = {"nvim-tree/nvim-web-devicons"},
  config = function()
    require("bufferline").setup()
  end
},


-- 🔍 Telescope
{
  "nvim-telescope/telescope.nvim",
  dependencies = {"nvim-lua/plenary.nvim"},
  config = function()
    local b = require("telescope.builtin")
    vim.keymap.set("n", "<leader>f", b.find_files)
    vim.keymap.set("n", "<leader>g", b.live_grep)
  end
},

-- 🧠 补全
{
  "hrsh7th/nvim-cmp",
  dependencies = {
    "hrsh7th/cmp-nvim-lsp",
    "hrsh7th/cmp-buffer",
    "hrsh7th/cmp-path",
    "L3MON4D3/LuaSnip",
    "saadparwaiz1/cmp_luasnip"
  },
  config = function()
    local cmp = require("cmp")
    cmp.setup({
      snippet = {
        expand = function(args)
          require("luasnip").lsp_expand(args.body)
        end,
      },
      mapping = cmp.mapping.preset.insert({
        ["<Tab>"] = cmp.mapping.select_next_item(),
        ["<CR>"] = cmp.mapping.confirm({ select = true }),
      }),
      sources = {
        { name = "nvim_lsp" },
        { name = "luasnip" },
        { name = "buffer" },
        { name = "path" },
      }
    })
  end
},


-- ✨ 格式化(替代 null-ls)
{
  "stevearc/conform.nvim",
  config = function()
    require("conform").setup({
      formatters_by_ft = {
        python = {"black"},
        javascript = {"prettier"},
        html = {"prettier"},
        css = {"prettier"},
      }
    })

    vim.keymap.set("n","<leader>fm",function()
      require("conform").format()
    end)
  end
},

-- 🐞 调试
{ "mfussenegger/nvim-dap" },


-- 🌿 Git
{
  "lewis6991/gitsigns.nvim",
  config = function()
    require("gitsigns").setup()
  end
},

-- 🖥 终端
{
  "akinsho/toggleterm.nvim",
  config = function()
    require("toggleterm").setup()
    vim.keymap.set("n","<leader>t",":ToggleTerm<CR>")
  end
},

-- ✨ 启动页
{
  "goolord/alpha-nvim",
  config = function()
    require("alpha").setup(require("alpha.themes.dashboard").config)
  end
},

})
相关推荐
ni_darling19 小时前
win11任务栏居左,win11右键菜单栏设置,win11改回win10设置项
windows
玖釉-20 小时前
旋转图像:从矩阵转置、镜像到坐标变换的系统理解
c++·windows·算法·图形渲染
家有两宝,感恩遇见20 小时前
windows安装claude code
windows
yaoxin52112320 小时前
414. Java 文件操作基础 - 批量压缩与索引:将154首十四行诗高效存储为带目录的二进制文件
java·windows·python
早睡身体真不戳20 小时前
Cacheable List 接口二次读取报错
windows
shandianchengzi21 小时前
【记录】联想|Thinkpad雷电接口连接带鱼屏显示器,画面被异常拉伸怎么解决?
windows·计算机外设·显示器·联想·thinkpad
zandy101121 小时前
2026 主流技术栈:hermes agent多环境安装配置:Windows/Mac/Linux
linux·windows·macos
夜雪闻竹1 天前
MCP Server 集成:让 AI Agent 自动调用知识库
人工智能·windows·knowledge graph
霸道流氓气质1 天前
批量收集多源 URL 并异步转 PDF 打包下载的完整实现(Spring Boot + Feign + 异步任务)
windows·spring boot·pdf
圆粥綠1 天前
【保姆级】国内Windows用户Android Studio下载+安装+配置完整教程(2026最新版,避坑指南)
android·windows·android studio