Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# dotfiles

## Requirements
- Neovim 0.12.0+

## How to use
```sh
bash -c "$(curl -fsSL https://raw.githubusercontent.com/vmarlier/dotfiles/main/install.sh)"
```

## Neovim

The Neovim configuration uses **native Tree-sitter support** (Neovim 0.12+) instead of the archived `nvim-treesitter` plugin. All required language parsers are installed automatically on the first run — no manual `:TSInstall` commands needed.
1 change: 1 addition & 0 deletions nvim/lua/config/index.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
require("config.lazy")
require("config.options")
require("config.mappings")
require("config.treesitter")
85 changes: 85 additions & 0 deletions nvim/lua/config/treesitter.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
-----------------------------------
-- Maintainer: Valentin Marlier --
-----------------------------------
-- Native Tree-sitter configuration for Neovim 0.12+
-- Replaces the archived nvim-treesitter plugin.

-- All parsers to ensure are installed automatically.
local ensure_installed = {
"bash",
"diff",
"dockerfile",
"go",
"gomod",
"gosum",
"gowork",
"hcl",
"helm",
"json",
"lua",
"markdown",
"regex",
"terraform",
"yaml",
-- prop tech project
-- Core Logic: Highlighting for TypeScript, TSX, and JavaScript
"typescript",
"tsx",
"javascript",
-- Mobile Support: Syntax parsing for the project's Dart files
"dart",
-- Database: Highlighting for Ledger migrations and Kysely SQL snippets
"sql",
-- Config: Support for Firebase, TSConfig, and Package JSON files
"json5",
}

-- Auto-install any missing parsers on startup (non-blocking).
local function install_missing_parsers()
for _, lang in ipairs(ensure_installed) do
local already_loaded = pcall(vim.treesitter.language.require_language, lang, nil, true)
if not already_loaded then
-- Use the native Neovim 0.12 API to install the parser.
pcall(vim.treesitter.language.install, lang)
end
end
end

-- Run parser installation after the UI is ready so it doesn't block startup.
vim.api.nvim_create_autocmd("VimEnter", {
once = true,
callback = function()
install_missing_parsers()
end,
})

-- Enable Tree-sitter-based syntax highlighting for every buffer.
vim.api.nvim_create_autocmd("FileType", {
callback = function(ev)
local ok = pcall(vim.treesitter.start, ev.buf)
if not ok then
-- Silently fall back to legacy regex highlighting when no parser is
-- available for the current filetype.
end
end,
})

-- Incremental selection keymaps (replaces nvim-treesitter's incremental_selection).
-- <C-space> – init / expand selection; <bs> – shrink selection (visual mode).
vim.keymap.set({ "n", "x" }, "<C-space>", function()
local ok, sel = pcall(require, "vim.treesitter.incremental_selection")
if ok and sel then
if vim.fn.mode() == "n" then
sel.init_selection()
else
sel.node_incremental()
end
end
end, { noremap = true, silent = true, desc = "Increment Tree-sitter selection" })

vim.keymap.set("x", "<bs>", function()
local ok, sel = pcall(require, "vim.treesitter.incremental_selection")
if ok and sel then
sel.node_decremental()
end
end, { noremap = true, silent = true, desc = "Decrement Tree-sitter selection" })
75 changes: 0 additions & 75 deletions nvim/lua/plugins/core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -269,79 +269,4 @@ return {
},
},

{ -- Syntax highlighting and code parsing
"nvim-treesitter/nvim-treesitter",
version = "v0.10.0", -- Use latest for best language support
build = ":TSUpdate",
event = { "BufReadPost", "BufNewFile" },
lazy = vim.fn.argc(-1) == 0,

init = function(plugin)
require("lazy.core.loader").add_to_rtp(plugin)
pcall(require, "nvim-treesitter.query_predicates")
end,

cmd = { "TSUpdateSync", "TSUpdate", "TSInstall" },

keys = {
{ "<C-space>", desc = "Increment Selection" },
{ "<bs>", desc = "Decrement Selection", mode = "x" },
},

opts_extend = { "ensure_installed" },

opts = {
highlight = {
enable = true,
additional_vim_regex_highlighting = false -- Better performance
},
indent = { enable = true },

-- Organize language list alphabetically
ensure_installed = {
"bash",
"diff",
"dockerfile",
"go",
"gomod",
"gosum",
"gowork",
"hcl",
"helm",
"json",
"lua",
"markdown",
"regex",
"terraform",
"yaml",

-- prop tech project
-- Core Logic: Highlighting for TypeScript, TSX, and JavaScript
"typescript", "tsx", "javascript",
-- Mobile Support: Syntax parsing for the project's Dart files
"dart",
-- Database: Highlighting for Ledger migrations and Kysely SQL snippets
"sql",
-- Config: Support for Firebase, TSConfig, and Package JSON files
"json", "json5",
},

incremental_selection = {
enable = true,
keymaps = {
init_selection = "<C-space>",
node_incremental = "<C-space>",
scope_incremental = false,
node_decremental = "<bs>",
},
},
},

config = function(_, opts)
local ok, configs = pcall(require, "nvim-treesitter.configs")
if ok then
configs.setup(opts)
end
end
},
}
Loading