misc & cleanup
This commit is contained in:
parent
a3ea8a9f4d
commit
0aafb002b5
|
@ -16,12 +16,11 @@ M.lazy = function(install_path)
|
|||
|
||||
-- install plugins + compile their configs
|
||||
require "plugins"
|
||||
require("lazy").load { plugins = { "nvim-treesitter" } }
|
||||
|
||||
-- install binaries from mason.nvim & tsparsers on LazySync
|
||||
vim.schedule(function()
|
||||
vim.api.nvim_buf_delete(0, { force = true }) -- close lazy window
|
||||
|
||||
vim.defer_fn(function()
|
||||
vim.cmd "silent! MasonInstallAll"
|
||||
-- print success message
|
||||
end, 0)
|
||||
end
|
||||
|
||||
|
@ -31,7 +30,6 @@ M.gen_chadrc_template = function()
|
|||
vim.cmd "redraw|echo ''"
|
||||
|
||||
if input == "y" then
|
||||
-- clone example_config repo
|
||||
print "cloning chadrc starter template repo...."
|
||||
|
||||
vim.fn.system {
|
||||
|
@ -50,6 +48,21 @@ M.gen_chadrc_template = function()
|
|||
vim.loop.fs_rmdir(vim.fn.stdpath "config" .. "/lua/custom/.git")
|
||||
vim.notify "successfully installed chadrc template!"
|
||||
vim.cmd "redraw|echo ''"
|
||||
else
|
||||
local custom_dir = vim.fn.stdpath "config" .. "/lua/custom/"
|
||||
vim.fn.mkdir(custom_dir, "p")
|
||||
|
||||
local str = [[
|
||||
local M = {}
|
||||
M.ui = {
|
||||
theme = "onedark",
|
||||
}
|
||||
return M
|
||||
]]
|
||||
|
||||
local file = io.open(custom_dir .. "chadrc.lua", "w")
|
||||
file:write(str)
|
||||
file:close()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -5,7 +5,7 @@ vim.env.PATH = vim.env.PATH .. (is_windows and ";" or ":") .. vim.fn.stdpath "da
|
|||
local new_cmd = vim.api.nvim_create_user_command
|
||||
|
||||
new_cmd("NvChadUpdate", function()
|
||||
require("nvchad").update_nvchad()
|
||||
require "nvchad.update"()
|
||||
end, {})
|
||||
|
||||
-- autocmds
|
||||
|
@ -19,37 +19,22 @@ autocmd("FileType", {
|
|||
end,
|
||||
})
|
||||
|
||||
local sep = vim.loop.os_uname().sysname:find "windows" and "\\" or "/"
|
||||
|
||||
vim.api.nvim_create_autocmd("BufWritePost", {
|
||||
pattern = vim.fn.glob(
|
||||
table.concat({
|
||||
vim.fn.stdpath "config",
|
||||
"lua",
|
||||
"custom",
|
||||
"**",
|
||||
"*.lua",
|
||||
}, sep),
|
||||
true,
|
||||
true,
|
||||
true
|
||||
),
|
||||
|
||||
pattern = "chadrc.lua",
|
||||
group = vim.api.nvim_create_augroup("ReloadNvChad", {}),
|
||||
|
||||
callback = function(opts)
|
||||
callback = function()
|
||||
require("plenary.reload").reload_module "base46"
|
||||
local file = string
|
||||
.gsub(vim.fn.fnamemodify(opts.file, ":r"), vim.fn.stdpath "config" .. sep .. "lua" .. sep, "")
|
||||
:gsub(sep, ".")
|
||||
require("plenary.reload").reload_module(file)
|
||||
require("plenary.reload").reload_module "custom.chadrc"
|
||||
local config = require("core.utils").load_config()
|
||||
|
||||
local config = require("core.utils").load_config().ui
|
||||
vim.opt.statusline = "%!v:lua.require('nvchad_ui.statusline." .. config.ui.statusline.theme .. "').run()"
|
||||
vim.g.nvchad_theme = config.ui.theme
|
||||
vim.g.transparency = config.ui.transparency
|
||||
|
||||
vim.opt.statusline = "%!v:lua.require('nvchad_ui.statusline." .. config.statusline.theme .. "').run()"
|
||||
-- reload cmp stuff
|
||||
require("plenary.reload").reload_module "plugins.configs.cmp"
|
||||
require("cmp").setup(require "plugins.configs.cmp")
|
||||
|
||||
require("base46").load_all_highlights()
|
||||
-- vim.cmd("redraw!")
|
||||
end,
|
||||
})
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
-- n, v, i, t = mode names
|
||||
|
||||
local function termcodes(str)
|
||||
return vim.api.nvim_replace_termcodes(str, true, true, true)
|
||||
end
|
||||
|
||||
local M = {}
|
||||
|
||||
M.general = {
|
||||
|
@ -20,8 +16,6 @@ M.general = {
|
|||
},
|
||||
|
||||
n = {
|
||||
["<ESC>"] = { "<cmd> noh <CR>", "no highlight" },
|
||||
|
||||
-- switch between windows
|
||||
["<C-h>"] = { "<C-w>h", "window left" },
|
||||
["<C-l>"] = { "<C-w>l", "window right" },
|
||||
|
@ -38,16 +32,6 @@ M.general = {
|
|||
["<leader>n"] = { "<cmd> set nu! <CR>", "toggle line number" },
|
||||
["<leader>rn"] = { "<cmd> set rnu! <CR>", "toggle relative number" },
|
||||
|
||||
-- update nvchad
|
||||
["<leader>uu"] = { "<cmd> :NvChadUpdate <CR>", "update nvchad" },
|
||||
|
||||
["<leader>tt"] = {
|
||||
function()
|
||||
require("base46").toggle_theme()
|
||||
end,
|
||||
"toggle theme",
|
||||
},
|
||||
|
||||
-- Allow moving the cursor through wrapped lines with j, k, <Up> and <Down>
|
||||
-- http://www.reddit.com/r/vim/comments/2k4cbr/problem_with_gj_and_gk/
|
||||
-- empty mode is same as using <cmd> :map
|
||||
|
@ -61,7 +45,9 @@ M.general = {
|
|||
["<leader>b"] = { "<cmd> enew <CR>", "new buffer" },
|
||||
},
|
||||
|
||||
t = { ["<C-x>"] = { termcodes "<C-\\><C-N>", "escape terminal mode" } },
|
||||
t = {
|
||||
["<C-x>"] = { vim.api.nvim_replace_termcodes("<C-\\><C-N>", true, true, true), "escape terminal mode" },
|
||||
},
|
||||
|
||||
v = {
|
||||
["<Up>"] = { 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', "move up", opts = { expr = true } },
|
||||
|
@ -96,9 +82,6 @@ M.tabufline = {
|
|||
"goto prev buffer",
|
||||
},
|
||||
|
||||
-- pick buffers via numbers
|
||||
["<Bslash>"] = { "<cmd> TbufPick <CR>", "Pick buffer" },
|
||||
|
||||
-- close buffer + hide terminal buffer
|
||||
["<leader>x"] = {
|
||||
function()
|
||||
|
|
|
@ -21,10 +21,7 @@ M.blankline = {
|
|||
}
|
||||
|
||||
M.luasnip = function()
|
||||
local options = {
|
||||
history = true,
|
||||
updateevents = "TextChanged,TextChangedI",
|
||||
}
|
||||
local options = { history = true, updateevents = "TextChanged,TextChangedI" }
|
||||
|
||||
require("luasnip").config.set_config(options)
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@ local default_plugins = {
|
|||
if vim.v.shell_error == 0 then
|
||||
vim.api.nvim_del_augroup_by_name "GitSignsLazyLoad"
|
||||
vim.schedule(function()
|
||||
require("lazy").load { plugins = "gitsigns.nvim" }
|
||||
require("lazy").load { plugins = { "gitsigns.nvim" } }
|
||||
end)
|
||||
end
|
||||
end,
|
||||
|
|
Loading…
Reference in New Issue