NvChad Updater | Chadrc Fixes | Cleanup and Formatting | Misc (#288)

* tree-wide: Format files

ugh why do people don't push formatted stuff

* mappings|init: Move init mappings to a function, only call when required | Show err message for init

because mappings.lua is called from multiple places, so there should't be any code that executes without calling a specific function

show error message when something fails in init.lua
makes no sense to not

rearrange plugin functions alphabetically, but keep misc at top

* feat: Do not depend on user config | Fix merging of configs

because it is a user config, so our config shoudn't break even we if dont have it

use our own table merge function

move loading config to a function

use a global variable to store the config, so no need to call the table function everytime

* Add NvChadUpdate command and shortcut for it

map leader+uu to it

summary of what it does:

first ask the user for confirmation and tell that the updater is gonna run git reset --hard in config repo and chadrc will be restored

take backup of chadrc in a lua string and locally in a file with chadrc.bak.(random numbers)

git reset on config dir and git pull

whether success or error, restore the chadrc file

if restore fails, then print backup file path

for more deep understanding, read the comments in utils.lua

* NvChadUpdater: Make update repo and url configurable | Improvr logging
This commit is contained in:
Aki 2021-08-19 12:33:11 +05:30 committed by GitHub
parent 623a2a0d1a
commit 36cb57ecce
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 389 additions and 197 deletions

View file

@ -5,7 +5,7 @@ local present, bufferline = pcall(require, "bufferline")
if not present then
return
end
bufferline.setup {
options = {
offsets = { { filetype = "NvimTree", text = "", padding = 1 } },
@ -25,23 +25,23 @@ bufferline.setup {
mappings = true,
always_show_bufferline = true,
custom_filter = function(buf_number)
-- Func to filter out our managed/persistent split terms
local present_type, type = pcall(function()
return vim.api.nvim_buf_get_var(buf_number, "term_type")
end)
if present_type then
if type == "vert" then
-- Func to filter out our managed/persistent split terms
local present_type, type = pcall(function()
return vim.api.nvim_buf_get_var(buf_number, "term_type")
end)
if present_type then
if type == "vert" then
return false
elseif type == "hori" then
return false
else
return true
return true
end
else
return true
end
end,
else
return true
end
end,
},
highlights = {
fill = {

View file

@ -4,7 +4,7 @@ if not present then
return
end
local mappings = require("chadrc").mappings
local mappings = require("utils").load_config().mappings
-- add user mappings to the cheetsheet
for section, data in pairs(mappings) do

View file

@ -38,8 +38,8 @@ telescope.setup {
file_ignore_patterns = {},
generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter,
path_display = function(opts, path)
local tail = require("telescope.utils").path_tail(path)
return string.format("%s (%s)", tail, path)
local tail = require("telescope.utils").path_tail(path)
return string.format("%s (%s)", tail, path)
end,
winblend = 0,
border = {},