repalce astrovim with nvchad

This commit is contained in:
2024-03-01 18:33:09 +05:30
parent 873d67fb40
commit b404c2b66f
11 changed files with 305 additions and 40 deletions

View File

@ -0,0 +1,21 @@
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" },
},
}
require("conform").setup(options)

View File

@ -0,0 +1,32 @@
local configs = require "plugins.configs.lspconfig"
local on_attach = configs.on_attach
local capabilities = configs.capabilities
local lspconfig = require "lspconfig"
-- local util = require "lspconfig/util"
local servers = { "tsserver", "tailwindcss", "eslint" }
for _, lsp in ipairs(servers) do
lspconfig[lsp].setup {
on_attach = on_attach,
capabilities = capabilities,
}
end
-- lspconfig.gopls.setup {
-- on_attach = on_attach,
-- capabilities = capabilities,
-- cmd = { "gopls" },
-- filetypes = { "go", "gomod", "gowork", "gotmpl" },
-- root_dir = util.root_pattern("go.work", "go.mod", ".git"),
-- settings = {
-- gopls = {
-- completeUnimported = true,
-- usePlaceholders = true,
-- analyses = {
-- unusedparams = true,
-- },
-- },
-- },
-- }

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,57 @@
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",
-- web dev
"css-lsp",
"html-lsp",
"prettierd",
"eslint-lsp",
"typescript-language-server",
"tailwindcss-language-server",
-- nix
"nil",
},
}
M.nvterm = {
terminals = {
shell = vim.o.shell,
list = {},
type_opts = {
float = {
relative = "editor",
row = 0.23,
col = 0.15,
width = 0.7,
height = 0.5,
border = "single",
},
},
},
}
return M