2023-03-09 12:37:58 +00:00
|
|
|
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
|
|
|
|
|
2022-07-25 13:49:33 +00:00
|
|
|
-- add binaries installed by mason.nvim to path
|
2022-07-26 07:22:16 +00:00
|
|
|
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"
|
2022-07-25 13:49:33 +00:00
|
|
|
|
2023-03-09 12:37:58 +00:00
|
|
|
-------------------------------------- autocmds ------------------------------------------
|
2022-05-23 07:24:03 +00:00
|
|
|
local autocmd = vim.api.nvim_create_autocmd
|
|
|
|
|
2022-07-08 13:50:57 +00:00
|
|
|
-- dont list quickfix buffers
|
|
|
|
autocmd("FileType", {
|
2022-07-22 16:00:00 +00:00
|
|
|
pattern = "qf",
|
|
|
|
callback = function()
|
|
|
|
vim.opt_local.buflisted = false
|
|
|
|
end,
|
2022-07-08 13:50:57 +00:00
|
|
|
})
|
2023-02-14 05:42:31 +00:00
|
|
|
|
2023-03-09 12:37:58 +00:00
|
|
|
autocmd("BufWritePost", {
|
2023-03-08 13:27:54 +00:00
|
|
|
pattern = "chadrc.lua",
|
2023-02-15 12:07:10 +00:00
|
|
|
group = vim.api.nvim_create_augroup("ReloadNvChad", {}),
|
|
|
|
|
2023-03-08 13:27:54 +00:00
|
|
|
callback = function()
|
2023-02-15 12:07:10 +00:00
|
|
|
require("plenary.reload").reload_module "base46"
|
|
|
|
|
2023-03-08 13:27:54 +00:00
|
|
|
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
|
2023-02-15 12:07:10 +00:00
|
|
|
|
2023-03-08 13:27:54 +00:00
|
|
|
-- reload cmp stuff
|
|
|
|
require("plenary.reload").reload_module "plugins.configs.cmp"
|
|
|
|
require("cmp").setup(require "plugins.configs.cmp")
|
2023-02-14 05:42:31 +00:00
|
|
|
|
2023-02-15 12:07:10 +00:00
|
|
|
require("base46").load_all_highlights()
|
2023-02-14 05:42:31 +00:00
|
|
|
end,
|
|
|
|
})
|
2023-03-09 12:37:58 +00:00
|
|
|
|
|
|
|
-------------------------------------- commands ------------------------------------------
|
|
|
|
local new_cmd = vim.api.nvim_create_user_command
|
|
|
|
|
|
|
|
new_cmd("NvChadUpdate", function()
|
|
|
|
require "nvchad.update"()
|
|
|
|
end, {})
|