Add support for untracked local snippets
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,3 +1,4 @@
|
|||||||
lazy-lock.json
|
lazy-lock.json
|
||||||
spell/*.spl
|
spell/*.spl
|
||||||
local.lua
|
local.lua
|
||||||
|
snippets/local/
|
||||||
|
|||||||
@@ -6,8 +6,14 @@ return {
|
|||||||
local luasnip = require('luasnip')
|
local luasnip = require('luasnip')
|
||||||
luasnip.setup({})
|
luasnip.setup({})
|
||||||
|
|
||||||
-- Load snippets
|
-- Load snippets. The 'snippets/local' directory is gitignored and holds
|
||||||
local opts = { paths = vim.fn.stdpath('config') .. '/snippets' }
|
-- 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_snipmate').lazy_load(opts)
|
||||||
require('luasnip.loaders.from_lua').lazy_load(opts)
|
require('luasnip.loaders.from_lua').lazy_load(opts)
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
local has_tree_sitter_cli = vim.fn.executable('tree-sitter') == 1
|
||||||
|
|
||||||
if not has_tree_sitter_cli then
|
if not has_tree_sitter_cli then
|
||||||
|
|||||||
Reference in New Issue
Block a user