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

})
相关推荐
海天鹰5 小时前
WIN10修改窗口标题栏失去焦点背景色
windows
梦帮科技6 小时前
GRAVIS v5.5:向硬核桌面端进化与云端多节点容灾部署实践
windows·架构·rust·自动化·区块链·智能合约·数字货币
tianyazhichiC8 小时前
【VLC player 下载地址】
windows
小呀小叮当~8 小时前
OpenAI Codex 桌面版(Windows / macOS)体验分享:AI 编程效率再次提升
人工智能·windows·macos
Starry-sky(jing)10 小时前
Win11 装 ESP32 Arduino 库卡 3 小时?我把官方 3.3.10 全平台 522MB 搬到了蓝奏云,解压即用
运维·windows·esp32·arduino·离线安装
程序员老油条1 天前
WSL2 + Docker Desktop:Windows 下的完美 Java 开发环境
java·windows·docker·wsl2
binbin_521 天前
Flutter 开发鸿蒙实战:Windows 环境下从 HAP 构建到四 Tab 页面运行
windows·flutter·harmonyos
ylscode1 天前
微软推送KB5095189:Windows 11 OOBE开箱即用体验迎来新一轮优化
windows·microsoft
Fer_David1 天前
解决Windows无法在微软商店安装CodeX问题
windows
忧虑的小蚂蚁1 天前
dll文件32位64位检测工具以及Windows文件夹SysWow64的坑
windows