Fix JavaScript brace placement

This commit is contained in:
alejo committed 2026-08-19 03:58:09 -03:00
1 parent b52db80954
commit 700203b6fe
2 files changed
+16 -9

No files matched your search

+1 -1
View File
@@ -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. - 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. - 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. - 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 ### General keymaps
+15 -8
View File
@@ -46,7 +46,7 @@ fi
fc-cache -fv fc-cache -fv
echo "Fonts installed and cache updated successfully!" echo "Fonts installed and cache updated successfully!"
# 3. Delete existing Neovim config # 3. Deletes existing Neovim config
echo "[3/4] Deleting existing Neovim configurations..." echo "[3/4] Deleting existing Neovim configurations..."
if [ -d "$HOME/.config/nvim" ]; then if [ -d "$HOME/.config/nvim" ]; then
rm -fr "$HOME/.config/nvim" rm -fr "$HOME/.config/nvim"
@@ -294,13 +294,20 @@ return {
indent = { indent = {
enable = true, enable = true,
-- treesitter's indent module is well-known to be unreliable -- treesitter's indent module is well-known to be unreliable
-- specifically for C/C++ (inconsistent brace placement, -- for a handful of languages specifically (inconsistent
-- phantom extra indent on nested blocks) while being fine -- brace placement, phantom extra indent on nested blocks)
-- for the other languages here. Disabling it just for c/cpp -- while being fine for the rest. This is more pronounced on
-- falls back to Vim's built-in 'cindent', which Neovim -- the "master" branch pinned above, since it's frozen and
-- already auto-enables for these filetypes via its standard -- gets no further upstream fixes at all. Disabling it for
-- ftplugin and is much more predictable for brace-heavy code. -- these falls back to Neovim's own built-in, per-filetype
disable = { "c", "cpp" }, -- 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, end,