merge v2.0

This commit is contained in:
Paul Trowbridge 2023-05-08 08:11:16 -04:00
commit 841b45998e
12 changed files with 55 additions and 110 deletions

9
.github/README.md vendored
View File

@ -3,13 +3,13 @@
<div align="center"> <div align="center">
<a href="https://nvchad.com/">Home</a> <a href="https://nvchad.com/">Home</a>
<span></span> <span></span>
<a href="https://nvchad.com/#/docs/quickstart/install">Install</a> <a href="https://nvchad.com/docs/quickstart/install">Install</a>
<span></span> <span></span>
<a href="https://nvchad.com/#/docs/contribute">Contribute</a> <a href="https://nvchad.com/docs/contribute">Contribute</a>
<span></span> <span></span>
<a href="https://github.com/NvChad/NvChad#gift_heart-support">Support</a> <a href="https://github.com/NvChad/NvChad#gift_heart-support">Support</a>
<span></span> <span></span>
<a href="https://nvchad.com/#/docs/features">Features</a> <a href="https://nvchad.com/docs/features">Features</a>
<p></p> <p></p>
</div> </div>
@ -89,9 +89,8 @@ A fuzzy file finder, picker, sorter, previewer and much more:
- Many beautiful themes, theme toggler by our [base46 plugin](https://github.com/NvChad/base46) - 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) - 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) - 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) - 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!
- File navigation with [nvim-tree.lua](https://github.com/kyazdani42/nvim-tree.lua) - File navigation with [nvim-tree.lua](https://github.com/kyazdani42/nvim-tree.lua)
- Managing tabs, buffers with [bufferline.nvim](https://github.com/akinsho/bufferline.nvim)
- Beautiful and configurable icons with [nvim-web-devicons](https://github.com/kyazdani42/nvim-web-devicons) - 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) - Git diffs and more with [gitsigns.nvim](https://github.com/lewis6991/gitsigns.nvim)
- NeoVim Lsp configuration with [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig) and [mason.nvim](https://github.com/williamboman/mason.nvim) - NeoVim Lsp configuration with [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig) and [mason.nvim](https://github.com/williamboman/mason.nvim)

View File

@ -25,24 +25,9 @@ M.lazy = function(install_path)
-- install plugins -- install plugins
require "plugins" require "plugins"
vim.api.nvim_buf_delete(0, { force = true }) -- close lazy window
---------- mason packages ------------- -- mason packages & show post_boostrap screen
vim.schedule(function() require "nvchad.post_bootstrap"()
vim.cmd "MasonInstallAll"
local packages = table.concat(vim.g.mason_binaries_list, " ")
require("mason-registry"):on("package:install:success", function(pkg)
packages = string.gsub(packages, pkg.name:gsub("%-", "%%-"), "") -- rm package name
if packages:match "%S" == nil then
vim.schedule(function()
vim.api.nvim_buf_delete(0, { force = true })
M.echo "Now please read the docs at nvchad.com!! 󰕹 󰱬"
end)
end
end)
end)
end end
M.gen_chadrc_template = function() M.gen_chadrc_template = function()
@ -50,15 +35,17 @@ M.gen_chadrc_template = function()
local path = vim.fn.stdpath "config" .. "/lua/custom/" local path = vim.fn.stdpath "config" .. "/lua/custom/"
local input = vim.fn.input "Do you want to install example custom config? (y/N) : " local input = vim.fn.input "Do you want to install example custom config? (y/N) : "
-- clone example_config repo
if input == "y" then if input == "y" then
M.echo "cloning example custom config repo ..." M.echo "cloning example custom config repo ..."
vim.fn.system { "git", "clone", "--depth", "1", "https://github.com/NvChad/example_config", path } vim.fn.system { "git", "clone", "--depth", "1", "https://github.com/NvChad/example_config", path }
vim.fn.delete(path .. ".git", "rf") vim.fn.delete(path .. ".git", "rf")
else else
-- use very minimal chadrc
vim.fn.mkdir(path, "p") vim.fn.mkdir(path, "p")
local file = io.open(path .. "chadrc.lua", "w") local file = io.open(path .. "chadrc.lua", "w")
file:write "local M = {}\n M.ui = {theme = 'onedark'}\n return M" file:write "---@type ChadrcConfig \n local M = {}\n M.ui = {theme = 'onedark'}\n return M"
file:close() file:close()
end end
end end

View File

@ -1,12 +1,7 @@
-- Chadrc overrides this file
local M = {} local M = {}
M.options = { M.options = {
nvChad = { nvchad_branch = "v2.0",
update_url = "https://github.com/NvChad/NvChad",
update_branch = "v2.0",
},
} }
M.ui = { M.ui = {
@ -18,6 +13,10 @@ M.ui = {
theme_toggle = { "onedark", "one_light" }, theme_toggle = { "onedark", "one_light" },
theme = "onedark", -- default theme theme = "onedark", -- default theme
transparency = false, transparency = false,
lsp_semantic_tokens = false, -- needs nvim v0.9, just adds highlight groups for lsp semantic tokens
-- https://github.com/NvChad/base46/tree/v2.0/lua/base46/extended_integrations
extended_integrations = {}, -- these aren't compiled by default, ex: "alpha", "notify"
-- cmp themeing -- cmp themeing
cmp = { cmp = {
@ -28,9 +27,7 @@ M.ui = {
selected_item_bg = "colored", -- colored / simple selected_item_bg = "colored", -- colored / simple
}, },
telescope = { telescope = { style = "borderless" }, -- borderless / bordered
style = "borderless", -- borderless / bordered
},
------------------------------- nvchad_ui modules ----------------------------- ------------------------------- nvchad_ui modules -----------------------------
statusline = { statusline = {
@ -75,9 +72,7 @@ M.ui = {
}, },
}, },
cheatsheet = { cheatsheet = { theme = "grid" }, -- simple/grid
theme = "grid", -- simple/grid
},
lsp = { lsp = {
-- show function signatures i.e args as you type -- show function signatures i.e args as you type
@ -88,11 +83,10 @@ M.ui = {
}, },
} }
M.plugins = "" -- path i.e "custom.plugins" -> custom/plugins.lua only and not custom/plugins/init.lua!!!! 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.lazy_nvim = require "plugins.configs.lazy_nvim" -- config for lazy.nvim startup options
-- these are default mappings, check core.mappings for table structure
M.mappings = {} M.mappings = {}
return M return M

View File

@ -265,6 +265,7 @@ M.telescope = {
["<leader>fb"] = { "<cmd> Telescope buffers <CR>", "find buffers" }, ["<leader>fb"] = { "<cmd> Telescope buffers <CR>", "find buffers" },
["<leader>fh"] = { "<cmd> Telescope help_tags <CR>", "help page" }, ["<leader>fh"] = { "<cmd> Telescope help_tags <CR>", "help page" },
["<leader>fo"] = { "<cmd> Telescope oldfiles <CR>", "find oldfiles" }, ["<leader>fo"] = { "<cmd> Telescope oldfiles <CR>", "find oldfiles" },
["<leader>fz"] = { "<cmd> Telescope current_buffer_fuzzy_find <CR>", "find in current buffer" },
-- git -- git
["<leader>cm"] = { "<cmd> Telescope git_commits <CR>", "git commits" }, ["<leader>cm"] = { "<cmd> Telescope git_commits <CR>", "git commits" },

View File

@ -52,6 +52,7 @@ M.remove_disabled_keys = function(chadrc_mappings, default_mappings)
end end
M.load_mappings = function(section, mapping_opt) M.load_mappings = function(section, mapping_opt)
vim.schedule(function()
local function set_section_map(section_values) local function set_section_map(section_values)
if section_values.plugin then if section_values.plugin then
return return
@ -83,6 +84,7 @@ M.load_mappings = function(section, mapping_opt)
for _, sect in pairs(mappings) do for _, sect in pairs(mappings) do
set_section_map(sect) set_section_map(sect)
end end
end)
end end
M.lazy_load = function(plugin) M.lazy_load = function(plugin)

View File

@ -5,7 +5,7 @@ return {
ui = { ui = {
icons = { icons = {
ft = "", ft = "",
lazy = " ", lazy = "󰂠 ",
loaded = "", loaded = "",
not_loaded = "", not_loaded = "",
}, },

View File

@ -7,14 +7,15 @@ local utils = require "core.utils"
-- export on_attach & capabilities for custom lspconfigs -- export on_attach & capabilities for custom lspconfigs
M.on_attach = function(client, bufnr) M.on_attach = function(client, bufnr)
client.server_capabilities.documentFormattingProvider = false
client.server_capabilities.documentRangeFormattingProvider = false
utils.load_mappings("lspconfig", { buffer = bufnr }) utils.load_mappings("lspconfig", { buffer = bufnr })
if client.server_capabilities.signatureHelpProvider then if client.server_capabilities.signatureHelpProvider then
require("nvchad_ui.signature").setup(client) require("nvchad_ui.signature").setup(client)
end end
if not utils.load_config().ui.lsp_semantic_tokens then
client.server_capabilities.semanticTokensProvider = nil
end
end end
M.capabilities = vim.lsp.protocol.make_client_capabilities() M.capabilities = vim.lsp.protocol.make_client_capabilities()

View File

@ -6,8 +6,8 @@ local options = {
ui = { ui = {
icons = { icons = {
package_pending = "", package_pending = "",
package_installed = " ", package_installed = "󰄳 ",
package_uninstalled = " ", package_uninstalled = " 󰚌",
}, },
keymaps = { keymaps = {

View File

@ -16,7 +16,6 @@ local options = {
adaptive_size = false, adaptive_size = false,
side = "left", side = "left",
width = 30, width = 30,
hide_root_folder = true,
preserve_window_proportions = true, preserve_window_proportions = true,
}, },
git = { git = {
@ -34,7 +33,6 @@ local options = {
renderer = { renderer = {
highlight_git = true, highlight_git = true,
highlight_opened_files = "none", highlight_opened_files = "none",
indent_markers = { indent_markers = {
enable = false, enable = false,
}, },
@ -48,10 +46,10 @@ local options = {
}, },
glyphs = { glyphs = {
default = "", default = "󰈚",
symlink = "", symlink = "",
folder = { folder = {
default = "", default = "󰉋",
empty = "", empty = "",
empty_open = "", empty_open = "",
open = "", open = "",

View File

@ -53,7 +53,7 @@ M.gitsigns = {
signs = { signs = {
add = { hl = "DiffAdd", text = "", numhl = "GitSignsAddNr" }, add = { hl = "DiffAdd", text = "", numhl = "GitSignsAddNr" },
change = { hl = "DiffChange", text = "", numhl = "GitSignsChangeNr" }, change = { hl = "DiffChange", text = "", numhl = "GitSignsChangeNr" },
delete = { hl = "DiffDelete", text = "", numhl = "GitSignsDeleteNr" }, delete = { hl = "DiffDelete", text = "󰍵", numhl = "GitSignsDeleteNr" },
topdelete = { hl = "DiffDelete", text = "", numhl = "GitSignsDeleteNr" }, topdelete = { hl = "DiffDelete", text = "", numhl = "GitSignsDeleteNr" },
changedelete = { hl = "DiffChangeDelete", text = "~", numhl = "GitSignsChangeNr" }, changedelete = { hl = "DiffChangeDelete", text = "~", numhl = "GitSignsChangeNr" },
untracked = { hl = "GitSignsAdd", text = "", numhl = "GitSignsAddNr", linehl = "GitSignsAddLn" }, untracked = { hl = "GitSignsAdd", text = "", numhl = "GitSignsAddNr", linehl = "GitSignsAddLn" },

View File

@ -1,31 +0,0 @@
local options = {
icons = {
breadcrumb = "»", -- symbol used in the command line area that shows your active key combo
separator = "", -- symbol used between a key and it's label
group = "+", -- symbol prepended to a group
},
popup_mappings = {
scroll_down = "<c-d>", -- binding to scroll down inside the popup
scroll_up = "<c-u>", -- binding to scroll up inside the popup
},
window = {
border = "none", -- none/single/double/shadow
},
layout = {
spacing = 6, -- spacing between columns
},
hidden = { "<silent>", "<cmd>", "<Cmd>", "<CR>", "call", "lua", "^:", "^ " },
triggers_blacklist = {
-- list of mode / prefixes that should never be hooked by WhichKey
i = { "j", "k" },
v = { "j", "k" },
},
}
return options

View File

@ -95,7 +95,7 @@ local default_plugins = {
-- git stuff -- git stuff
{ {
"lewis6991/gitsigns.nvim", "lewis6991/gitsigns.nvim",
ft = "gitcommit", ft = { "gitcommit", "diff" },
init = function() init = function()
-- load gitsigns only when a git file is opened -- load gitsigns only when a git file is opened
vim.api.nvim_create_autocmd({ "BufRead" }, { vim.api.nvim_create_autocmd({ "BufRead" }, {
@ -190,7 +190,6 @@ local default_plugins = {
"hrsh7th/cmp-path", "hrsh7th/cmp-path",
}, },
}, },
opts = function() opts = function()
return require "plugins.configs.cmp" return require "plugins.configs.cmp"
end, end,
@ -201,7 +200,7 @@ local default_plugins = {
{ {
"numToStr/Comment.nvim", "numToStr/Comment.nvim",
-- keys = { "gc", "gb" }, keys = { "gcc", "gbc" },
init = function() init = function()
require("core.utils").load_mappings "comment" require("core.utils").load_mappings "comment"
end, end,
@ -233,11 +232,9 @@ local default_plugins = {
init = function() init = function()
require("core.utils").load_mappings "telescope" require("core.utils").load_mappings "telescope"
end, end,
opts = function() opts = function()
return require "plugins.configs.telescope" return require "plugins.configs.telescope"
end, end,
config = function(_, opts) config = function(_, opts)
dofile(vim.g.base46_cache .. "telescope") dofile(vim.g.base46_cache .. "telescope")
local telescope = require "telescope" local telescope = require "telescope"
@ -253,13 +250,10 @@ local default_plugins = {
-- Only load whichkey after all the gui -- Only load whichkey after all the gui
{ {
"folke/which-key.nvim", "folke/which-key.nvim",
keys = { "<leader>", '"', "'", "`" }, keys = { "<leader>", '"', "'", "`", "c", "v" },
init = function() init = function()
require("core.utils").load_mappings "whichkey" require("core.utils").load_mappings "whichkey"
end, end,
opts = function()
return require "plugins.configs.whichkey"
end,
config = function(_, opts) config = function(_, opts)
dofile(vim.g.base46_cache .. "whichkey") dofile(vim.g.base46_cache .. "whichkey")
require("which-key").setup(opts) require("which-key").setup(opts)