restore NvChad

pull/2680/head
Panos Sakkos 6 months ago
parent 7801add829
commit a417b037c0

9
.gitignore vendored

@ -1,2 +1,9 @@
plugin
spell
ftplugin
syntax
coc-settings.json
.luarc.json
lazy-lock.json
after
**/.DS_Store

@ -1,16 +0,0 @@
---@type ChadrcConfig
local M = {}
M.ui = {
theme = "everforest_light",
statusline = {
theme = "default",
separator_style = "block",
},
}
M.plugins = "custom.plugins"
M.mappings = require "custom.mappings"
vim.g.toggle_theme_icon = ""
return M

@ -1,8 +1,21 @@
local opt = vim.opt
opt.backup = false
opt.swapfile = false
opt.colorcolumn = "100"
opt.relativenumber = true
opt.list = true
opt.listchars = "tab:➝ ,lead:·,space:·,trail:·,nbsp:+,eol:¬"
require "core"
local custom_init_path = vim.api.nvim_get_runtime_file("lua/custom/init.lua", false)[1]
if custom_init_path then
dofile(custom_init_path)
end
require("core.utils").load_mappings()
local lazypath = vim.fn.stdpath "data" .. "/lazy/lazy.nvim"
-- bootstrap lazy.nvim!
if not vim.loop.fs_stat(lazypath) then
require("core.bootstrap").gen_chadrc_template()
require("core.bootstrap").lazy(lazypath)
end
dofile(vim.g.base46_cache .. "defaults")
vim.opt.rtp:prepend(lazypath)
require "plugins"

@ -40,7 +40,7 @@ M.gen_chadrc_template = function()
local path = fn.stdpath "config" .. "/lua/custom"
if fn.isdirectory(path) ~= 1 then
local input = vim.env.NVCHAD_EXAMPLE_CONFIG or fn.input "Do you want to install example custom config? (y/N): "
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..."

@ -0,0 +1,92 @@
local M = {}
M.options = {
nvchad_branch = "v2.0",
}
M.ui = {
------------------------------- base46 -------------------------------------
-- hl = highlights
hl_add = {},
hl_override = {},
changed_themes = {},
theme_toggle = { "onedark", "one_light" },
theme = "onedark", -- default theme
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 = {
icons = true,
lspkind_text = true,
style = "default", -- default/flat_light/flat_dark/atom/atom_colored
border_color = "grey_fg", -- only applicable for "default" style, use color names from base30 variables
selected_item_bg = "colored", -- colored / simple
},
telescope = { style = "borderless" }, -- borderless / bordered
------------------------------- nvchad_ui modules -----------------------------
statusline = {
theme = "default", -- 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",
overriden_modules = nil,
},
-- lazyload it when there are 1+ buffers
tabufline = {
show_numbers = false,
enabled = true,
lazyload = true,
overriden_modules = nil,
},
-- nvdash (dashboard)
nvdash = {
load_on_startup = false,
header = {
" ▄ ▄ ",
" ▄ ▄▄▄ ▄ ▄▄▄ ▄ ▄ ",
" █ ▄ █▄█ ▄▄▄ █ █▄█ █ █ ",
" ▄▄ █▄█▄▄▄█ █▄█▄█▄▄█▄▄█ █ ",
" ▄ █▄▄█ ▄ ▄▄ ▄█ ▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ",
" █▄▄▄▄ ▄▄▄ █ ▄ ▄▄▄ ▄ ▄▄▄ ▄ ▄ █ ▄",
"▄ █ █▄█ █▄█ █ █ █▄█ █ █▄█ ▄▄▄ █ █",
"█▄█ ▄ █▄▄█▄▄█ █ ▄▄█ █ ▄ █ █▄█▄█ █",
" █▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█ █▄█▄▄▄█ ",
},
buttons = {
{ " Find File", "Spc f f", "Telescope find_files" },
{ "󰈚 Recent Files", "Spc f o", "Telescope oldfiles" },
{ "󰈭 Find Word", "Spc f w", "Telescope live_grep" },
{ " Bookmarks", "Spc m a", "Telescope marks" },
{ " Themes", "Spc t h", "Telescope themes" },
{ " Mappings", "Spc c h", "NvCheatsheet" },
},
},
cheatsheet = { theme = "grid" }, -- simple/grid
lsp = {
-- show function signatures i.e args as you type
signature = {
disabled = false,
silent = true, -- silences 'no signature help available' message from appearing
},
},
}
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 = require "core.mappings"
return M

@ -107,32 +107,6 @@ autocmd("BufWritePost", {
end,
})
-- user event that loads after UIEnter + only if file buf is there
vim.api.nvim_create_autocmd({ "UIEnter", "BufReadPost", "BufNewFile" }, {
group = vim.api.nvim_create_augroup("NvFilePost", { clear = true }),
callback = function(args)
local file = vim.api.nvim_buf_get_name(args.buf)
local buftype = vim.api.nvim_buf_get_option(args.buf, "buftype")
if not vim.g.ui_entered and args.event == "UIEnter" then
vim.g.ui_entered = true
end
if file ~= "" and buftype ~= "nofile" and vim.g.ui_entered then
vim.api.nvim_exec_autocmds("User", { pattern = "FilePost", modeline = false })
vim.api.nvim_del_augroup_by_name "NvFilePost"
vim.schedule(function()
vim.api.nvim_exec_autocmds("FileType", {})
if vim.g.editorconfig then
require("editorconfig").config(args.buf)
end
end, 0)
end
end,
})
-------------------------------------- commands ------------------------------------------
local new_cmd = vim.api.nvim_create_user_command

@ -0,0 +1,118 @@
local M = {}
local merge_tb = vim.tbl_deep_extend
M.load_config = function()
local config = require "core.default_config"
local chadrc_path = vim.api.nvim_get_runtime_file("lua/custom/chadrc.lua", false)[1]
if chadrc_path then
local chadrc = dofile(chadrc_path)
config.mappings = M.remove_disabled_keys(chadrc.mappings, config.mappings)
config = merge_tb("force", config, chadrc)
config.mappings.disabled = nil
end
return config
end
M.remove_disabled_keys = function(chadrc_mappings, default_mappings)
if not chadrc_mappings then
return default_mappings
end
-- store keys in a array with true value to compare
local keys_to_disable = {}
for _, mappings in pairs(chadrc_mappings) do
for mode, section_keys in pairs(mappings) do
if not keys_to_disable[mode] then
keys_to_disable[mode] = {}
end
section_keys = (type(section_keys) == "table" and section_keys) or {}
for k, _ in pairs(section_keys) do
keys_to_disable[mode][k] = true
end
end
end
-- make a copy as we need to modify default_mappings
for section_name, section_mappings in pairs(default_mappings) do
for mode, mode_mappings in pairs(section_mappings) do
mode_mappings = (type(mode_mappings) == "table" and mode_mappings) or {}
for k, _ in pairs(mode_mappings) do
-- if key if found then remove from default_mappings
if keys_to_disable[mode] and keys_to_disable[mode][k] then
default_mappings[section_name][mode][k] = nil
end
end
end
end
return default_mappings
end
M.load_mappings = function(section, mapping_opt)
vim.schedule(function()
local function set_section_map(section_values)
if section_values.plugin then
return
end
section_values.plugin = nil
for mode, mode_values in pairs(section_values) do
local default_opts = merge_tb("force", { mode = mode }, mapping_opt or {})
for keybind, mapping_info in pairs(mode_values) do
-- merge default + user opts
local opts = merge_tb("force", default_opts, mapping_info.opts or {})
mapping_info.opts, opts.mode = nil, nil
opts.desc = mapping_info[2]
vim.keymap.set(mode, keybind, mapping_info[1], opts)
end
end
end
local mappings = require("core.utils").load_config().mappings
if type(section) == "string" then
mappings[section]["plugin"] = nil
mappings = { mappings[section] }
end
for _, sect in pairs(mappings) do
set_section_map(sect)
end
end)
end
M.lazy_load = function(plugin)
vim.api.nvim_create_autocmd({ "BufRead", "BufWinEnter", "BufNewFile" }, {
group = vim.api.nvim_create_augroup("BeLazyOnFileOpen" .. plugin, {}),
callback = function()
local file = vim.fn.expand "%"
local condition = file ~= "NvimTree_1" and file ~= "[lazy]" and file ~= ""
if condition then
vim.api.nvim_del_augroup_by_name("BeLazyOnFileOpen" .. plugin)
-- dont defer for treesitter as it will show slow highlighting
-- This deferring only happens only when we do "nvim filename"
if plugin ~= "nvim-treesitter" then
vim.schedule(function()
require("lazy").load { plugins = plugin }
if plugin == "nvim-lspconfig" then
vim.cmd "silent! do FileType"
end
end, 0)
else
require("lazy").load { plugins = plugin }
end
end
end,
})
end
return M

@ -0,0 +1,16 @@
---@type ChadrcConfig
local M = {}
M.ui = {
theme = "everforest_light",
statusline = {
theme = "default",
separator_style = "block",
},
}
M.plugins = "custom.plugins"
M.mappings = require("custom.mappings")
vim.g.toggle_theme_icon = ""
return M

@ -0,0 +1,8 @@
local opt = vim.opt
opt.backup = false
opt.swapfile = false
opt.colorcolumn = "100"
opt.relativenumber = true
opt.list = true
opt.listchars = "tab:➝ ,lead:·,space:·,trail:·,nbsp:+,eol:¬"

@ -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",
},
},
},
}

@ -7,6 +7,9 @@ local utils = require "core.utils"
-- export on_attach & capabilities for custom lspconfigs
M.on_attach = function(client, bufnr)
client.server_capabilities.documentFormattingProvider = false
client.server_capabilities.documentRangeFormattingProvider = false
utils.load_mappings("lspconfig", { buffer = bufnr })
if client.server_capabilities.signatureHelpProvider then

@ -0,0 +1,28 @@
local options = {
ensure_installed = { "lua-language-server" }, -- not an option from mason.nvim
PATH = "skip",
ui = {
icons = {
package_pending = "",
package_installed = "󰄳 ",
package_uninstalled = " 󰚌",
},
keymaps = {
toggle_server_expand = "<CR>",
install_server = "i",
update_server = "u",
check_server_version = "c",
update_all_servers = "U",
check_outdated_servers = "C",
uninstall_server = "X",
cancel_installation = "<C-c>",
},
},
max_concurrent_installers = 10,
}
return options

@ -0,0 +1,77 @@
local options = {
filters = {
dotfiles = false,
exclude = { vim.fn.stdpath "config" .. "/lua/custom" },
},
disable_netrw = true,
hijack_netrw = true,
hijack_cursor = true,
hijack_unnamed_buffer_when_opening = false,
sync_root_with_cwd = true,
update_focused_file = {
enable = true,
update_root = false,
},
view = {
adaptive_size = false,
side = "left",
width = 30,
preserve_window_proportions = true,
},
git = {
enable = false,
ignore = true,
},
filesystem_watchers = {
enable = true,
},
actions = {
open_file = {
resize_window = true,
},
},
renderer = {
root_folder_label = false,
highlight_git = false,
highlight_opened_files = "none",
indent_markers = {
enable = false,
},
icons = {
show = {
file = true,
folder = true,
folder_arrow = true,
git = false,
},
glyphs = {
default = "󰈚",
symlink = "",
folder = {
default = "",
empty = "",
empty_open = "",
open = "",
symlink = "",
symlink_open = "",
arrow_open = "",
arrow_closed = "",
},
git = {
unstaged = "",
staged = "",
unmerged = "",
renamed = "",
untracked = "",
deleted = "",
ignored = "",
},
},
},
},
}
return options

@ -0,0 +1,66 @@
local M = {}
local utils = require "core.utils"
M.blankline = {
indentLine_enabled = 1,
filetype_exclude = {
"help",
"terminal",
"lazy",
"lspinfo",
"TelescopePrompt",
"TelescopeResults",
"mason",
"nvdash",
"nvcheatsheet",
"",
},
buftype_exclude = { "terminal" },
show_trailing_blankline_indent = false,
show_first_indent_level = false,
show_current_context = true,
show_current_context_start = true,
}
M.luasnip = function(opts)
require("luasnip").config.set_config(opts)
-- vscode format
require("luasnip.loaders.from_vscode").lazy_load()
require("luasnip.loaders.from_vscode").lazy_load { paths = vim.g.vscode_snippets_path or "" }
-- snipmate format
require("luasnip.loaders.from_snipmate").load()
require("luasnip.loaders.from_snipmate").lazy_load { paths = vim.g.snipmate_snippets_path or "" }
-- lua format
require("luasnip.loaders.from_lua").load()
require("luasnip.loaders.from_lua").lazy_load { paths = vim.g.lua_snippets_path or "" }
vim.api.nvim_create_autocmd("InsertLeave", {
callback = function()
if
require("luasnip").session.current_nodes[vim.api.nvim_get_current_buf()]
and not require("luasnip").session.jump_active
then
require("luasnip").unlink_current()
end
end,
})
end
M.gitsigns = {
signs = {
add = { text = "" },
change = { text = "" },
delete = { text = "󰍵" },
topdelete = { text = "" },
changedelete = { text = "~" },
untracked = { text = "" },
},
on_attach = function(bufnr)
utils.load_mappings("gitsigns", { buffer = bufnr })
end,
}
return M

@ -49,7 +49,15 @@ local options = {
},
},
extensions_list = { "themes", "terms" },
extensions_list = { "themes", "terms", "fzf" },
extensions = {
fzf = {
fuzzy = true,
override_generic_sorter = true,
override_file_sorter = true,
case_mode = "smart_case",
},
},
}
return options

@ -0,0 +1,12 @@
local options = {
ensure_installed = { "lua" },
highlight = {
enable = true,
use_languagetree = true,
},
indent = { enable = true },
}
return options

@ -31,7 +31,9 @@ local default_plugins = {
{
"NvChad/nvim-colorizer.lua",
event = "User FilePost",
init = function()
require("core.utils").lazy_load "nvim-colorizer.lua"
end,
config = function(_, opts)
require("colorizer").setup(opts)
@ -56,7 +58,9 @@ local default_plugins = {
{
"lukas-reineke/indent-blankline.nvim",
version = "2.20.7",
event = "User FilePost",
init = function()
require("core.utils").lazy_load "indent-blankline.nvim"
end,
opts = function()
return require("plugins.configs.others").blankline
end,
@ -69,8 +73,9 @@ local default_plugins = {
{
"nvim-treesitter/nvim-treesitter",
event = { "BufReadPost", "BufNewFile" },
tag = "v0.9.2",
init = function()
require("core.utils").lazy_load "nvim-treesitter"
end,
cmd = { "TSInstall", "TSBufEnable", "TSBufDisable", "TSModuleInfo" },
build = ":TSUpdate",
opts = function()
@ -85,7 +90,27 @@ local default_plugins = {
-- git stuff
{
"lewis6991/gitsigns.nvim",
event = "User FilePost",
ft = { "gitcommit", "diff" },
init = function()
-- load gitsigns only when a git file is opened
vim.api.nvim_create_autocmd({ "BufRead" }, {
group = vim.api.nvim_create_augroup("GitSignsLazyLoad", { clear = true }),
callback = function()
vim.fn.jobstart({"git", "-C", vim.loop.cwd(), "rev-parse"},
{
on_exit = function(_, return_code)
if return_code == 0 then
vim.api.nvim_del_augroup_by_name "GitSignsLazyLoad"
vim.schedule(function()
require("lazy").load { plugins = { "gitsigns.nvim" } }
end)
end
end
}
)
end,
})
end,
opts = function()
return require("plugins.configs.others").gitsigns
end,
@ -108,9 +133,7 @@ local default_plugins = {
-- custom nvchad cmd to install all mason binaries listed
vim.api.nvim_create_user_command("MasonInstallAll", function()
if opts.ensure_installed and #opts.ensure_installed > 0 then
vim.cmd("MasonInstall " .. table.concat(opts.ensure_installed, " "))
end
vim.cmd("MasonInstall " .. table.concat(opts.ensure_installed, " "))
end, {})
vim.g.mason_binaries_list = opts.ensure_installed
@ -119,7 +142,9 @@ local default_plugins = {
{
"neovim/nvim-lspconfig",
event = "User FilePost",
init = function()
require("core.utils").lazy_load "nvim-lspconfig"
end,
config = function()
require "plugins.configs.lspconfig"
end,
@ -209,7 +234,7 @@ local default_plugins = {
{
"nvim-telescope/telescope.nvim",
dependencies = { "nvim-treesitter/nvim-treesitter" },
dependencies = { "nvim-treesitter/nvim-treesitter", { "nvim-telescope/telescope-fzf-native.nvim", build = "make" } },
cmd = "Telescope",
init = function()
require("core.utils").load_mappings "telescope"

Loading…
Cancel
Save