Merge remote-tracking branch 'nvchad/v2.0' into p53
This commit is contained in:
commit
3fe9fda7cd
9
.github/README.md
vendored
9
.github/README.md
vendored
@ -15,7 +15,7 @@
|
||||
|
||||
<div align="center">
|
||||
|
||||
[](https://github.com/neovim/neovim)
|
||||
[](https://github.com/neovim/neovim)
|
||||
[](https://github.com/NvChad/NvChad/issues)
|
||||
[](https://discord.gg/gADmkJb9Fb)
|
||||
[](https://matrix.to/#/#nvchad:matrix.org)
|
||||
@ -37,7 +37,7 @@
|
||||
|
||||
- Lazy loading is done 93% of the time meaning that plugins will not be loaded by default, they will be loaded only when required also at specific commands, events etc. This lowers the startuptime and it was like 0.07~ secs tested on an old pentium machine 1.4ghz + 4gb ram & HDD.
|
||||
|
||||
- NvChad isnt a framework! Its supposed to be used as a "base" config, so users could tweak the defaults well, can also remove the things they dont like in the default config and build their config on top of it. Users can tweak the entire default config while staying in their custom config (lua/custom dir). This is the control center of the user's config and gitignored so the users can stay update to-date with NvChad's latest config (main branch) while still controlling it with their chadrc (file that controls entire custom dir)
|
||||
- NvChad isn't a framework! It's supposed to be used as a "base" config, so users can tweak the defaults well, and also remove the things they don't like in the default config and build their config on top of it. Users can tweak the entire default config while staying in their custom config (lua/custom dir). This is the control center of the user's config and gitignored so the users can stay up-to-date with NvChad's latest config (main branch) while still controlling it with their chadrc (file that controls entire custom dir).
|
||||
|
||||
## Theme Showcase
|
||||
|
||||
@ -88,8 +88,7 @@ A fuzzy file finder, picker, sorter, previewer and much more:
|
||||
|
||||
- Many beautiful themes, theme toggler by our [base46 plugin](https://github.com/NvChad/base46)
|
||||
- Inbuilt terminal toggling & management with [Nvterm](https://github.com/NvChad/nvterm)
|
||||
- NvChad updater, hide & unhide terminal buffers with [NvChad extensions](https://github.com/NvChad/extensions)
|
||||
- Lightweight & performant ui plugin with [NvChad UI](https://github.com/NvChad/ui) It provides statusline modules, tabufline ( tabs + buffer manager) , beautiful cheatsheets and much more!
|
||||
- Lightweight & performant ui plugin with [NvChad UI](https://github.com/NvChad/ui) It provides statusline modules, tabufline ( tabs + buffer manager) , beautiful cheatsheets, NvChad updater, hide & unhide terminal buffers, theme switcher and much more!
|
||||
- File navigation with [nvim-tree.lua](https://github.com/kyazdani42/nvim-tree.lua)
|
||||
- Beautiful and configurable icons with [nvim-web-devicons](https://github.com/kyazdani42/nvim-web-devicons)
|
||||
- Git diffs and more with [gitsigns.nvim](https://github.com/lewis6991/gitsigns.nvim)
|
||||
@ -113,7 +112,7 @@ A fuzzy file finder, picker, sorter, previewer and much more:
|
||||
If you like NvChad and would like to support & appreciate it via donation then I'll gladly accept it.
|
||||
|
||||
[](https://ko-fi.com/siduck)
|
||||
[](https://paypal.me/siduck76)
|
||||
[](https://paypal.me/siduck13)
|
||||
[](https://www.buymeacoffee.com/siduck)
|
||||
[](https://www.patreon.com/siduck)
|
||||
|
||||
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,5 +1,8 @@
|
||||
spell
|
||||
ftplugin
|
||||
syntax
|
||||
coc-settings.json
|
||||
.luarc.json
|
||||
lazy-lock.json
|
||||
after
|
||||
**/.DS_Store
|
||||
|
||||
@ -1,18 +1,24 @@
|
||||
local M = {}
|
||||
local fn = vim.fn
|
||||
|
||||
M.echo = function(str)
|
||||
vim.cmd "redraw"
|
||||
vim.api.nvim_echo({ { str, "Bold" } }, true, {})
|
||||
end
|
||||
|
||||
local function shell_call(args)
|
||||
local output = fn.system(args)
|
||||
assert(vim.v.shell_error == 0, "External call failed with error code: " .. vim.v.shell_error .. "\n" .. output)
|
||||
end
|
||||
|
||||
M.lazy = function(install_path)
|
||||
------------- base46 ---------------
|
||||
local lazy_path = vim.fn.stdpath "data" .. "/lazy/base46"
|
||||
local lazy_path = fn.stdpath "data" .. "/lazy/base46"
|
||||
|
||||
M.echo " Compiling base46 theme to bytecode ..."
|
||||
|
||||
local base46_repo = "https://github.com/NvChad/base46"
|
||||
vim.fn.system { "git", "clone", "--depth", "1", "-b", "v2.0", base46_repo, lazy_path }
|
||||
shell_call { "git", "clone", "--depth", "1", "-b", "v2.0", base46_repo, lazy_path }
|
||||
vim.opt.rtp:prepend(lazy_path)
|
||||
|
||||
require("base46").compile()
|
||||
@ -20,35 +26,37 @@ M.lazy = function(install_path)
|
||||
--------- lazy.nvim ---------------
|
||||
M.echo " Installing lazy.nvim & plugins ..."
|
||||
local repo = "https://github.com/folke/lazy.nvim.git"
|
||||
vim.fn.system { "git", "clone", "--filter=blob:none", "--branch=stable", repo, install_path }
|
||||
shell_call { "git", "clone", "--filter=blob:none", "--branch=stable", repo, install_path }
|
||||
vim.opt.rtp:prepend(install_path)
|
||||
|
||||
-- install plugins
|
||||
require "plugins"
|
||||
|
||||
-- mason packages & show post_boostrap screen
|
||||
require "nvchad.post_bootstrap"()
|
||||
-- mason packages & show post_bootstrap screen
|
||||
require "nvchad.post_install"()
|
||||
end
|
||||
|
||||
M.gen_chadrc_template = function()
|
||||
if not vim.api.nvim_get_runtime_file("lua/custom/chadrc.lua", false)[1] then
|
||||
local path = vim.fn.stdpath "config" .. "/lua/custom/"
|
||||
local input = vim.fn.input "Do you want to install example custom config? (y/N) : "
|
||||
local path = fn.stdpath "config" .. "/lua/custom"
|
||||
|
||||
-- clone example_config repo
|
||||
if input == "y" then
|
||||
M.echo "cloning example custom config repo ..."
|
||||
vim.fn.system { "git", "clone", "--depth", "1", "https://github.com/NvChad/example_config", path }
|
||||
vim.fn.delete(path .. ".git", "rf")
|
||||
if fn.isdirectory(path) ~= 1 then
|
||||
local input = fn.input "Do you want to install example custom config? (y/N): "
|
||||
|
||||
if input:lower() == "y" then
|
||||
M.echo "Cloning example custom config repo..."
|
||||
shell_call { "git", "clone", "--depth", "1", "https://github.com/NvChad/example_config", path }
|
||||
fn.delete(path .. "/.git", "rf")
|
||||
else
|
||||
-- use very minimal chadrc
|
||||
vim.fn.mkdir(path, "p")
|
||||
fn.mkdir(path, "p")
|
||||
|
||||
local file = io.open(path .. "chadrc.lua", "w")
|
||||
file:write "---@type ChadrcConfig \n local M = {}\n M.ui = {theme = 'onedark'}\n return M"
|
||||
local file = io.open(path .. "/chadrc.lua", "w")
|
||||
if file then
|
||||
file:write "---@type ChadrcConfig\nlocal M = {}\n\nM.ui = { theme = 'onedark' }\n\nreturn M"
|
||||
file:close()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
|
||||
@ -90,6 +90,6 @@ M.plugins = "" -- path i.e "custom.plugins", so make custom/plugins.lua file
|
||||
|
||||
M.lazy_nvim = require "plugins.configs.lazy_nvim" -- config for lazy.nvim startup options
|
||||
|
||||
M.mappings = {}
|
||||
M.mappings = require "core.mappings"
|
||||
|
||||
return M
|
||||
|
||||
@ -60,7 +60,7 @@ end
|
||||
|
||||
-- add binaries installed by mason.nvim to path
|
||||
local is_windows = vim.loop.os_uname().sysname == "Windows_NT"
|
||||
vim.env.PATH = vim.env.PATH .. (is_windows and ";" or ":") .. vim.fn.stdpath "data" .. "/mason/bin"
|
||||
vim.env.PATH = vim.fn.stdpath "data" .. "/mason/bin" .. (is_windows and ";" or ":") .. vim.env.PATH
|
||||
|
||||
-------------------------------------- autocmds ------------------------------------------
|
||||
local autocmd = vim.api.nvim_create_autocmd
|
||||
@ -74,11 +74,10 @@ autocmd("FileType", {
|
||||
})
|
||||
|
||||
-- reload some chadrc options on-save
|
||||
vim.api.nvim_create_autocmd("BufWritePost", {
|
||||
pattern = vim.tbl_map(
|
||||
vim.fs.normalize,
|
||||
vim.fn.glob(vim.fn.stdpath "config" .. "/lua/custom/**/*.lua", true, true, true)
|
||||
),
|
||||
autocmd("BufWritePost", {
|
||||
pattern = vim.tbl_map(function(path)
|
||||
return vim.fs.normalize(vim.loop.fs_realpath(path))
|
||||
end, vim.fn.glob(vim.fn.stdpath "config" .. "/lua/custom/**/*.lua", true, true, true)),
|
||||
group = vim.api.nvim_create_augroup("ReloadNvChad", {}),
|
||||
|
||||
callback = function(opts)
|
||||
@ -97,8 +96,14 @@ vim.api.nvim_create_autocmd("BufWritePost", {
|
||||
vim.g.transparency = true
|
||||
|
||||
-- statusline
|
||||
require("plenary.reload").reload_module("nvchad_ui.statusline." .. config.ui.statusline.theme)
|
||||
vim.opt.statusline = "%!v:lua.require('nvchad_ui.statusline." .. config.ui.statusline.theme .. "').run()"
|
||||
require("plenary.reload").reload_module("nvchad.statusline." .. config.ui.statusline.theme)
|
||||
vim.opt.statusline = "%!v:lua.require('nvchad.statusline." .. config.ui.statusline.theme .. "').run()"
|
||||
|
||||
-- tabufline
|
||||
if config.ui.tabufline.enabled then
|
||||
require("plenary.reload").reload_module "nvchad.tabufline.modules"
|
||||
vim.opt.tabline = "%!v:lua.require('nvchad.tabufline.modules').run()"
|
||||
end
|
||||
|
||||
require("base46").load_all_highlights()
|
||||
-- vim.cmd("redraw!")
|
||||
@ -109,5 +114,5 @@ vim.api.nvim_create_autocmd("BufWritePost", {
|
||||
local new_cmd = vim.api.nvim_create_user_command
|
||||
|
||||
new_cmd("NvChadUpdate", function()
|
||||
require "nvchad.update"()
|
||||
require "nvchad.updater"()
|
||||
end, {})
|
||||
|
||||
@ -70,6 +70,8 @@ M.general = {
|
||||
v = {
|
||||
-- ["<Up>"] = { 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', "Move up", opts = { expr = true } },
|
||||
-- ["<Down>"] = { 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', "Move down", opts = { expr = true } },
|
||||
-- ["<"] = { "<gv", "Indent line" },
|
||||
-- [">"] = { ">gv", "Indent line" },
|
||||
},
|
||||
|
||||
x = {
|
||||
@ -133,14 +135,14 @@ M.tabufline = {
|
||||
-- cycle through buffers
|
||||
["<tab>"] = {
|
||||
function()
|
||||
require("nvchad_ui.tabufline").tabuflineNext()
|
||||
require("nvchad.tabufline").tabuflineNext()
|
||||
end,
|
||||
"Goto next buffer",
|
||||
},
|
||||
|
||||
["<S-tab>"] = {
|
||||
function()
|
||||
require("nvchad_ui.tabufline").tabuflinePrev()
|
||||
require("nvchad.tabufline").tabuflinePrev()
|
||||
end,
|
||||
"Goto prev buffer",
|
||||
},
|
||||
@ -148,7 +150,7 @@ M.tabufline = {
|
||||
-- close buffer + hide terminal buffer
|
||||
["<leader>x"] = {
|
||||
function()
|
||||
require("nvchad_ui.tabufline").close_buffer()
|
||||
require("nvchad.tabufline").close_buffer()
|
||||
end,
|
||||
"Close buffer",
|
||||
},
|
||||
@ -226,7 +228,7 @@ M.lspconfig = {
|
||||
|
||||
["<leader>ra"] = {
|
||||
function()
|
||||
require("nvchad_ui.renamer").open()
|
||||
require("nvchad.renamer").open()
|
||||
end,
|
||||
"LSP rename",
|
||||
},
|
||||
@ -245,7 +247,7 @@ M.lspconfig = {
|
||||
"LSP references",
|
||||
},
|
||||
|
||||
["<leader>f"] = {
|
||||
["<leader>lf"] = {
|
||||
function()
|
||||
vim.diagnostic.open_float { border = "rounded" }
|
||||
end,
|
||||
@ -254,14 +256,14 @@ M.lspconfig = {
|
||||
|
||||
["[d"] = {
|
||||
function()
|
||||
vim.diagnostic.goto_prev({ float = { border = "rounded" }})
|
||||
vim.diagnostic.goto_prev { float = { border = "rounded" } }
|
||||
end,
|
||||
"Goto prev",
|
||||
},
|
||||
|
||||
["]d"] = {
|
||||
function()
|
||||
vim.diagnostic.goto_next({ float = { border = "rounded" }})
|
||||
vim.diagnostic.goto_next { float = { border = "rounded" } }
|
||||
end,
|
||||
"Goto next",
|
||||
},
|
||||
@ -273,13 +275,6 @@ M.lspconfig = {
|
||||
-- "Diagnostic setloclist",
|
||||
-- },
|
||||
|
||||
["<leader>fm"] = {
|
||||
function()
|
||||
vim.lsp.buf.format { async = true }
|
||||
end,
|
||||
"LSP formatting",
|
||||
},
|
||||
|
||||
["<leader>wa"] = {
|
||||
function()
|
||||
vim.lsp.buf.add_workspace_folder()
|
||||
@ -301,6 +296,15 @@ M.lspconfig = {
|
||||
"List workspace folders",
|
||||
},
|
||||
},
|
||||
|
||||
v = {
|
||||
["<leader>ca"] = {
|
||||
function()
|
||||
vim.lsp.buf.code_action()
|
||||
end,
|
||||
"LSP code action",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
M.nvimtree = {
|
||||
|
||||
@ -8,11 +8,11 @@ M.load_config = function()
|
||||
if chadrc_path then
|
||||
local chadrc = dofile(chadrc_path)
|
||||
|
||||
config.mappings = M.remove_disabled_keys(chadrc.mappings, require "core.mappings")
|
||||
config.mappings = M.remove_disabled_keys(chadrc.mappings, config.mappings)
|
||||
config = merge_tb("force", config, chadrc)
|
||||
config.mappings.disabled = nil
|
||||
end
|
||||
|
||||
config.mappings.disabled = nil
|
||||
return config
|
||||
end
|
||||
|
||||
|
||||
@ -15,7 +15,7 @@ local formatting_style = {
|
||||
fields = field_arrangement[cmp_style] or { "abbr", "kind", "menu" },
|
||||
|
||||
format = function(_, item)
|
||||
local icons = require("nvchad_ui.icons").lspkind
|
||||
local icons = require "nvchad.icons.lspkind"
|
||||
local icon = (cmp_ui.icons and icons[item.kind]) or ""
|
||||
|
||||
if cmp_style == "atom" or cmp_style == "atom_colored" then
|
||||
@ -52,7 +52,7 @@ local options = {
|
||||
window = {
|
||||
completion = {
|
||||
side_padding = (cmp_style ~= "atom" and cmp_style ~= "atom_colored") and 1 or 0,
|
||||
winhighlight = "Normal:CmpPmenu,CursorLine:CmpSel,Search:PmenuSel",
|
||||
winhighlight = "Normal:CmpPmenu,CursorLine:CmpSel,Search:None",
|
||||
scrollbar = false,
|
||||
},
|
||||
documentation = {
|
||||
@ -76,8 +76,8 @@ local options = {
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
["<C-e>"] = cmp.mapping.close(),
|
||||
["<CR>"] = cmp.mapping.confirm {
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = false,
|
||||
behavior = cmp.ConfirmBehavior.Insert,
|
||||
select = true,
|
||||
},
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
dofile(vim.g.base46_cache .. "lsp")
|
||||
require "nvchad_ui.lsp"
|
||||
require "nvchad.lsp"
|
||||
|
||||
local M = {}
|
||||
local utils = require "core.utils"
|
||||
@ -13,10 +13,10 @@ M.on_attach = function(client, bufnr)
|
||||
utils.load_mappings("lspconfig", { buffer = bufnr })
|
||||
|
||||
if client.server_capabilities.signatureHelpProvider then
|
||||
require("nvchad_ui.signature").setup(client)
|
||||
require("nvchad.signature").setup(client)
|
||||
end
|
||||
|
||||
if not utils.load_config().ui.lsp_semantic_tokens then
|
||||
if not utils.load_config().ui.lsp_semantic_tokens and client.supports_method "textDocument/semanticTokens" then
|
||||
client.server_capabilities.semanticTokensProvider = nil
|
||||
end
|
||||
end
|
||||
@ -54,7 +54,7 @@ require("lspconfig").lua_ls.setup {
|
||||
library = {
|
||||
[vim.fn.expand "$VIMRUNTIME/lua"] = true,
|
||||
[vim.fn.expand "$VIMRUNTIME/lua/vim/lsp"] = true,
|
||||
[vim.fn.stdpath "data" .. "/lazy/extensions/nvchad_types"] = true,
|
||||
[vim.fn.stdpath "data" .. "/lazy/ui/nvchad_types"] = true,
|
||||
[vim.fn.stdpath "data" .. "/lazy/lazy.nvim/lua/lazy"] = true,
|
||||
},
|
||||
maxPreload = 100000,
|
||||
|
||||
@ -51,12 +51,12 @@ end
|
||||
|
||||
M.gitsigns = {
|
||||
signs = {
|
||||
add = { hl = "DiffAdd", text = "│", numhl = "GitSignsAddNr" },
|
||||
change = { hl = "DiffChange", text = "│", numhl = "GitSignsChangeNr" },
|
||||
delete = { hl = "DiffDelete", text = "", numhl = "GitSignsDeleteNr" },
|
||||
topdelete = { hl = "DiffDelete", text = "‾", numhl = "GitSignsDeleteNr" },
|
||||
changedelete = { hl = "DiffChangeDelete", text = "~", numhl = "GitSignsChangeNr" },
|
||||
untracked = { hl = "GitSignsAdd", text = "│", numhl = "GitSignsAddNr", linehl = "GitSignsAddLn" },
|
||||
add = { text = "│" },
|
||||
change = { text = "│" },
|
||||
delete = { text = "" },
|
||||
topdelete = { text = "‾" },
|
||||
changedelete = { text = "~" },
|
||||
untracked = { text = "│" },
|
||||
},
|
||||
on_attach = function(bufnr)
|
||||
utils.load_mappings("gitsigns", { buffer = bufnr })
|
||||
|
||||
@ -30,9 +30,6 @@ local default_plugins = {
|
||||
|
||||
{"nvim-telescope/telescope-fzf-native.nvim", build="make"},
|
||||
|
||||
-- nvchad plugins
|
||||
{ "NvChad/extensions", branch = "v2.0" },
|
||||
|
||||
{
|
||||
"NvChad/base46",
|
||||
branch = "v2.0",
|
||||
@ -45,9 +42,6 @@ local default_plugins = {
|
||||
"NvChad/ui",
|
||||
branch = "v2.0",
|
||||
lazy = false,
|
||||
config = function()
|
||||
require "nvchad_ui"
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
@ -79,7 +73,7 @@ local default_plugins = {
|
||||
{
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
opts = function()
|
||||
return { override = require("nvchad_ui.icons").devicons }
|
||||
return { override = require "nvchad.icons.devicons" }
|
||||
end,
|
||||
config = function(_, opts)
|
||||
dofile(vim.g.base46_cache .. "devicons")
|
||||
@ -150,7 +144,7 @@ local default_plugins = {
|
||||
-- lsp stuff
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
cmd = { "Mason", "MasonInstall", "MasonInstallAll", "MasonUninstall", "MasonUninstallAll", "MasonLog" },
|
||||
cmd = { "Mason", "MasonInstall", "MasonInstallAll", "MasonUpdate" },
|
||||
opts = function()
|
||||
return require "plugins.configs.mason"
|
||||
end,
|
||||
@ -227,12 +221,19 @@ local default_plugins = {
|
||||
|
||||
{
|
||||
"numToStr/Comment.nvim",
|
||||
keys = { "gcc", "gbc" },
|
||||
keys = {
|
||||
{ "gcc", mode = "n", desc = "Comment toggle current line" },
|
||||
{ "gc", mode = { "n", "o" }, desc = "Comment toggle linewise" },
|
||||
{ "gc", mode = "x", desc = "Comment toggle linewise (visual)" },
|
||||
{ "gbc", mode = "n", desc = "Comment toggle current block" },
|
||||
{ "gb", mode = { "n", "o" }, desc = "Comment toggle blockwise" },
|
||||
{ "gb", mode = "x", desc = "Comment toggle blockwise (visual)" },
|
||||
},
|
||||
init = function()
|
||||
require("core.utils").load_mappings "comment"
|
||||
end,
|
||||
config = function()
|
||||
require("Comment").setup()
|
||||
config = function(_, opts)
|
||||
require("Comment").setup(opts)
|
||||
end,
|
||||
},
|
||||
|
||||
@ -249,12 +250,12 @@ local default_plugins = {
|
||||
config = function(_, opts)
|
||||
dofile(vim.g.base46_cache .. "nvimtree")
|
||||
require("nvim-tree").setup(opts)
|
||||
vim.g.nvimtree_side = opts.view.side
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
dependencies = { "nvim-treesitter/nvim-treesitter", { "nvim-telescope/telescope-fzf-native.nvim", build = "make" } },
|
||||
cmd = "Telescope",
|
||||
init = function()
|
||||
require("core.utils").load_mappings "telescope"
|
||||
@ -277,10 +278,11 @@ local default_plugins = {
|
||||
-- Only load whichkey after all the gui
|
||||
{
|
||||
"folke/which-key.nvim",
|
||||
keys = { "<leader>", '"', "'", "`", "c", "v" },
|
||||
keys = { "<leader>", "<c-r>", "<c-w>", '"', "'", "`", "c", "v", "g" },
|
||||
init = function()
|
||||
require("core.utils").load_mappings "whichkey"
|
||||
end,
|
||||
cmd = "WhichKey",
|
||||
config = function(_, opts)
|
||||
dofile(vim.g.base46_cache .. "whichkey")
|
||||
require("which-key").setup(opts)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user