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
},

})
相关推荐
王维同学11 小时前
进程模块枚举、映像身份与线程启动地址关联
c++·windows·安全
x²+(y-√³x²)²=115 小时前
Linux打包文件到Windows,文件/文件类型丢失
linux·运维·windows
Rudon滨海渔村17 小时前
windows10如何删除多余的输入法 - 仅保留English+拼音
windows·输入法
YCOSA202518 小时前
雨晨 Windows 11 IoT 企业版 LTSC 26H1 特制 28000.2796
windows·物联网
Jay-r19 小时前
DeepSeek Harness 极简上手:装好、玩熟、让它自己长新能力
人工智能·windows·ai·github·ai编程·deepseek·harness
鼠鼠龙年发大财20 小时前
【内网权威测速工具iperf3】Windows分享
windows
夏悠21 小时前
OpenClaw + Ollama Windows完整部署过程
windows
Logintern0921 小时前
Langgraph使用MemorySaver建立有记忆的图
开发语言·windows·python
北漂燕郊杨哥1 天前
phpStudy 手工安装最新稳定版 PHP 8.5.9(NTS)方法(Windows 本地开发)
windows·php·phpstudy
Albart5751 天前
Docker Desktop最新版安装踩坑全记录(Windows_Mac_Linux)【2026 4.74.0 终版】
linux·windows·macos·docker·环境搭建·踩坑记录