Add json format

This commit is contained in:
lif
2025-11-17 20:20:58 +00:00
parent 249323d293
commit 59cb44b735
3 changed files with 85 additions and 5 deletions

View File

@@ -37,8 +37,8 @@ vim.opt.undodir = vim.fn.stdpath("cache") .. "/undo"
vim.opt.undofile = true
-- Tab stuff
vim.opt.tabstop = 4
vim.opt.shiftwidth = 4
vim.opt.tabstop = 8
vim.opt.shiftwidth = 8
vim.opt.expandtab = true
vim.opt.autoindent = true
@@ -150,7 +150,7 @@ require("Comment").setup()
-- NB: Make sure to add more from this list!
-- https://github.com/nvim-treesitter/nvim-treesitter/tree/master#supported-languages
require("nvim-treesitter.configs").setup({
ensure_installed = { "typescript", "python", "rust", "go", "bash", "lua" },
ensure_installed = { "typescript", "python", "rust", "go", "bash", "json", "lua" },
sync_install = false,
auto_install = true,
highlight = { enable = true },
@@ -166,11 +166,12 @@ vim.opt.foldlevel = 99
-- NB: Make sure to add more from this list!
-- https://github.com/neovim/nvim-lspconfig/blob/master/doc/configs.md
require("mason").setup()
require("mason-lspconfig").setup({ ensure_installed = { "gopls", "bashls", "stylua" } })
require("mason-lspconfig").setup({ ensure_installed = { "gopls", "bashls", "stylua", "jsonls" } })
require("conform").setup({
default_format_opts = { lsp_format = "fallback" }, -- Many languages can be formatted directly by their LSP
formatters_by_ft = { -- but some can't, so conform is for those ones
-- json = { "ixjson" },
sh = { "shfmt" },
bash = { "shfmt" },
lua = { "stylua" },
@@ -178,7 +179,7 @@ require("conform").setup({
javascriptreact = { "prettier" },
typescript = { "prettier" },
typescriptreact = { "prettier" },
json = { "prettier" },
-- json = { "prettier" },
html = { "prettier" },
css = { "prettier" },
},