feat: Add nvchad module and enable nvchad instead of nixvim

This commit is contained in:
ulic-youthlic 2025-10-18 23:10:53 +08:00
parent 66196be557
commit 65a72ab802
Signed by: youthlic
GPG key ID: 63E86C3C14A0D721
16 changed files with 460 additions and 4 deletions

37
nvchad/init.lua Normal file
View file

@ -0,0 +1,37 @@
vim.g.base46_cache = vim.fn.stdpath "data" .. "/base46/"
vim.g.mapleader = " "
-- bootstrap lazy and all plugins
local lazypath = vim.fn.stdpath "data" .. "/lazy/lazy.nvim"
if not vim.uv.fs_stat(lazypath) then
local repo = "https://github.com/folke/lazy.nvim.git"
vim.fn.system { "git", "clone", "--filter=blob:none", repo, "--branch=stable", lazypath }
end
vim.opt.rtp:prepend(lazypath)
local lazy_config = require "configs.lazy"
-- load plugins
require("lazy").setup({
{
"NvChad/NvChad",
lazy = false,
branch = "v2.5",
import = "nvchad.plugins",
},
{ import = "plugins" },
}, lazy_config)
-- load theme
dofile(vim.g.base46_cache .. "defaults")
dofile(vim.g.base46_cache .. "statusline")
require "options"
require "autocmds"
vim.schedule(function()
require "mappings"
end)

1
nvchad/lua/autocmds.lua Normal file
View file

@ -0,0 +1 @@
require "nvchad.autocmds"

31
nvchad/lua/chadrc.lua Normal file
View file

@ -0,0 +1,31 @@
-- This file needs to have same structure as nvconfig.lua
-- https://github.com/NvChad/ui/blob/v3.0/lua/nvconfig.lua
-- Please read that file to know all available options :( @type ChadrcConfig
local M = {}
M.base46 = {
theme = "solarized_light",
-- hl_override = {
-- Comment = { italic = true },
-- ["@comment"] = { italic = true },
-- },
}
M.nvdash = { load_on_startup = true }
M.ui = {
cmp = {
style = "atom_colored",
},
tabufline = {
-- lazyload = true,
enabled = false,
},
statusline = {
enabled = true,
separator_style = "arrow",
theme = "default",
},
}
return M

View file

@ -0,0 +1,18 @@
local options = {
formatters_by_ft = {
lua = { "stylua" },
-- css = { "prettier" },
-- html = { "prettier" },
nix = {
"nixfmt",
lsp_format = "fallback",
},
},
format_on_save = {
-- These options will be passed to conform.format()
timeout_ms = 500,
lsp_fallback = true,
},
}
return options

View file

@ -0,0 +1,8 @@
local options = {}
options = {
default_regexp_syntax = true,
use_default_semantic_hl_groups = true
}
return options

View file

@ -0,0 +1,45 @@
return {
defaults = { lazy = true },
install = { colorscheme = { "nvchad" } },
ui = {
icons = {
ft = "",
lazy = "󰂠 ",
loaded = "",
not_loaded = "",
},
},
performance = {
rtp = {
disabled_plugins = {
"2html_plugin",
"tohtml",
"getscript",
"getscriptPlugin",
"gzip",
"logipat",
"netrw",
"netrwPlugin",
"netrwSettings",
"netrwFileHandlers",
"matchit",
"tar",
"tarPlugin",
"rrhelper",
"spellfile_plugin",
"vimball",
"vimballPlugin",
"zip",
"zipPlugin",
"tutor",
"rplugin",
"syntax",
"synmenu",
"optwin",
"compiler",
"bugreport",
"ftplugin",
},
},
},
}

View file

@ -0,0 +1,16 @@
require("nvchad.configs.lspconfig").defaults()
local servers = {
"rust_analyzer",
"nixd",
"nil_ls",
"lua_ls",
"jsonls",
"taplo"
}
vim.lsp.enable(servers, true)
local lua_ls_libraries = vim.deepcopy(vim.lsp.config.lua_ls.settings.Lua.workspace.library)
table.insert(lua_ls_libraries,
#lua_ls_libraries, vim.fn.stdpath "data" .. "/lazy/NvChad/lua/nvchad")
vim.lsp.config.lua_ls.settings.Lua.workspace.library = lua_ls_libraries

29
nvchad/lua/mappings.lua Normal file
View file

@ -0,0 +1,29 @@
require "nvchad.mappings"
local map = vim.keymap.set
map("n", "<M-x>", ":", { desc = "CMD enter command mode" })
map("n", "<leader>ti", function()
local is_enabled = vim.lsp.inlay_hint.is_enabled()
if is_enabled then
vim.lsp.inlay_hint.enable(false)
else
vim.lsp.inlay_hint.enable(true)
end
end, { desc = "Toggle lsp inlay hint" })
map({ "n", "v" }, "j", "gj")
map({ "n", "v" }, "k", "gk")
map({ "n", "v" }, "gj", "j")
map({ "n", "v" }, "gk", "k")
map({ "n", "v" }, "<C-h>", "<cmd>Telescope help_tags<CR>", { desc = "telescope help page" })
map("i", "<C-d>", "<BS>", { desc = "backspace" })
map({ "n", "v" }, "<leader>tm", function()
local image_api = require("image")
local is_enabled = image_api.is_enabled()
if is_enabled then
image_api.disable()
else
image_api.enable()
end
end, { desc = "Toggle image.nvim" })

102
nvchad/lua/options.lua Normal file
View file

@ -0,0 +1,102 @@
require "nvchad.options"
local o = vim.o
local opt = vim.opt
o.autoindent = true
o.autoread = true
opt.backspace = {
"indent",
"eol",
"start",
}
o.backup = false
opt.breakindent = true
opt.breakindentopt = { "sbr" }
o.showbreak = ""
o.cdhome = true
o.cmdheight = 1
opt.completeopt = {
"fuzzy",
"menuone",
"noselect",
"popup",
}
opt.concealcursor = { ["v"] = true }
o.confirm = true
o.cursorline = true
opt.cursorlineopt = { "number", "screenline" }
opt.diffopt = {
"algorithm:minimal",
"closeoff",
"context:20",
"followwrap",
"internal",
"linematch:40",
}
o.errorbells = true
o.expandtab = true
o.exrc = true
o.foldcolumn = "auto"
o.fsync = true
o.gdefault = false
opt.helplang = {
"zh",
"en",
}
o.history = 10000
o.hlsearch = true
o.ignorecase = true
o.smartcase = true
o.inccommand = "split"
o.list = true
opt.listchars = {
tab = "--→",
trail = "·",
multispace = " ",
nbsp = "",
space = "·",
}
o.magic = true
o.more = true
o.mouse = "a"
o.number = true
o.numberwidth = 4
o.relativenumber = true
o.scrollback = 100000
o.scrolloff = 5
o.shiftround = true
o.shiftwidth = 2
o.showmode = false
o.signcolumn = "yes"
o.smoothscroll = true
o.splitbelow = true
o.splitright = true
o.startofline = true
o.swapfile = false
opt.tabclose = {
"uselast",
}
o.tabstop = 2
o.termguicolors = true
o.undofile = true
o.undolevels = 100000
opt.virtualedit = {
"block",
"onemore",
}
opt.whichwrap = { b = true, s = true, ["<"] = true, [">"] = true }
o.wildmenu = true
opt.wildmode = { "full" }
opt.wildoptions = {
"fuzzy",
"pum",
}
o.winborder = "solid"
o.wrap = true

View file

@ -0,0 +1,56 @@
return {
{
"stevearc/conform.nvim",
event = "BufWritePre", -- uncomment for format on save
opts = require "configs.conform",
},
{
"neovim/nvim-lspconfig",
config = function()
require "configs.lspconfig"
end,
},
{ import = "nvchad.blink.lazyspec" },
{
"nvim-treesitter/nvim-treesitter",
opts = {
ensure_installed = {
"markdown",
"typst",
"lua",
"toml",
"yaml",
"json",
"rust"
},
},
},
{
"idris-community/idris2-nvim",
dependencies = {
"neovim/nvim-lspconfig",
"MunifTanjim/nui.nvim"
},
main = "idris2",
opts = require("configs.idris2"),
ft = { "idris2", "ipkg", "lidris2" }
},
{
"3rd/image.nvim",
opts = {
processor = "magick_cli",
integrations = {
markdown = {
only_render_image_at_cursor = true,
only_render_image_at_cursor_mode = "popup",
},
}
},
ft = { "markdown", "typst" }
},
{
"mrcjkb/rustaceanvim",
version = "^6",
lazy = false,
},
}