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
|
-- install plugins + compile their configs
|
||||||
require "plugins"
|
require "plugins"
|
||||||
require("lazy").load { plugins = { "nvim-treesitter" } }
|
|
||||||
|
|
||||||
-- install binaries from mason.nvim & tsparsers on LazySync
|
vim.api.nvim_buf_delete(0, { force = true }) -- close lazy window
|
||||||
vim.schedule(function()
|
|
||||||
|
vim.defer_fn(function()
|
||||||
vim.cmd "silent! MasonInstallAll"
|
vim.cmd "silent! MasonInstallAll"
|
||||||
-- print success message
|
|
||||||
end, 0)
|
end, 0)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -31,7 +30,6 @@ M.gen_chadrc_template = function()
|
|||||||
vim.cmd "redraw|echo ''"
|
vim.cmd "redraw|echo ''"
|
||||||
|
|
||||||
if input == "y" then
|
if input == "y" then
|
||||||
-- clone example_config repo
|
|
||||||
print "cloning chadrc starter template repo...."
|
print "cloning chadrc starter template repo...."
|
||||||
|
|
||||||
vim.fn.system {
|
vim.fn.system {
|
||||||
@ -50,6 +48,21 @@ M.gen_chadrc_template = function()
|
|||||||
vim.loop.fs_rmdir(vim.fn.stdpath "config" .. "/lua/custom/.git")
|
vim.loop.fs_rmdir(vim.fn.stdpath "config" .. "/lua/custom/.git")
|
||||||
vim.notify "successfully installed chadrc template!"
|
vim.notify "successfully installed chadrc template!"
|
||||||
vim.cmd "redraw|echo ''"
|
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
|
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
|
local new_cmd = vim.api.nvim_create_user_command
|
||||||
|
|
||||||
new_cmd("NvChadUpdate", function()
|
new_cmd("NvChadUpdate", function()
|
||||||
require("nvchad").update_nvchad()
|
require "nvchad.update"()
|
||||||
end, {})
|
end, {})
|
||||||
|
|
||||||
-- autocmds
|
-- autocmds
|
||||||
@ -19,37 +19,22 @@ autocmd("FileType", {
|
|||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
local sep = vim.loop.os_uname().sysname:find "windows" and "\\" or "/"
|
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd("BufWritePost", {
|
vim.api.nvim_create_autocmd("BufWritePost", {
|
||||||
pattern = vim.fn.glob(
|
pattern = "chadrc.lua",
|
||||||
table.concat({
|
|
||||||
vim.fn.stdpath "config",
|
|
||||||
"lua",
|
|
||||||
"custom",
|
|
||||||
"**",
|
|
||||||
"*.lua",
|
|
||||||
}, sep),
|
|
||||||
true,
|
|
||||||
true,
|
|
||||||
true
|
|
||||||
),
|
|
||||||
|
|
||||||
group = vim.api.nvim_create_augroup("ReloadNvChad", {}),
|
group = vim.api.nvim_create_augroup("ReloadNvChad", {}),
|
||||||
|
|
||||||
callback = function(opts)
|
callback = function()
|
||||||
require("plenary.reload").reload_module "base46"
|
require("plenary.reload").reload_module "base46"
|
||||||
local file = string
|
local config = require("core.utils").load_config()
|
||||||
.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().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()
|
require("base46").load_all_highlights()
|
||||||
-- vim.cmd("redraw!")
|
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
-- n, v, i, t = mode names
|
-- n, v, i, t = mode names
|
||||||
|
|
||||||
local function termcodes(str)
|
|
||||||
return vim.api.nvim_replace_termcodes(str, true, true, true)
|
|
||||||
end
|
|
||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
M.general = {
|
M.general = {
|
||||||
@ -20,8 +16,6 @@ M.general = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
n = {
|
n = {
|
||||||
["<ESC>"] = { "<cmd> noh <CR>", "no highlight" },
|
|
||||||
|
|
||||||
-- switch between windows
|
-- switch between windows
|
||||||
["<C-h>"] = { "<C-w>h", "window left" },
|
["<C-h>"] = { "<C-w>h", "window left" },
|
||||||
["<C-l>"] = { "<C-w>l", "window right" },
|
["<C-l>"] = { "<C-w>l", "window right" },
|
||||||
@ -38,16 +32,6 @@ M.general = {
|
|||||||
["<leader>n"] = { "<cmd> set nu! <CR>", "toggle line number" },
|
["<leader>n"] = { "<cmd> set nu! <CR>", "toggle line number" },
|
||||||
["<leader>rn"] = { "<cmd> set rnu! <CR>", "toggle relative 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>
|
-- 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/
|
-- http://www.reddit.com/r/vim/comments/2k4cbr/problem_with_gj_and_gk/
|
||||||
-- empty mode is same as using <cmd> :map
|
-- empty mode is same as using <cmd> :map
|
||||||
@ -61,7 +45,9 @@ M.general = {
|
|||||||
["<leader>b"] = { "<cmd> enew <CR>", "new buffer" },
|
["<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 = {
|
v = {
|
||||||
["<Up>"] = { 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', "move up", opts = { expr = true } },
|
["<Up>"] = { 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', "move up", opts = { expr = true } },
|
||||||
@ -96,9 +82,6 @@ M.tabufline = {
|
|||||||
"goto prev buffer",
|
"goto prev buffer",
|
||||||
},
|
},
|
||||||
|
|
||||||
-- pick buffers via numbers
|
|
||||||
["<Bslash>"] = { "<cmd> TbufPick <CR>", "Pick buffer" },
|
|
||||||
|
|
||||||
-- close buffer + hide terminal buffer
|
-- close buffer + hide terminal buffer
|
||||||
["<leader>x"] = {
|
["<leader>x"] = {
|
||||||
function()
|
function()
|
||||||
|
@ -21,10 +21,7 @@ M.blankline = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
M.luasnip = function()
|
M.luasnip = function()
|
||||||
local options = {
|
local options = { history = true, updateevents = "TextChanged,TextChangedI" }
|
||||||
history = true,
|
|
||||||
updateevents = "TextChanged,TextChangedI",
|
|
||||||
}
|
|
||||||
|
|
||||||
require("luasnip").config.set_config(options)
|
require("luasnip").config.set_config(options)
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ local default_plugins = {
|
|||||||
if vim.v.shell_error == 0 then
|
if vim.v.shell_error == 0 then
|
||||||
vim.api.nvim_del_augroup_by_name "GitSignsLazyLoad"
|
vim.api.nvim_del_augroup_by_name "GitSignsLazyLoad"
|
||||||
vim.schedule(function()
|
vim.schedule(function()
|
||||||
require("lazy").load { plugins = "gitsigns.nvim" }
|
require("lazy").load { plugins = { "gitsigns.nvim" } }
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
Loading…
Reference in New Issue
Block a user