Add support for untracked local snippets

This commit is contained in:
2026-08-27 12:24:00 +01:00
parent fc04774f4e
commit 3b26a1b421
3 changed files with 31 additions and 2 deletions

1
.gitignore vendored
View File

@@ -1,3 +1,4 @@
lazy-lock.json
spell/*.spl
local.lua
snippets/local/

View File

@@ -6,8 +6,14 @@ return {
local luasnip = require('luasnip')
luasnip.setup({})
-- Load snippets
local opts = { paths = vim.fn.stdpath('config') .. '/snippets' }
-- Load snippets. The 'snippets/local' directory is gitignored and holds
-- personal snippets that are not tracked; LuaSnip merges it with the
-- tracked snippets above.
local config_dir = vim.fn.stdpath('config')
local opts = { paths = {
config_dir .. '/snippets',
config_dir .. '/snippets/local',
} }
require('luasnip.loaders.from_snipmate').lazy_load(opts)
require('luasnip.loaders.from_lua').lazy_load(opts)

View File

@@ -1,3 +1,25 @@
-- Fold markdown sections through the blank lines that trail them. The upstream
-- query applies (#trim! @fold) to (section), which leaves the blank lines before
-- the next heading outside the fold and pads every collapsed section with an
-- empty line. Set explicitly rather than dropped in after/queries/, since only
-- the first folds.scm found on the runtimepath is used as the base query and the
-- one shipped with the parser wins that race.
vim.treesitter.query.set('markdown', 'folds', [[
([
(fenced_code_block)
(indented_code_block)
(list_item
(list))
] @fold
(#trim! @fold))
(section) @fold
(section
(list) @fold
(#trim! @fold))
]])
local has_tree_sitter_cli = vim.fn.executable('tree-sitter') == 1
if not has_tree_sitter_cli then