Merge branch 'main' into dev-script
This commit is contained in:
commit
45bf74bc03
|
@ -145,11 +145,12 @@ without / with Treesitter :
|
||||||
|
|
||||||
It would be nice if NvChad focuses on existing plugins and config before adding new things , some plugins like whichkey , telescope , treesitter still have basic configs! Also adding new features that'd make NvChad slow or its startuptime slow wouldnt be encouraged , if that feature's really needed then It'll be mentioned in the wiki with its config.
|
It would be nice if NvChad focuses on existing plugins and config before adding new things , some plugins like whichkey , telescope , treesitter still have basic configs! Also adding new features that'd make NvChad slow or its startuptime slow wouldnt be encouraged , if that feature's really needed then It'll be mentioned in the wiki with its config.
|
||||||
|
|
||||||
- Debloat the config
|
- Debloat the config.
|
||||||
|
- Make NvChad more faster (reduce startuptime too).
|
||||||
|
- Add another section in the wiki explaining the whole config (must be helpful for newbies).
|
||||||
- Add more themes.
|
- Add more themes.
|
||||||
- Add a theme switcher.
|
- Preview shortcuts in the form of a pretty [cheatsheet](https://user-images.githubusercontent.com/59060246/122490009-95fd9980-cffe-11eb-9676-78019aa2cd65.png).
|
||||||
- Preview shortcuts in the form of a pretty [cheatsheet](https://user-images.githubusercontent.com/59060246/122490009-95fd9980-cffe-11eb-9676-78019aa2cd65.png)
|
- Add a user config so it doesnt get hard to update :c
|
||||||
- Add a global configuration so it doesnt get hard to update :c
|
|
||||||
|
|
||||||
# Contribute
|
# Contribute
|
||||||
|
|
||||||
|
|
|
@ -78,10 +78,11 @@ if
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
then
|
then
|
||||||
-- This should only trigger when in need of PackerSync, so better do it
|
-- This should only trigger when in need of PackerSync, so better do it
|
||||||
print("After completion of PackerSync, restart neovim.")
|
print("After completion of PackerCompile, restart neovim.")
|
||||||
-- Trigger packer compile on PackerComplete, so it properly waits for PackerSync
|
-- Trigger packer compile on PackerComplete, so it properly waits for PackerSync
|
||||||
vim.cmd 'autocmd User PackerComplete ++once lua require("packer").compile()'
|
vim.cmd 'autocmd User PackerComplete ++once lua print "Waiting for PackerCompile.." require("packer").compile()'
|
||||||
|
vim.cmd 'autocmd User PackerCompileDone ++once echo "Packer Compile done, restart neovim."'
|
||||||
require "pluginList"
|
require "pluginList"
|
||||||
require("packer").sync("telescope-fzf-native.nvim", "telescope-media-files.nvim")
|
require("packer").update("telescope-fzf-native.nvim", "telescope-media-files.nvim")
|
||||||
end
|
end
|
||||||
|
|
|
@ -12,7 +12,8 @@ M.reload_theme = function(theme_name)
|
||||||
end
|
end
|
||||||
|
|
||||||
if not pcall(require, "themes/" .. theme_name) then
|
if not pcall(require, "themes/" .. theme_name) then
|
||||||
error("No such theme ( " .. theme_name .. " )")
|
print("No such theme ( " .. theme_name .. " )")
|
||||||
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
vim.g.nvchad_theme = theme_name
|
vim.g.nvchad_theme = theme_name
|
||||||
|
@ -20,16 +21,22 @@ M.reload_theme = function(theme_name)
|
||||||
-- reload the base16 theme
|
-- reload the base16 theme
|
||||||
local ok, base16 = pcall(require, "base16")
|
local ok, base16 = pcall(require, "base16")
|
||||||
if not ok then
|
if not ok then
|
||||||
error("Error: Cannot load base16 plugin!")
|
print("Error: Cannot load base16 plugin!")
|
||||||
|
return false
|
||||||
end
|
end
|
||||||
base16(base16.themes[theme_name], true)
|
base16(base16.themes[theme_name], true)
|
||||||
|
|
||||||
reload_plugin {
|
if
|
||||||
"highlights",
|
not reload_plugin {
|
||||||
"plugins.bufferline",
|
"highlights",
|
||||||
"galaxyline",
|
"plugins.bufferline",
|
||||||
"plugins.statusline"
|
"galaxyline",
|
||||||
}
|
"plugins.statusline"
|
||||||
|
}
|
||||||
|
then
|
||||||
|
print "Error: Not able to reload all plugins."
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
-- now send the provider info to actual refresh
|
-- now send the provider info to actual refresh
|
||||||
require("galaxyline.provider").async_load_providers:send()
|
require("galaxyline.provider").async_load_providers:send()
|
||||||
|
@ -152,6 +159,7 @@ M.theme_switcher = function(opts)
|
||||||
if change then
|
if change then
|
||||||
-- ask for confirmation to set as default theme
|
-- ask for confirmation to set as default theme
|
||||||
local ans = string.lower(vim.fn.input("Set " .. new_theme .. " as default theme ? [y/N] ")) == "y"
|
local ans = string.lower(vim.fn.input("Set " .. new_theme .. " as default theme ? [y/N] ")) == "y"
|
||||||
|
local_utils.clear_cmdline()
|
||||||
if ans then
|
if ans then
|
||||||
local_utils.change_theme(current_theme, final_theme)
|
local_utils.change_theme(current_theme, final_theme)
|
||||||
else
|
else
|
||||||
|
@ -161,9 +169,11 @@ M.theme_switcher = function(opts)
|
||||||
end
|
end
|
||||||
-- open a buffer and close it to reload the statusline
|
-- open a buffer and close it to reload the statusline
|
||||||
vim.cmd("new|bwipeout")
|
vim.cmd("new|bwipeout")
|
||||||
|
else
|
||||||
|
final_theme = current_theme
|
||||||
end
|
end
|
||||||
-- set nvchad_theme global var
|
-- set nvchad_theme global var
|
||||||
vim.g.nvchad_theme = current_theme
|
vim.g.nvchad_theme = final_theme
|
||||||
end
|
end
|
||||||
-- launch the telescope picker
|
-- launch the telescope picker
|
||||||
picker:find()
|
picker:find()
|
||||||
|
|
|
@ -2,14 +2,17 @@ local M = {}
|
||||||
|
|
||||||
-- reload a plugin ( will try to load even if not loaded)
|
-- reload a plugin ( will try to load even if not loaded)
|
||||||
-- can take a string or list ( table )
|
-- can take a string or list ( table )
|
||||||
|
-- return true or false
|
||||||
M.reload_plugin = function(plugins)
|
M.reload_plugin = function(plugins)
|
||||||
|
local status = true
|
||||||
local function _reload_plugin(plugin)
|
local function _reload_plugin(plugin)
|
||||||
local loaded = package.loaded[plugin]
|
local loaded = package.loaded[plugin]
|
||||||
if loaded then
|
if loaded then
|
||||||
package.loaded[plugin] = nil
|
package.loaded[plugin] = nil
|
||||||
end
|
end
|
||||||
if not pcall(require, plugin) then
|
if not pcall(require, plugin) then
|
||||||
error("Error: Cannot load " .. plugin .. " plugin!")
|
print("Error: Cannot load " .. plugin .. " plugin!")
|
||||||
|
status = false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -20,6 +23,7 @@ M.reload_plugin = function(plugins)
|
||||||
_reload_plugin(plugin)
|
_reload_plugin(plugin)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
return status
|
||||||
end
|
end
|
||||||
|
|
||||||
-- return a table of available themes
|
-- return a table of available themes
|
||||||
|
@ -73,7 +77,8 @@ end
|
||||||
-- 1st arg as current theme, 2nd as new theme
|
-- 1st arg as current theme, 2nd as new theme
|
||||||
M.change_theme = function(current_theme, new_theme)
|
M.change_theme = function(current_theme, new_theme)
|
||||||
if current_theme == nil or new_theme == nil then
|
if current_theme == nil or new_theme == nil then
|
||||||
error "Provide current and new theme name"
|
print "Error: Provide current and new theme name"
|
||||||
|
return false
|
||||||
end
|
end
|
||||||
if current_theme == new_theme then
|
if current_theme == new_theme then
|
||||||
return
|
return
|
||||||
|
@ -87,10 +92,20 @@ M.change_theme = function(current_theme, new_theme)
|
||||||
local content = string.gsub(data, find, replace)
|
local content = string.gsub(data, find, replace)
|
||||||
-- see if the find string exists in file
|
-- see if the find string exists in file
|
||||||
if content == data then
|
if content == data then
|
||||||
error("Cannot change default theme with " .. new_theme .. ", edit " .. file .. " manually")
|
print("Error: Cannot change default theme with " .. new_theme .. ", edit " .. file .. " manually")
|
||||||
|
return false
|
||||||
else
|
else
|
||||||
assert(M.file("w", file, content))
|
assert(M.file("w", file, content))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
M.clear_cmdline = function()
|
||||||
|
vim.defer_fn(
|
||||||
|
function()
|
||||||
|
vim.cmd("echo")
|
||||||
|
end,
|
||||||
|
0
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
Loading…
Reference in New Issue