Files
nvim/init.lua
T
2025-02-22 06:53:14 -06:00

68 lines
1.6 KiB
Lua

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 plugins' setup
require("todo-comments").setup({})
-- load theme
dofile(vim.g.base46_cache .. "defaults")
dofile(vim.g.base46_cache .. "statusline")
require "nvchad.autocmds"
-- shell
vim.opt.shell = "/bin/fish"
-- Disable inline diagnostics (virtual text)
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
vim.lsp.diagnostic.on_publish_diagnostics, {
virtual_text = false,
}
)
-- Function to show diagnostics in a floating window on hover
local function show_diagnostics_on_hover()
local opts = {
focusable = false,
close_events = { "BufLeave", "CursorMoved", "InsertEnter", "FocusLost" },
border = 'rounded',
source = 'always',
prefix = ' ',
}
vim.api.nvim_command('autocmd CursorHold * lua vim.diagnostic.open_float(nil, ' .. vim.inspect(opts) .. ')')
end
-- Call the function to set up the autocmd
show_diagnostics_on_hover()
vim.schedule(function()
require "mappings"
end)