From 700203b6fe530d9d4554488e35d882c277206835 Mon Sep 17 00:00:00 2001 From: AcruxDevelopment Date: Wed, 19 Aug 2026 03:58:09 -0300 Subject: [PATCH] Fix JavaScript brace placement --- nvim/README.md | 2 +- nvim/{v5-dnf.sh => v6-dnf.sh} | 23 +++++++++++++++-------- 2 files changed, 16 insertions(+), 9 deletions(-) rename nvim/{v5-dnf.sh => v6-dnf.sh} (98%) diff --git a/nvim/README.md b/nvim/README.md index 68ed840..9a2edb0 100644 --- a/nvim/README.md +++ b/nvim/README.md @@ -31,7 +31,7 @@ First launch will take a minute or two: `lazy.nvim` bootstraps itself and instal - Tab width: **4**, using real tab characters — not expanded to spaces. - True color, rounded borders on floating windows (hover, LspInfo, Mason, etc. — Neovim 0.11+), styled window separators. - OSC 52 clipboard support, so yank/paste works correctly over SSH. -- `c`/`cpp` indentation uses Vim's native `cindent` rather than treesitter's indent module — treesitter's C/C++ indent is known to be unreliable (inconsistent brace placement); `cindent` is far more predictable for brace-heavy code. +- `c`/`cpp`/`javascript`/`typescript` indentation uses Neovim's own built-in per-filetype indent logic (`cindent` for c/cpp, the bundled JS/TS indent scripts for the rest) rather than treesitter's indent module — treesitter's indent is known to be unreliable for these specifically (inconsistent brace placement, phantom extra indent on nested blocks), more so since the `nvim-treesitter` branch this config uses is frozen upstream (see [Known quirks](#known-quirks)). `css`/`json` are also curly-brace languages that can hit the same issue — worth disabling there too if it comes up. ### General keymaps diff --git a/nvim/v5-dnf.sh b/nvim/v6-dnf.sh similarity index 98% rename from nvim/v5-dnf.sh rename to nvim/v6-dnf.sh index 6552978..8e03fb5 100755 --- a/nvim/v5-dnf.sh +++ b/nvim/v6-dnf.sh @@ -46,7 +46,7 @@ fi fc-cache -fv echo "Fonts installed and cache updated successfully!" -# 3. Delete existing Neovim config +# 3. Deletes existing Neovim config echo "[3/4] Deleting existing Neovim configurations..." if [ -d "$HOME/.config/nvim" ]; then rm -fr "$HOME/.config/nvim" @@ -294,13 +294,20 @@ return { indent = { enable = true, -- treesitter's indent module is well-known to be unreliable - -- specifically for C/C++ (inconsistent brace placement, - -- phantom extra indent on nested blocks) while being fine - -- for the other languages here. Disabling it just for c/cpp - -- falls back to Vim's built-in 'cindent', which Neovim - -- already auto-enables for these filetypes via its standard - -- ftplugin and is much more predictable for brace-heavy code. - disable = { "c", "cpp" }, + -- for a handful of languages specifically (inconsistent + -- brace placement, phantom extra indent on nested blocks) + -- while being fine for the rest. This is more pronounced on + -- the "master" branch pinned above, since it's frozen and + -- gets no further upstream fixes at all. Disabling it for + -- these falls back to Neovim's own built-in, per-filetype + -- indent logic (cindent for c/cpp, the bundled javascript/ + -- typescript indent scripts for the rest), which is far + -- more predictable for brace-heavy code. + -- + -- css and json are also curly-brace languages that CAN hit + -- the same class of issue -- add them here too if you + -- notice the same symptom there. + disable = { "c", "cpp", "javascript", "typescript" }, }, }) end,