mirror of
https://github.com/tuxdotrs/tawm.git
synced 2025-07-06 04:56:34 +05:30
update nvchad to 2.5.0
This commit is contained in:
39
pkgs/nvchad/nvim/init.lua
Normal file
39
pkgs/nvchad/nvim/init.lua
Normal file
@ -0,0 +1,39 @@
|
||||
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()
|
||||
require("mappings")
|
||||
end)
|
19
pkgs/nvchad/nvim/lua/chadrc.lua
Normal file
19
pkgs/nvchad/nvim/lua/chadrc.lua
Normal 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
|
27
pkgs/nvchad/nvim/lua/configs/conform.lua
Normal file
27
pkgs/nvchad/nvim/lua/configs/conform.lua
Normal 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)
|
10
pkgs/nvchad/nvim/lua/configs/gen.lua
Normal file
10
pkgs/nvchad/nvim/lua/configs/gen.lua
Normal 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
|
47
pkgs/nvchad/nvim/lua/configs/lazy.lua
Normal file
47
pkgs/nvchad/nvim/lua/configs/lazy.lua
Normal 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",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
36
pkgs/nvchad/nvim/lua/configs/lspconfig.lua
Normal file
36
pkgs/nvchad/nvim/lua/configs/lspconfig.lua
Normal 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
|
16
pkgs/nvchad/nvim/lua/configs/noice.lua
Normal file
16
pkgs/nvchad/nvim/lua/configs/noice.lua
Normal 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
|
33
pkgs/nvchad/nvim/lua/configs/null-ls.lua
Normal file
33
pkgs/nvchad/nvim/lua/configs/null-ls.lua
Normal 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
|
21
pkgs/nvchad/nvim/lua/configs/nvim-lint.lua
Normal file
21
pkgs/nvchad/nvim/lua/configs/nvim-lint.lua
Normal 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,
|
||||
})
|
49
pkgs/nvchad/nvim/lua/configs/overrides.lua
Normal file
49
pkgs/nvchad/nvim/lua/configs/overrides.lua
Normal 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
|
42
pkgs/nvchad/nvim/lua/mappings.lua
Normal file
42
pkgs/nvchad/nvim/lua/mappings.lua
Normal 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
|
13
pkgs/nvchad/nvim/lua/options.lua
Normal file
13
pkgs/nvchad/nvim/lua/options.lua
Normal 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
|
||||
|
72
pkgs/nvchad/nvim/lua/plugins/init.lua
Normal file
72
pkgs/nvchad/nvim/lua/plugins/init.lua
Normal 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
|
Reference in New Issue
Block a user