Changed: Neovim

This commit is contained in:
2025-04-10 11:33:28 +02:00
parent f9aba98533
commit 4bb72ea758
23 changed files with 440 additions and 7 deletions

View File

@@ -0,0 +1,24 @@
-- 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 = {}
M.base46 = {
theme = "radium",
-- hl_override = {
-- Comment = { italic = true },
-- ["@comment"] = { italic = true },
-- },
}
-- M.nvdash = { load_on_startup = true }
-- M.ui = {
-- tabufline = {
-- lazyload = false
-- }
--}
return M

View File

@@ -0,0 +1,15 @@
local options = {
formatters_by_ft = {
lua = { "stylua" },
-- css = { "prettier" },
-- html = { "prettier" },
},
format_on_save = {
-- These options will be passed to conform.format()
timeout_ms = 500,
lsp_fallback = true,
},
}
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

@@ -0,0 +1,21 @@
local lint = require("lint")
lint.linters_by_ft = {
lua = { "luacheck" },
}
lint.linters.luacheck.args = {
"--globals",
"vim",
"--formatter",
"plain",
"--codes",
"--ranges",
"-",
}
vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave" }, {
callback = function()
lint.try_lint()
end,
})

View File

@@ -0,0 +1,57 @@
-- load defaults i.e lua_lsp
local on_attach = require("nvchad.configs.lspconfig").on_attach
local on_init = require("nvchad.configs.lspconfig").on_init
local capabilities = require("nvchad.configs.lspconfig").capabilities
local lspconfig = require("lspconfig")
-- List of all servers configured
lspconfig.servers = {
"lua_ls",
"templ",
"jedi_language_server",
-- "gopls",
}
-- List of servers configured with default config
local default_servers = {
"templ",
-- "gopls",
"jedi_language_server",
}
-- lsps with default config
for _, lsp in ipairs(default_servers) do
lspconfig[lsp].setup({
on_attach = on_attach,
on_init = on_init,
capabilities = capabilities,
})
end
-- Lua LSP
lspconfig.lua_ls.setup({
on_attach = on_attach,
on_init = on_init,
capabilities = capabilities,
settings = {
Lua = {
diagnostics = {
enable = false, -- Disable all diagnostics from lua_ls
-- globals = { "vim" }
},
workspace = {
library = {
vim.fn.expand("$VIMRUNTIME/lua"),
vim.fn.expand("$VIMRUNTIME/lua/vim/lsp"),
vim.fn.stdpath("data") .. "/lazy/ui/nvchad_types",
vim.fn.stdpath("data") .. "/lazy/lazy.nvim/lua/lazy",
--"${3rd}/love2d/library",
},
maxPreload = 100000,
preloadFileSize = 10000,
},
},
},
})

View File

@@ -0,0 +1,4 @@
require("mason-conform").setup({
-- List of formatters to ignore during install
ignore_install = {},
})

View File

@@ -0,0 +1,26 @@
local lint = package.loaded["lint"]
local ignore_install = {}
local function table_contains(table, value)
for _, v in ipairs(table) do
if v == value then
return true
end
end
return false
end
local all_linters = {}
for _, v in pairs(lint.linters_by_ft) do
for _, linter in ipairs(v) do
if not table_contains(ignore_install, linter) then
table.insert(all_linters, linter)
end
end
end
require("mason-nvim-lint").setup({
ensure_installed = all_linters,
automatic_installation = false,
})

View File

@@ -0,0 +1,24 @@
local lspconfig = package.loaded["lspconfig"]
local ignore_install = {}
local function table_contains(table, value)
for _, v in ipairs(table) do
if v == value then
return true
end
end
return false
end
local all_servers = {}
for _, s in ipairs(lspconfig.servers) do
if not table_contains(ignore_install, s) then
table.insert(all_servers, s)
end
end
require("mason-lspconfig").setup({
ensure_installed = all_servers,
automatic_installation = false,
})

View File

@@ -0,0 +1,26 @@
local options = {
ensure_installed = {
"bash",
"fish",
"lua",
"luadoc",
"markdown",
"printf",
"toml",
"vim",
"vimdoc",
"yaml",
-- Languages
"python",
"templ",
},
highlight = {
enable = true,
use_languagetree = true,
},
indent = { enable = true },
}
require("nvim-treesitter.configs").setup(options)

View File

@@ -0,0 +1,10 @@
require "nvchad.mappings"
-- add yours here
local map = vim.keymap.set
map("n", ";", ":", { desc = "CMD enter command mode" })
map("i", "jk", "<ESC>")
-- map({ "n", "i", "v" }, "<C-s>", "<cmd> w <cr>")

View File

@@ -0,0 +1,7 @@
require("nvchad.options")
-- add yours here!
local o = vim.o
o.shiftwidth = 4
o.tabstop = 4
o.softtabstop = 4

View File

@@ -0,0 +1,70 @@
return {
{
"nvim-treesitter/nvim-treesitter",
event = { "BufReadPre", "BufNewFile" },
config = function()
require("configs.treesitter")
end,
},
{
"mfussenegger/nvim-lint",
event = { "BufReadPre", "BufNewFile" },
config = function()
require("configs.lint")
end,
},
-- {
-- "rshkarin/mason-nvim-lint",
-- event = "VeryLazy",
-- config = function()
-- require("config.mason-lint")
-- end,
-- },
{
"stevearc/conform.nvim",
event = "BufWritePre", -- uncomment for format on save
opts = require("configs.conform"),
},
{
"zapling/mason-conform.nvim",
event = "VeryLazy",
dependencies = { "conform.nvim" },
config = function()
require("configs.mason-conform")
end,
},
{
"neovim/nvim-lspconfig",
event = { "BufReadPre", "BufNewFile" },
config = function()
require("nvchad.configs.lspconfig").defaults()
require("configs.lspconfig")
end,
},
{
"williamboman/mason-lspconfig.nvim",
event = "VeryLazy",
dependencies = { "nvim-lspconfig" },
config = function()
require("configs.mason-lspconfig")
end,
},
{
"salkin-mada/openscad.nvim",
config = function()
vim.g.openscad_load_snippets = true
vim.g.openscad_default_mappings = true
vim.g.openscad_auto_open = true
require("openscad")
end,
dependencies = { "L3MON4D3/LuaSnip", "junegunn/fzf.vim" },
},
}