From 62a3a13e0a3dc5fdb3f85b4b7ddb8ab0b97c8b52 Mon Sep 17 00:00:00 2001 From: Thomas Schmucker Date: Tue, 8 Sep 2026 15:07:39 +0200 Subject: Einfacheres JSON(c)-Handling --- nvim/ftplugin/json.lua | 8 +++++--- nvim/ftplugin/jsonc.lua | 8 +++----- nvim/lua/config/filetypes.lua | 3 --- nvim/lua/config/treesitter.lua | 2 +- 4 files changed, 9 insertions(+), 12 deletions(-) diff --git a/nvim/ftplugin/json.lua b/nvim/ftplugin/json.lua index 341b728..a6321ff 100644 --- a/nvim/ftplugin/json.lua +++ b/nvim/ftplugin/json.lua @@ -1,3 +1,5 @@ --- Standard-Dateityp für .json-Dateien ist "jsonc" (siehe lua/config/filetypes.lua). --- Buffer, deren Dateityp explizit "json" ist, erben dieselben Einstellungen. -vim.cmd.runtime("ftplugin/jsonc.lua") +local opt = vim.opt_local + +opt.expandtab = true +opt.shiftwidth = 2 +opt.tabstop = 2 diff --git a/nvim/ftplugin/jsonc.lua b/nvim/ftplugin/jsonc.lua index a6321ff..4c9fd66 100644 --- a/nvim/ftplugin/jsonc.lua +++ b/nvim/ftplugin/jsonc.lua @@ -1,5 +1,3 @@ -local opt = vim.opt_local - -opt.expandtab = true -opt.shiftwidth = 2 -opt.tabstop = 2 +-- jsonc entsteht nicht durch Dateityp-Erkennung, sondern nur wenn es explizit +-- gesetzt wird (z.B. per Modeline). Die Einstellungen sind dieselben wie fuer json. +vim.cmd.runtime("ftplugin/json.lua") diff --git a/nvim/lua/config/filetypes.lua b/nvim/lua/config/filetypes.lua index f95307f..1b85053 100644 --- a/nvim/lua/config/filetypes.lua +++ b/nvim/lua/config/filetypes.lua @@ -4,8 +4,5 @@ vim.filetype.add({ extension = { j2 = "jinja", - -- .json als jsonc behandeln, damit Kommentare erlaubt sind (jsonls meldet - -- sie dann nicht als Fehler). - json = "jsonc", }, }) diff --git a/nvim/lua/config/treesitter.lua b/nvim/lua/config/treesitter.lua index 9483653..df03ef2 100644 --- a/nvim/lua/config/treesitter.lua +++ b/nvim/lua/config/treesitter.lua @@ -10,7 +10,7 @@ M.languages = { -- "jinja", -- "jinja_inline", "jq", - "json", -- deckt auch den Dateityp jsonc ab (siehe lua/config/filetypes.lua) + "json", -- deckt auch den Dateityp jsonc ab (siehe extra_filetypes) "lua", "make", "markdown", -- cgit v1.3