nvim/init.lua
2024-12-20 19:56:21 -05:00

90 lines
2.4 KiB
Lua

-- Begin NvChad setup
vim.g.base46_cache = vim.fn.stdpath "data" .. "/nvchad/base46/"
vim.g.mapleader = " "
-- bootstrap lazy and all plugins
local lazypath = vim.fn.stdpath "data" .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
local repo = "https://github.com/folke/lazy.nvim.git"
vim.fn.system { "git", "clone", "--filter=blob:none", repo, "--branch=stable", lazypath }
end
vim.opt.rtp:prepend(lazypath)
local lazy_config = require "configs.lazy"
-- load plugins
require("lazy").setup({
{
"NvChad/NvChad",
lazy = false,
branch = "v2.5",
import = "nvchad.plugins",
config = function()
require "options"
end,
},
{ import = "plugins" },
}, lazy_config)
-- load theme
dofile(vim.g.base46_cache .. "defaults")
dofile(vim.g.base46_cache .. "statusline")
require "nvchad.autocmds"
vim.schedule(function()
local mappings = require "mappings"
mappings.General()
end)
-- end NvChad setup
local autocmd = vim.api.nvim_create_autocmd
-- Auto resize panes when resizing nvim window
autocmd("VimResized", {
pattern = "*",
command = "tabdo wincmd =",
})
-- Set default shell to pwsh on windows
if vim.loop.os_uname() == "win32" then
vim.opt.shell = vim.fn.executable "pwsh" == 1 and "pwsh" or "powershell"
vim.opt.shellcmdflag =
"-NoLogo -NoProfile -ExecutionPolicy RemoteSigned -Command [Console]::InputEncoding=[Console]::OutputEncoding=[System.Text.Encoding]::UTF8;"
vim.opt.shellredir = "-RedirectStandardOutput %s -NoNewWindow -Wait"
vim.opt.shellpipe = "2>&1 | Out-File -Encoding UTF8 %s; exit $LastExitCode"
vim.opt.shellquote = ""
vim.opt.shellxquote = ""
else
-- vim.opt.shell = env.SHELL
end
vim.opt.relativenumber = true
vim.opt.cursorline = true
vim.g.copilot_assume_mapped = true
-- ufo config
vim.o.foldcolumn = "0" -- '0' is not bad
vim.o.foldlevel = 99 -- Using ufo provider need a large value, feel free to decrease the value
vim.o.foldlevelstart = 99
-- vim.o.foldenable = true
vim.opt.wildmode = { "list:longest", "list:full" }
vim.opt.wildmenu = true
vim.opt.autoread = true
vim.o.clipboard = "unnamed,unnamedplus"
vim.g.clipboard = {
name = "OSC 52",
copy = {
["+"] = require("vim.ui.clipboard.osc52").copy "+",
["*"] = require("vim.ui.clipboard.osc52").copy "*",
},
paste = {
["+"] = require("vim.ui.clipboard.osc52").paste "+",
["*"] = require("vim.ui.clipboard.osc52").paste "*",
},
}
if vim.g.neovide then
vim.o.guifont = "MonaspiceNe Nerd Font:h12"
end