Skip to content

Instantly share code, notes, and snippets.

@aofei
Last active July 21, 2025 05:57
Show Gist options
  • Save aofei/27d1425c22c4f570058acd7197a71151 to your computer and use it in GitHub Desktop.
Save aofei/27d1425c22c4f570058acd7197a71151 to your computer and use it in GitHub Desktop.
Aofei Sheng flavored nvim/init.lua file.
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.uv.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable",
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
local afterloads = {}
local original_require = require
require = function(modname)
local result = original_require(modname)
local afterload = afterloads[modname]
if afterload then
afterload()
end
return result
end
afterloads["lazyvim.config.options"] = function()
vim.g.mapleader = nil
vim.g.maplocalleader = nil
vim.g.lazyvim_prettier_needs_config = true -- Require a config file for Prettier
vim.g.minipairs_disable = true -- Disable minipairs
vim.g.snacks_animate = false -- Disable all animations
vim.opt.colorcolumn = "81" -- Highlight column 81
vim.opt.conceallevel = 0 -- Disable conceal
vim.opt.expandtab = false -- Use tabs
vim.opt.relativenumber = false -- Disable relative line numbers
vim.opt.shiftwidth = 8 -- Size of an indent
vim.opt.tabstop = 8 -- Number of spaces tabs count for
end
afterloads["lazyvim.config.autocmds"] = function()
-- Special settings for some verbose filetypes
vim.api.nvim_create_autocmd({ "FileType" }, {
pattern = {
"css",
"graphql",
"hcl",
"html",
"javascript",
"javascriptreact",
"json",
"jsonc",
"less",
"lua",
"markdown",
"markdown.mdx",
"proto",
"sass",
"sql",
"tmux",
"toml",
"typescript",
"typescriptreact",
"vim",
"vue",
"xml",
"yaml",
},
callback = function()
vim.opt_local.colorcolumn = "121"
vim.opt_local.shiftwidth = 2
vim.opt_local.tabstop = 2
end,
})
-- Use spaces instead of tabs for some filetypes
vim.api.nvim_create_autocmd({ "FileType" }, {
pattern = {
"markdown",
"markdown.mdx",
},
callback = function()
vim.opt_local.expandtab = true
end,
})
end
afterloads["lazyvim.config.keymaps"] = function()
-- Toggle mouse
local mouse = vim.o.mouse ~= "" and vim.o.mouse or "a"
Snacks.toggle
.new({
name = "Mouse",
get = function()
return vim.o.mouse ~= ""
end,
set = function(state)
vim.o.mouse = state and mouse or ""
end,
})
:map("<leader>um")
end
require("lazy").setup({
spec = {
-- LazyVim
{
{
"LazyVim/LazyVim",
import = "lazyvim.plugins",
opts = { colorscheme = "catppuccin" },
},
{ import = "lazyvim.plugins.extras.ai.copilot" },
{ import = "lazyvim.plugins.extras.coding.mini-surround" },
{ import = "lazyvim.plugins.extras.coding.yanky" },
{ import = "lazyvim.plugins.extras.dap.core" },
{ import = "lazyvim.plugins.extras.dap.nlua" },
{ import = "lazyvim.plugins.extras.editor.overseer" },
{ import = "lazyvim.plugins.extras.editor.refactoring" },
{ import = "lazyvim.plugins.extras.formatting.prettier" },
{ import = "lazyvim.plugins.extras.lang.clangd" },
{ import = "lazyvim.plugins.extras.lang.git" },
{ import = "lazyvim.plugins.extras.lang.go" },
{ import = "lazyvim.plugins.extras.lang.typescript" },
{ import = "lazyvim.plugins.extras.lang.vue" },
{ import = "lazyvim.plugins.extras.linting.eslint" },
{ import = "lazyvim.plugins.extras.test.core" },
{ import = "lazyvim.plugins.extras.util.mini-hipatterns" },
-- Polish it up a bit
{
{
"folke/snacks.nvim",
opts = {
indent = {
indent = { hl = "IblIndent" },
scope = { enabled = false },
},
picker = { hidden = true },
scroll = { enabled = false },
terminal = {
win = {
position = "float",
keys = {},
},
},
},
},
{
"nvim-treesitter/nvim-treesitter",
opts = { ensure_installed = { "scss" } },
},
{
"stevearc/conform.nvim",
opts = function(_, opts)
for _, ft in ipairs({
"fish",
"go",
"sh",
}) do
opts.formatters_by_ft[ft] = nil
end
end,
},
{
"neovim/nvim-lspconfig",
opts = {
inlay_hints = { enabled = false },
servers = {
gopls = {
settings = {
gopls = {
analyses = {
unusedparams = false,
ST1000 = false,
ST1003 = false,
ST1012 = false,
},
},
},
},
},
},
},
},
},
-- Match-up
{
"andymass/vim-matchup",
event = "BufReadPost",
config = function()
vim.g.matchup_matchparen_offscreen = { method = "status_manual" }
end,
},
-- Markdown Preview
{
"iamcco/markdown-preview.nvim",
cmd = {
"MarkdownPreviewToggle",
"MarkdownPreview",
"MarkdownPreviewStop",
},
build = function()
require("lazy").load({ plugins = { "markdown-preview.nvim" } })
vim.fn["mkdp#util#install"]()
end,
keys = {
{
"<leader>cp",
ft = "markdown",
"<cmd>MarkdownPreviewToggle<cr>",
desc = "Markdown Preview",
},
},
config = function()
vim.cmd([[do FileType]])
end,
},
},
performance = {
rtp = {
-- Disable some RTP plugins
disabled_plugins = {
"gzip",
"matchit",
"matchparen",
"netrwPlugin",
"tarPlugin",
"tohtml",
"tutor",
"zipPlugin",
},
},
},
})
{
"LazyVim": { "branch": "main", "commit": "25abbf546d564dc484cf903804661ba12de45507" },
"blink-cmp-copilot": { "branch": "main", "commit": "439cff78780c033aa23cf061d7315314b347e3c1" },
"blink.cmp": { "branch": "main", "commit": "586ee87534f5bf65f1c8dea2d1da2a57e8cddd36" },
"bufferline.nvim": { "branch": "main", "commit": "655133c3b4c3e5e05ec549b9f8cc2894ac6f51b3" },
"catppuccin": { "branch": "main", "commit": "fa42eb5e26819ef58884257d5ae95dd0552b9a66" },
"clangd_extensions.nvim": { "branch": "main", "commit": "db28f29be928d18cbfb86fbfb9f83f584f658feb" },
"conform.nvim": { "branch": "master", "commit": "973f3cb73887d510321653044791d7937c7ec0fa" },
"copilot.lua": { "branch": "master", "commit": "14bf786180b2ca4578915c56989b6d676dddc6f3" },
"flash.nvim": { "branch": "main", "commit": "3c942666f115e2811e959eabbdd361a025db8b63" },
"friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" },
"gitsigns.nvim": { "branch": "main", "commit": "0cb5a7753d3c4b8e9cfdc9d88d9110cb8d4b1544" },
"grug-far.nvim": { "branch": "main", "commit": "45981a9af7f4e666a3cdaedb1d21d2ab926727a2" },
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
"lazydev.nvim": { "branch": "main", "commit": "2367a6c0a01eb9edb0464731cc0fb61ed9ab9d2c" },
"lualine.nvim": { "branch": "master", "commit": "a94fc68960665e54408fe37dcf573193c4ce82c9" },
"markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "1a31f824b9cd5bc6f342fc29e9a53b60d74af245" },
"mason-nvim-dap.nvim": { "branch": "main", "commit": "5fcd0dfdcf55d8a1c1a02cccc14ee5d79728a496" },
"mason.nvim": { "branch": "main", "commit": "fc98833b6da5de5a9c5b1446ac541577059555be" },
"mini.ai": { "branch": "main", "commit": "e66a71449bdf719b4b9c96e0cd7b7d6cc4112f88" },
"mini.hipatterns": { "branch": "main", "commit": "d71c21167d6bd5f21c9ecf90912c510f9edfc02b" },
"mini.icons": { "branch": "main", "commit": "94848dad1589a199f876539bd79befb0c5e3abf0" },
"mini.pairs": { "branch": "main", "commit": "42407ccb80ec59c84e7c91d815f42ed90a8cc093" },
"mini.surround": { "branch": "main", "commit": "f59022c2c66c1cffd3cd755b105faa468b25a4e0" },
"neotest": { "branch": "master", "commit": "3c81345c28cd639fcc02843ed3653be462f47024" },
"neotest-golang": { "branch": "main", "commit": "9521843942423fcac9991c596ff19c1f4f500650" },
"noice.nvim": { "branch": "main", "commit": "0427460c2d7f673ad60eb02b35f5e9926cf67c59" },
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
"nvim-dap": { "branch": "master", "commit": "5dd4d50f2e6a2eaf9e57fad023d294ef371bda35" },
"nvim-dap-go": { "branch": "main", "commit": "b4421153ead5d726603b02743ea40cf26a51ed5f" },
"nvim-dap-ui": { "branch": "master", "commit": "cf91d5e2d07c72903d052f5207511bf7ecdb7122" },
"nvim-dap-virtual-text": { "branch": "master", "commit": "fbdb48c2ed45f4a8293d0d483f7730d24467ccb6" },
"nvim-lint": { "branch": "master", "commit": "a293900003b8e3a402839a243033db0c88aeb3a9" },
"nvim-lspconfig": { "branch": "master", "commit": "f47cd681d7cb6048876a2e908b6d8ba1e530d152" },
"nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" },
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "89ebe73cd2836db80a22d9748999ace0241917a5" },
"nvim-ts-autotag": { "branch": "main", "commit": "a1d526af391f6aebb25a8795cbc05351ed3620b5" },
"one-small-step-for-vimkind": { "branch": "main", "commit": "91b4e0fb0d640def73812aceb22dafb99261dd67" },
"overseer.nvim": { "branch": "master", "commit": "fe7b2f9ba263e150ab36474dfc810217b8cf7400" },
"persistence.nvim": { "branch": "main", "commit": "166a79a55bfa7a4db3e26fc031b4d92af71d0b51" },
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
"refactoring.nvim": { "branch": "master", "commit": "74b608dfee827c2372250519d433cc21cb083407" },
"snacks.nvim": { "branch": "main", "commit": "bc0630e43be5699bb94dadc302c0d21615421d93" },
"todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" },
"tokyonight.nvim": { "branch": "main", "commit": "057ef5d260c1931f1dffd0f052c685dcd14100a3" },
"trouble.nvim": { "branch": "main", "commit": "85bedb7eb7fa331a2ccbecb9202d8abba64d37b3" },
"ts-comments.nvim": { "branch": "main", "commit": "1bd9d0ba1d8b336c3db50692ffd0955fe1bb9f0c" },
"vim-matchup": { "branch": "master", "commit": "81313f17443df6974cafa094de52df32b860e1b7" },
"which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" },
"yanky.nvim": { "branch": "main", "commit": "04775cc6e10ef038c397c407bc17f00a2f52b378" }
}

Comments are disabled for this gist.