diff --git a/.gitignore b/.gitignore index ffd8961..d72c5de 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ lazy-lock.json spell/*.spl local.lua +snippets/local/ diff --git a/lua/plugins/snippets.lua b/lua/plugins/snippets.lua index 0eaa8d7..fc18a37 100644 --- a/lua/plugins/snippets.lua +++ b/lua/plugins/snippets.lua @@ -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) diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua index b249cff..731655a 100644 --- a/lua/plugins/treesitter.lua +++ b/lua/plugins/treesitter.lua @@ -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