[nvchad] fix configuration

This commit is contained in:
2025-03-03 11:18:02 +07:00
parent 78ab401193
commit cc4fd91e74
15 changed files with 205 additions and 201 deletions

View File

@@ -7,5 +7,5 @@
## Install
Copy contents of this dir to `~/.config/nvim/lua/custom`.
Copy contents of this dir to `~/.config/nvim/lua/`.

View File

@@ -1,21 +1,19 @@
-- This file needs to have same structure as nvconfig.lua
-- https://github.com/NvChad/ui/blob/v3.0/lua/nvconfig.lua
-- Please read that file to know all available options :(
---@type ChadrcConfig
local M = {}
-- Path to overriding theme and highlights files
local highlights = require "custom.highlights"
local highlights = require "configs.highlights"
M.ui = {
theme = "one_light",
M.base46 = {
theme = "doomchad",
theme_toggle = { "one_light", "doomchad" },
transparency = true,
hl_override = highlights.override,
hl_add = highlights.add,
hl_override = highlights.override,
}
M.plugins = "custom.plugins"
-- check core.mappings for table structure
M.mappings = require "custom.mappings"
return M

View File

@@ -1,7 +1,4 @@
--type conform.options
local options = {
lsp_fallback = true,
formatters_by_ft = {
lua = { "stylua" },
@@ -11,15 +8,6 @@ local options = {
sh = { "shfmt" },
},
-- adding same formatter for multiple filetypes can look too much work for some
-- instead of the above code you could just use a loop! the config is just a table after all!
-- format_on_save = {
-- -- These options will be passed to conform.format()
-- timeout_ms = 500,
-- lsp_fallback = true,
-- },
}
require("conform").setup(options)
return options

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

@@ -1,13 +1,13 @@
local on_attach = require("plugins.configs.lspconfig").on_attach
local capabilities = require("plugins.configs.lspconfig").capabilities
-- load defaults i.e lua_lsp
require("nvchad.configs.lspconfig").defaults()
local lspconfig = require "lspconfig"
-- if you just want default config for the servers then put them in a table
local servers = {
-- front-end
"html",
"cssls",
"tsserver",
"ts_ls",
-- back-end
"gopls",
-- static files
@@ -17,11 +17,14 @@ local servers = {
"dockerls",
"docker_compose_language_service",
}
local nvlsp = require "nvchad.configs.lspconfig"
-- lsps with default config
for _, lsp in ipairs(servers) do
lspconfig[lsp].setup {
on_attach = on_attach,
capabilities = capabilities,
on_attach = nvlsp.on_attach,
on_init = nvlsp.on_init,
capabilities = nvlsp.capabilities,
}
end
@@ -29,5 +32,9 @@ lspconfig.intelephense.setup{
filetypes = { 'php', 'ctp' }
}
-- lspconfig.pyright.setup { blabla}
-- configuring single server, example: typescript
-- lspconfig.ts_ls.setup {
-- on_attach = nvlsp.on_attach,
-- on_init = nvlsp.on_init,
-- capabilities = nvlsp.capabilities,
-- }

View File

@@ -0,0 +1,30 @@
local config = {
ensure_installed = {
-- lua stuff
"lua-language-server",
"stylua",
-- web dev stuff
"css-lsp",
"html-lsp",
"typescript-language-server",
"deno",
"prettier",
"json-lsp",
"yaml-language-server",
-- c/cpp stuff
"clangd",
"clang-format",
-- golang stuff
"gopls",
"goimports",
-- php stuff
"intelephense",
-- docker
"docker-compose-language-service",
"dockerfile-language-server",
-- shell stuff
"shfmt",
},
}
return config

View File

@@ -0,0 +1,17 @@
local config = {
git = {
enable = true,
},
renderer = {
highlight_git = true,
icons = {
show = {
git = true,
},
},
},
}
return config

View File

@@ -1,71 +0,0 @@
local M = {}
M.treesitter = {
ensure_installed = {
"vim",
"vimdoc",
"lua",
"html",
"css",
"javascript",
"typescript",
"tsx",
"c",
"cmake",
"markdown",
"markdown_inline",
},
indent = {
enable = true,
-- disable = {
-- "python"
-- },
},
}
M.mason = {
ensure_installed = {
-- lua stuff
"lua-language-server",
"stylua",
-- web dev stuff
"css-lsp",
"html-lsp",
"typescript-language-server",
"deno",
"prettier",
"json-lsp",
"yaml-language-server",
-- c/cpp stuff
"clangd",
"clang-format",
-- golang stuff
"gopls",
"goimports",
-- php stuff
"intelephense",
-- docker
"docker-compose-language-service",
"dockerfile-language-server",
-- shell stuff
"shfmt",
},
}
-- git support in nvimtree
M.nvimtree = {
git = {
enable = true,
},
renderer = {
highlight_git = true,
icons = {
show = {
git = true,
},
},
},
}
return M

View File

@@ -0,0 +1,21 @@
local conf = {
ensure_installed = {
"vim",
"vimdoc",
"lua",
"html",
"css",
"javascript",
"typescript",
"tsx",
"c",
"cmake",
"markdown",
"markdown_inline",
},
indent = {
enable = true,
},
}
return conf

View File

@@ -1,8 +0,0 @@
-- local autocmd = vim.api.nvim_create_autocmd
-- Auto resize panes when resizing nvim window
-- autocmd("VimResized", {
-- pattern = "*",
-- command = "tabdo wincmd =",
-- })

View File

@@ -1,26 +1,19 @@
---@type MappingsTable
local M = {}
require "nvchad.mappings"
M.general = {
n = {
["<C-]>"] = {
function()
require("nvterm.terminal").toggle "vertical"
end,
},
},
v = {
[">"] = { ">gv", "indent" },
},
t = {
["<C-]>"] = {
function()
require("nvterm.terminal").toggle "vertical"
end,
},
},
}
-- add yours here
-- more keybinds!
local map = vim.keymap.set
-- Normal
map("n", ";", ":", { desc = "CMD enter command mode" })
map("n", "<C-]>", function() require("nvterm.terminal").toggle "vertical" end, { desc = "open terminal" })
-- Input
map("i", "jk", "<ESC>")
-- Visual
map("v", ">", ">gv", { desc = "indent" })
-- Terminal
map("t", "<C-]>", function() require("nvterm.terminal").toggle "vertical" end, { desc = "close terminal" })
return M

View File

@@ -0,0 +1,6 @@
require "nvchad.options"
-- add yours here!
-- local o = vim.o
-- o.cursorlineopt ='both' -- to enable cursorline!

View File

@@ -1,65 +0,0 @@
local overrides = require("custom.configs.overrides")
---@type NvPluginSpec[]
local plugins = {
-- Override plugin definition options
{
"neovim/nvim-lspconfig",
config = function()
require "plugins.configs.lspconfig"
require "custom.configs.lspconfig"
end, -- Override to setup mason-lspconfig
},
-- override plugin configs
{
"williamboman/mason.nvim",
opts = overrides.mason
},
{
"nvim-treesitter/nvim-treesitter",
opts = overrides.treesitter,
},
{
"nvim-tree/nvim-tree.lua",
opts = overrides.nvimtree,
},
-- Install a plugin
{
"max397574/better-escape.nvim",
event = "InsertEnter",
config = function()
require("better_escape").setup()
end,
},
{
"stevearc/conform.nvim",
-- for users those who want auto-save conform + lazyloading!
-- event = "BufWritePre"
config = function()
require "custom.configs.conform"
end,
},
-- To make a plugin not be loaded
-- {
-- "NvChad/nvim-colorizer.lua",
-- enabled = false
-- },
-- All NvChad plugins are lazy-loaded by default
-- For a plugin to be loaded, you will need to set either `ft`, `cmd`, `keys`, `event`, or set `lazy = false`
-- If you want a plugin to load on startup, add `lazy = false` to a plugin spec, for example
-- {
-- "mg979/vim-visual-multi",
-- lazy = false,
-- }
}
return plugins

View File

@@ -0,0 +1,41 @@
return {
{
"stevearc/conform.nvim",
opts = require "configs.conform",
},
{
"neovim/nvim-lspconfig",
config = function()
require "configs.lspconfig"
end,
},
{
"williamboman/mason.nvim",
opts = require "configs.mason",
},
{
"nvim-treesitter/nvim-treesitter",
opts = require "configs.treesitter",
},
{
"nvim-tree/nvim-tree.lua",
opts = require "configs.nvtree",
},
{
"max397574/better-escape.nvim",
event = "InsertEnter",
config = function()
require("better_escape").setup()
end,
},
{
"stevearc/conform.nvim",
opts = require "configs.conform"
},
{
"NvChad/nvterm",
config = function ()
require("nvterm").setup()
end,
},
}