update nvchad to 2.5.0

This commit is contained in:
2024-03-10 20:56:39 +05:30
parent c8c9d2424d
commit 2c25b8ba1c
16 changed files with 153 additions and 120 deletions

View File

@ -0,0 +1,19 @@
local M = {}
M.ui = {
theme = "poimandres",
transparency = true,
nvdash = {
load_on_startup = true,
header = {
"|------------------------|",
"| NOBODY FUX WITH TUX |",
"|------------------------|",
" \\ (•◡•) / ",
" \\ / ",
},
},
}
return M

View File

@ -0,0 +1,27 @@
local prettier = { "prettierd", "prettier" }
local options = {
lsp_fallback = true,
formatters_by_ft = {
lua = { "stylua" },
javascript = { prettier },
typescript = { prettier },
javascriptreact = { prettier },
typescriptreact = { prettier },
json = { prettier },
jsonc = { prettier },
css = { prettier },
html = { prettier },
markdown = { prettier },
nix = { "alejandra" },
},
format_on_save = {
lsp_fallback = true,
async = false,
timeout_ms = 1000,
},
}
require("conform").setup(options)

View File

@ -0,0 +1,10 @@
local opts = {
model = "deepseek-coder:6.7b",
display_mode = "float",
show_prompt = true,
show_model = true,
no_auto_close = false,
debug = false,
}
return opts

View File

@ -0,0 +1,47 @@
return {
defaults = { lazy = true },
install = { colorscheme = { "nvchad" } },
ui = {
icons = {
ft = "",
lazy = "󰂠 ",
loaded = "",
not_loaded = "",
},
},
performance = {
rtp = {
disabled_plugins = {
"2html_plugin",
"tohtml",
"getscript",
"getscriptPlugin",
"gzip",
"logipat",
"netrw",
"netrwPlugin",
"netrwSettings",
"netrwFileHandlers",
"matchit",
"tar",
"tarPlugin",
"rrhelper",
"spellfile_plugin",
"vimball",
"vimballPlugin",
"zip",
"zipPlugin",
"tutor",
"rplugin",
"syntax",
"synmenu",
"optwin",
"compiler",
"bugreport",
"ftplugin",
},
},
},
}

View File

@ -0,0 +1,36 @@
local configs = require("nvchad.configs.lspconfig")
local on_attach = configs.on_attach
local capabilities = configs.capabilities
local lspconfig = require("lspconfig")
local servers = { "tsserver", "tailwindcss", "eslint" }
local function organize_imports()
local params = {
command = "_typescript.organizeImports",
arguments = { vim.api.nvim_buf_get_name(0) },
title = "",
}
vim.lsp.buf.execute_command(params)
end
for _, lsp in ipairs(servers) do
if lsp == "tsserver" then
lspconfig[lsp].setup({
on_attach = on_attach,
capabilities = capabilities,
commands = {
OrganizeImports = {
organize_imports,
description = "Organize Imports",
},
},
})
else
lspconfig[lsp].setup({
on_attach = on_attach,
capabilities = capabilities,
})
end
end

View File

@ -0,0 +1,16 @@
local opts = {
lsp = {
override = {
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
["vim.lsp.util.stylize_markdown"] = true,
["cmp.entry.get_documentation"] = true,
},
},
presets = {
long_message_to_split = true, -- long messages will be sent to a split
inc_rename = false, -- enables an input dialog for inc-rename.nvim
lsp_doc_border = false, -- add a border to hover docs and signature help
},
}
return opts

View File

@ -0,0 +1,33 @@
local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
local null_ls = require("null-ls")
local b = null_ls.builtins
local opts = {
sources = {
b.formatting.prettierd,
b.formatting.stylua,
-- nix
b.code_actions.statix,
b.formatting.alejandra,
b.diagnostics.deadnix,
},
on_attach = function(client, bufnr)
if client.supports_method("textDocument/formatting") then
vim.api.nvim_clear_autocmds({
group = augroup,
buffer = bufnr,
})
vim.api.nvim_create_autocmd("BufWritePre", {
group = augroup,
buffer = bufnr,
callback = function()
vim.lsp.buf.format({ bufnr = bufnr })
end,
})
end
end,
}
return opts

View File

@ -0,0 +1,21 @@
-- Doesn't work
local lint = require("lint")
lint.linters_by_ft = {
lua = { "luacheck" },
javascript = { "eslint_d" },
typescript = { "eslint_d" },
javascriptreact = { "eslint_d" },
typescriptreact = { { "eslint_d" } },
nix = { "statix" },
}
local lint_augroup = vim.api.nvim_create_augroup("lint", { clear = true })
vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave" }, {
group = lint_augroup,
callback = function()
lint.try_lint()
end,
})

View File

@ -0,0 +1,49 @@
local M = {}
M.treesitter = {
ensure_installed = {
-- defaults
"vim",
"lua",
-- web dev
"html",
"css",
"javascript",
"typescript",
"tsx",
-- nix
"nix",
},
}
M.mason = {
ensure_installed = {
-- defaults
"lua-language-server",
"stylua",
"luacheck",
-- web dev
"css-lsp",
"html-lsp",
"prettierd",
"eslint-lsp",
"eslint_d",
"typescript-language-server",
"tailwindcss-language-server",
-- nix
"nil",
},
}
M.telescope = {
defaults = {
winblend = 40,
pumblend = 40,
},
}
return M

View File

@ -0,0 +1,42 @@
require("nvchad.mappings")
local map = vim.keymap.set
local g = vim.g
local float_opts = {
relative = "editor",
row = 0.13,
col = 0.14,
width = 0.7,
height = 0.7,
border = "single",
}
local toggleTerm = function()
require("nvchad.term").toggle({ pos = "float", id = "float", float_opts = float_opts })
end
local toggleLazygit = function()
require("nvchad.term").toggle({ pos = "float", id = "lazygit", float_opts = float_opts, cmd = "lazygit" })
end
local zoomInNeovide = function()
g.neovide_scale_factor = g.neovide_scale_factor + 0.1
end
local zoomOutNeovide = function()
g.neovide_scale_factor = g.neovide_scale_factor - 0.1
end
map({ "n", "t" }, "<F7>", toggleTerm, { desc = "Toggle Floating Terminal" })
map({ "n", "t" }, "<F8>", toggleLazygit, { desc = "Toggle Lazygit" })
map("n", "<leader>Sl", "<cmd>SessionManager! load_last_session<cr>", { desc = "Load last session" })
map("n", "<leader>Ss", "<cmd>SessionManager! save_current_session<cr>", { desc = "Save this session" })
map("n", "<leader>Sd", "<cmd>SessionManager! delete_session<cr>", { desc = "Delete session" })
map("n", "<leader>Sf", "<cmd>SessionManager! load_session<cr>", { desc = "Search sessions" })
map("n", "<leader>S.", "<cmd>SessionManager! load_current_dir_session<cr>", { desc = "Load current directory session" })
if g.neovide then
map("n", "<C-=>", zoomInNeovide, { desc = "Zoom In (Neovide)" })
map("n", "<C-->", zoomOutNeovide, { desc = "Zoom Out (Neovide)" })
end

View File

@ -0,0 +1,13 @@
require "nvchad.options"
local opt = vim.opt
local g = vim.g
opt.relativenumber = true
opt.scrolloff = 5
opt.guifont = "FiraCode Nerd Font:h12"
-- neovide stuff
g.neovide_scale_factor = 0.7
-- g.neovide_transparency = 0.8

View File

@ -0,0 +1,72 @@
local overrides = require("configs.overrides")
local plugins = {
{
"stevearc/conform.nvim",
config = function()
require "configs.conform"
end,
},
{
"nvim-treesitter/nvim-treesitter",
opts = overrides.treesitter,
},
{
"williamboman/mason.nvim",
opts = overrides.mason,
},
{
"David-Kunz/gen.nvim",
lazy = false,
opts = function()
return require("configs.gen")
end,
},
{
"Shatur/neovim-session-manager",
dependencies = {
"nvim-lua/plenary.nvim",
"stevearc/dressing.nvim",
},
event = "BufWritePost",
cmd = "SessionManager",
},
{
"folke/noice.nvim",
event = "VeryLazy",
dependencies = {
"MunifTanjim/nui.nvim",
"rcarriga/nvim-notify",
},
opts = function()
return require("configs.noice")
end,
},
{
"neovim/nvim-lspconfig",
config = function()
require("nvchad.configs.lspconfig").defaults()
require("configs.lspconfig")
end,
},
{
"nvimtools/none-ls.nvim",
event = "VeryLazy",
opts = function()
return require("configs.null-ls")
end,
},
{
"windwp/nvim-ts-autotag",
ft = { "javascript", "javascriptreact", "typescript", "typescriptreact" },
config = function()
require("nvim-ts-autotag").setup()
end,
},
{
"wakatime/vim-wakatime",
lazy = false,
},
}
return plugins