update nvchad config to v2.5

This commit is contained in:
grassblock 2024-12-14 20:17:58 +08:00
parent df374efd22
commit 7ddbecbda0
23 changed files with 384 additions and 260 deletions

View file

@ -0,0 +1,108 @@
local options = {
base46 = {
theme = "nord", -- default theme
hl_add = {},
hl_override = {},
integrations = {},
changed_themes = {},
transparency = true,
-- theme_toggle = { "onedark", "one_light" },
},
ui = {
cmp = {
icons_left = false, -- only for non-atom styles!
style = "default", -- default/flat_light/flat_dark/atom/atom_colored
format_colors = {
tailwind = false, -- will work for css lsp too
icon = "󱓻",
},
},
telescope = { style = "borderless" }, -- borderless / bordered
statusline = {
enabled = true,
theme = "vscode_colored", -- default/vscode/vscode_colored/minimal
-- default/round/block/arrow separators work only for default statusline theme
-- round and block will work for minimal theme only
separator_style = "default",
order = nil,
modules = nil,
},
-- lazyload it when there are 1+ buffers
tabufline = {
enabled = true,
lazyload = true,
order = { "treeOffset", "buffers", "tabs", "btns" },
modules = nil,
},
},
nvdash = {
load_on_startup = true,
header = {
"▗▖ ▗▖▗▄▄▄▖ ▗▄▖ ▗▖ ▗▖▗▄▄▄▖▗▖ ▗▖",
"▐▛▚▖▐▌▐▌ ▐▌ ▐▌▐▌ ▐▌ █ ▐▛▚▞▜▌",
"▐▌ ▝▜▌▐▛▀▀▘▐▌ ▐▌▐▌ ▐▌ █ ▐▌ ▐▌",
"▐▌ ▐▌▐▙▄▄▖▝▚▄▞▘ ▝▚▞▘ ▗▄█▄▖▐▌ ▐▌",
" ",
},
buttons = {
{ txt = " Find File", keys = "ff", cmd = "Telescope find_files" },
{ txt = " Recent Files", keys = "fo", cmd = "Telescope oldfiles" },
{ txt = "󰈭 Find Word", keys = "fw", cmd = "Telescope live_grep" },
{ txt = "󱥚 Themes", keys = "th", cmd = ":lua require('nvchad.themes').open()" },
{ txt = " Mappings", keys = "ch", cmd = "NvCheatsheet" },
{ txt = "", hl = "NvDashFooter", no_gap = true, rep = true },
{
txt = function()
local stats = require("lazy").stats()
local ms = math.floor(stats.startuptime) .. " ms"
return " Loaded " .. stats.loaded .. "/" .. stats.count .. " plugins in " .. ms
end,
hl = "NvDashFooter",
no_gap = true,
},
{ txt = "", hl = "NvDashFooter", no_gap = true, rep = true },
},
},
term = {
winopts = { number = false, relativenumber = false },
sizes = { sp = 0.3, vsp = 0.2, ["bo sp"] = 0.3, ["bo vsp"] = 0.2 },
float = {
relative = "editor",
row = 0.3,
col = 0.25,
width = 0.5,
height = 0.4,
border = "single",
},
},
lsp = { signature = true },
cheatsheet = {
theme = "grid", -- simple/grid
excluded_groups = { "terminal (t)", "autopairs", "Nvim", "Opens" }, -- can add group name or with mode
},
mason = { pkgs = {}, skip = {} },
colorify = {
enabled = true,
mode = "virtual", -- fg, bg, virtual
virt_text = "󱓻 ",
highlight = { hex = true, lspvars = true },
},
}
local status, chadrc = pcall(require, "chadrc")
return vim.tbl_deep_extend("force", options, status and chadrc or {})

View file

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

View file

@ -0,0 +1,47 @@
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,24 @@
-- load defaults i.e lua_lsp
require("nvchad.configs.lspconfig").defaults()
local lspconfig = require "lspconfig"
-- EXAMPLE
local servers = { "html", "cssls" }
local nvlsp = require "nvchad.configs.lspconfig"
-- lsps with default config
for _, lsp in ipairs(servers) do
lspconfig[lsp].setup {
on_attach = nvlsp.on_attach,
on_init = nvlsp.on_init,
capabilities = nvlsp.capabilities,
}
end
-- configuring single server, example: typescript
-- lspconfig.ts_ls.setup {
-- on_attach = nvlsp.on_attach,
-- on_init = nvlsp.on_init,
-- capabilities = nvlsp.capabilities,
-- }

View file

@ -1,7 +0,0 @@
# NvChad config
This can be used as an custom config for NvChad v2.0 branch, this branch is a minimal one. This includes:
- Auto Dark theme (may not working)
- NvDash start by default
- Github Copilot & wakatime plugin
- lsp config for web dev

View file

@ -1,39 +0,0 @@
---@type ChadrcConfig
local M = {}
-- Path to overriding theme and highlights files
local highlights = require "custom.highlights"
local is_darkmode = vim.system({"darkman","get"}, { text = true }, on_exit)
if is_darkmode == "dark" then
local c_theme = "nord"
else
local c_theme = "onenord_light"
end
M.ui = {
theme = c_theme,
theme_toggle = { "nord", "onenord_light" },
hl_override = highlights.override,
hl_add = highlights.add,
nvdash = {
load_on_startup = true,
-- generated with https://patorjk.com/software/taag/#
header = {
"▗▖ ▗▖▗▄▄▄▖ ▗▄▖ ▗▖ ▗▖▗▄▄▄▖▗▖ ▗▖",
"▐▛▚▖▐▌▐▌ ▐▌ ▐▌▐▌ ▐▌ █ ▐▛▚▞▜▌",
"▐▌ ▝▜▌▐▛▀▀▘▐▌ ▐▌▐▌ ▐▌ █ ▐▌ ▐▌",
"▐▌ ▐▌▐▙▄▄▖▝▚▄▞▘ ▝▚▞▘ ▗▄█▄▖▐▌ ▐▌",
" ",
}
}
}
M.plugins = "custom.plugins"
-- check core.mappings for table structure
M.mappings = require "custom.mappings"
return M

View file

@ -1,17 +0,0 @@
local on_attach = require("plugins.configs.lspconfig").on_attach
local capabilities = require("plugins.configs.lspconfig").capabilities
local lspconfig = require "lspconfig"
-- if you just want default config for the servers then put them in a table
local servers = { "html", "cssls", "tsserver", "clangd" }
for _, lsp in ipairs(servers) do
lspconfig[lsp].setup {
on_attach = on_attach,
capabilities = capabilities,
}
end
--
-- lspconfig.pyright.setup { blabla}

View file

@ -1,21 +0,0 @@
local null_ls = require "null-ls"
local b = null_ls.builtins
local sources = {
-- webdev stuff
b.formatting.deno_fmt, -- choosed deno for ts/js files cuz its very fast!
b.formatting.prettier.with { filetypes = { "html", "markdown", "css" } }, -- so prettier works only on these filetypes
-- Lua
b.formatting.stylua,
-- cpp
b.formatting.clang_format,
}
null_ls.setup {
debug = true,
sources = sources,
}

View file

@ -1,62 +0,0 @@
local M = {}
M.treesitter = {
ensure_installed = {
"vim",
"lua",
"html",
"css",
"javascript",
"typescript",
"tsx",
"c",
"markdown",
"markdown_inline",
},
indent = {
enable = true,
-- disable = {
-- "python"
-- },
},
}
M.mason = {
ensure_installed = {
-- lua stuff
"lua-language-server",
"stylua",
-- web dev stuff
"css-lsp",
"html-lsp",
"typescript-language-server",
"deno",
"prettier",
-- c/cpp stuff
"clangd",
"clang-format",
-- python
"python-lsp-server"
},
}
-- git support in nvimtree
M.nvimtree = {
git = {
enable = true,
},
renderer = {
highlight_git = true,
icons = {
show = {
git = true,
},
},
},
}
return M

View file

@ -1,19 +0,0 @@
-- To find any highlight groups: "<cmd> Telescope highlights"
-- Each highlight group can take a table with variables fg, bg, bold, italic, etc
-- base30 variable names can also be used as colors
local M = {}
---@type Base46HLGroupsList
M.override = {
Comment = {
italic = true,
},
}
---@type HLTable
M.add = {
NvimTreeOpenedFolderName = { fg = "green", bold = true },
}
return M

View file

@ -1,7 +0,0 @@
-- local autocmd = vim.api.nvim_create_autocmd
-- Auto resize panes when resizing nvim window
-- autocmd("VimResized", {
-- pattern = "*",
-- command = "tabdo wincmd =",
-- })

View file

@ -1,12 +0,0 @@
---@type MappingsTable
local M = {}
M.general = {
n = {
[";"] = { ":", "enter command mode", opts = { nowait = true } },
},
}
-- more keybinds!
return M

View file

@ -1,76 +0,0 @@
local overrides = require("custom.configs.overrides")
---@type NvPluginSpec[]
local plugins = {
-- Override plugin definition options
{
"neovim/nvim-lspconfig",
dependencies = {
-- format & linting
{
"jose-elias-alvarez/null-ls.nvim",
config = function()
require "custom.configs.null-ls"
end,
},
},
config = function()
require "plugins.configs.lspconfig"
require "custom.configs.lspconfig"
end, -- Override to setup mason-lspconfig
},
-- override plugin configs
{
"williamboman/mason.nvim",
opts = overrides.mason,
},
{
"nvim-treesitter/nvim-treesitter",
opts = overrides.treesitter,
},
{
"nvim-tree/nvim-tree.lua",
opts = overrides.nvimtree,
},
-- Install a plugin
{
"max397574/better-escape.nvim",
event = "InsertEnter",
config = function()
require("better_escape").setup()
end,
},
{
"zbirenbaum/copilot.lua",
cmd = "Copilot",
event = "InsertEnter",
config = function()
require("copilot").setup({})
end,
},
{ 'wakatime/vim-wakatime', lazy = false }
-- To make a plugin not be loaded
-- {
-- "NvChad/nvim-colorizer.lua",
-- enabled = false
-- },
-- All NvChad plugins are lazy-loaded by default
-- For a plugin to be loaded, you will need to set either `ft`, `cmd`, `keys`, `event`, or set `lazy = false`
-- If you want a plugin to load on startup, add `lazy = false` to a plugin spec, for example
-- {
-- "mg979/vim-visual-multi",
-- lazy = false,
-- }
}
return plugins

View file

@ -0,0 +1,10 @@
require "nvchad.mappings"
-- add yours here
local map = vim.keymap.set
map("n", ";", ":", { desc = "CMD enter command mode" })
map("i", "jk", "<ESC>")
-- map({ "n", "i", "v" }, "<C-s>", "<cmd> w <cr>")

View file

@ -0,0 +1,37 @@
require "nvchad.options"
-- add yours here!
-- auto dark mode theme
-- (if you use this don't use the theme toggle in the editor, it may break the function)
-- "darkman get" result to decide which color_scheme to use.
-- if it's not installed/command error, fallback to dark scheme
local ok, result = pcall(function()
return vim.system({"darkman", "get"}, { text = true }):wait().stdout
end)
local color_scheme
if ok then
color_scheme = result
else
-- Fallback value in case of error
color_scheme = "dark"
end
-- set theme!
-- hooray, nvchad new version supports to set theme manually!
if string.find(color_scheme,"dark") then
require("nvconfig").base46.theme = 'nord'
require("base46").load_all_highlights()
elseif string.find(color_scheme,"light") then
require("nvconfig").base46.theme = 'onenord_light'
require("base46").load_all_highlights()
else
require("nvconfig").base46.theme = 'doomchad'
require("base46").load_all_highlights()
end
-- local o = vim.o
-- o.cursorlineopt ='both' -- to enable cursorline!

View file

@ -0,0 +1,8 @@
return {
"zbirenbaum/copilot.lua",
cmd = "Copilot",
event = "InsertEnter",
config = function()
require("copilot").setup({})
end,
}

View file

@ -0,0 +1,25 @@
return {
{
"stevearc/conform.nvim",
-- event = 'BufWritePre', -- uncomment for format on save
opts = require "configs.conform",
},
-- These are some examples, uncomment them if you want to see them work!
{
"neovim/nvim-lspconfig",
config = function()
require "configs.lspconfig"
end,
},
-- {
-- "nvim-treesitter/nvim-treesitter",
-- opts = {
-- ensure_installed = {
-- "vim", "lua", "vimdoc",
-- "html", "css"
-- },
-- },
-- },
}

View file

@ -0,0 +1 @@
return { 'wakatime/vim-wakatime', lazy = false }