put all core stuff in core.init only
This commit is contained in:
parent
1d04d70417
commit
dab9171e64
1
init.lua
1
init.lua
@ -1,5 +1,4 @@
|
||||
require "core"
|
||||
require "core.options"
|
||||
|
||||
local custom_init_path = vim.api.nvim_get_runtime_file("lua/custom/init.lua", false)[1]
|
||||
|
||||
|
@ -78,6 +78,6 @@ M.plugins = "" -- path i.e "custom.plugins" -> custom/plugins.lua only and not c
|
||||
M.lazy_nvim = {} -- config for lazy.nvim startup options
|
||||
|
||||
-- these are default mappings, check core.mappings for table structure
|
||||
M.mappings = require "core.mappings"
|
||||
M.mappings = {}
|
||||
|
||||
return M
|
||||
|
@ -1,14 +1,66 @@
|
||||
local opt = vim.opt
|
||||
local g = vim.g
|
||||
local config = require("core.utils").load_config()
|
||||
|
||||
-------------------------------------- globals -----------------------------------------
|
||||
g.nvchad_theme = config.ui.theme
|
||||
g.base46_cache = vim.fn.stdpath "cache" .. "/nvchad/base46/"
|
||||
g.toggle_theme_icon = " "
|
||||
g.transparency = config.ui.transparency
|
||||
|
||||
-------------------------------------- options ------------------------------------------
|
||||
opt.laststatus = 3 -- global statusline
|
||||
opt.showmode = false
|
||||
|
||||
opt.clipboard = "unnamedplus"
|
||||
opt.cursorline = true
|
||||
|
||||
-- Indenting
|
||||
opt.expandtab = true
|
||||
opt.shiftwidth = 2
|
||||
opt.smartindent = true
|
||||
opt.tabstop = 2
|
||||
opt.softtabstop = 2
|
||||
|
||||
opt.fillchars = { eob = " " }
|
||||
opt.ignorecase = true
|
||||
opt.smartcase = true
|
||||
opt.mouse = "a"
|
||||
|
||||
-- Numbers
|
||||
opt.number = true
|
||||
opt.numberwidth = 2
|
||||
opt.ruler = false
|
||||
|
||||
-- disable nvim intro
|
||||
opt.shortmess:append "sI"
|
||||
|
||||
opt.signcolumn = "yes"
|
||||
opt.splitbelow = true
|
||||
opt.splitright = true
|
||||
opt.termguicolors = true
|
||||
opt.timeoutlen = 400
|
||||
opt.undofile = true
|
||||
|
||||
-- interval for writing swap file to disk, also used by gitsigns
|
||||
opt.updatetime = 250
|
||||
|
||||
-- go to previous/next line with h,l,left arrow and right arrow
|
||||
-- when cursor reaches end/beginning of line
|
||||
opt.whichwrap:append "<>[]hl"
|
||||
|
||||
g.mapleader = " "
|
||||
|
||||
-- disable some default providers
|
||||
for _, provider in ipairs { "node", "perl", "python3", "ruby" } do
|
||||
vim.g["loaded_" .. provider .. "_provider"] = 0
|
||||
end
|
||||
|
||||
-- add binaries installed by mason.nvim to path
|
||||
local is_windows = vim.loop.os_uname().sysname == "Windows_NT"
|
||||
vim.env.PATH = vim.env.PATH .. (is_windows and ";" or ":") .. vim.fn.stdpath "data" .. "/mason/bin"
|
||||
|
||||
local new_cmd = vim.api.nvim_create_user_command
|
||||
|
||||
new_cmd("NvChadUpdate", function()
|
||||
require "nvchad.update"()
|
||||
end, {})
|
||||
|
||||
-- autocmds
|
||||
-------------------------------------- autocmds ------------------------------------------
|
||||
local autocmd = vim.api.nvim_create_autocmd
|
||||
|
||||
-- dont list quickfix buffers
|
||||
@ -19,13 +71,12 @@ autocmd("FileType", {
|
||||
end,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("BufWritePost", {
|
||||
autocmd("BufWritePost", {
|
||||
pattern = "chadrc.lua",
|
||||
group = vim.api.nvim_create_augroup("ReloadNvChad", {}),
|
||||
|
||||
callback = function()
|
||||
require("plenary.reload").reload_module "base46"
|
||||
local config = require("core.utils").load_config()
|
||||
|
||||
vim.opt.statusline = "%!v:lua.require('nvchad_ui.statusline." .. config.ui.statusline.theme .. "').run()"
|
||||
vim.g.nvchad_theme = config.ui.theme
|
||||
@ -38,3 +89,10 @@ vim.api.nvim_create_autocmd("BufWritePost", {
|
||||
require("base46").load_all_highlights()
|
||||
end,
|
||||
})
|
||||
|
||||
-------------------------------------- commands ------------------------------------------
|
||||
local new_cmd = vim.api.nvim_create_user_command
|
||||
|
||||
new_cmd("NvChadUpdate", function()
|
||||
require "nvchad.update"()
|
||||
end, {})
|
||||
|
@ -1,55 +0,0 @@
|
||||
local opt = vim.opt
|
||||
local g = vim.g
|
||||
local config = require("core.utils").load_config()
|
||||
|
||||
g.nvchad_theme = config.ui.theme
|
||||
g.base46_cache = vim.fn.stdpath "cache" .. "/nvchad/base46/"
|
||||
g.toggle_theme_icon = " "
|
||||
g.transparency = config.ui.transparency
|
||||
|
||||
opt.laststatus = 3 -- global statusline
|
||||
opt.showmode = false
|
||||
|
||||
opt.clipboard = "unnamedplus"
|
||||
opt.cursorline = true
|
||||
|
||||
-- Indenting
|
||||
opt.expandtab = true
|
||||
opt.shiftwidth = 2
|
||||
opt.smartindent = true
|
||||
opt.tabstop = 2
|
||||
opt.softtabstop = 2
|
||||
|
||||
opt.fillchars = { eob = " " }
|
||||
opt.ignorecase = true
|
||||
opt.smartcase = true
|
||||
opt.mouse = "a"
|
||||
|
||||
-- Numbers
|
||||
opt.number = true
|
||||
opt.numberwidth = 2
|
||||
opt.ruler = false
|
||||
|
||||
-- disable nvim intro
|
||||
opt.shortmess:append "sI"
|
||||
|
||||
opt.signcolumn = "yes"
|
||||
opt.splitbelow = true
|
||||
opt.splitright = true
|
||||
opt.termguicolors = true
|
||||
opt.timeoutlen = 400
|
||||
opt.undofile = true
|
||||
|
||||
-- interval for writing swap file to disk, also used by gitsigns
|
||||
opt.updatetime = 250
|
||||
|
||||
-- go to previous/next line with h,l,left arrow and right arrow
|
||||
-- when cursor reaches end/beginning of line
|
||||
opt.whichwrap:append "<>[]hl"
|
||||
|
||||
g.mapleader = " "
|
||||
|
||||
-- disable some default providers
|
||||
for _, provider in ipairs { "node", "perl", "python3", "ruby" } do
|
||||
vim.g["loaded_" .. provider .. "_provider"] = 0
|
||||
end
|
@ -8,7 +8,7 @@ M.load_config = function()
|
||||
if chadrc_path then
|
||||
local chadrc = dofile(chadrc_path)
|
||||
|
||||
config.mappings = M.remove_disabled_keys(chadrc.mappings, config.mappings)
|
||||
config.mappings = M.remove_disabled_keys(chadrc.mappings, require "core.mappings")
|
||||
config = merge_tb("force", config, chadrc)
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user