This commit is contained in:
Justin M. Keyes 2024-02-28 10:49:49 -05:00
parent c592617dd5
commit 45a75a662d
4 changed files with 14 additions and 3 deletions

View File

@ -161,7 +161,7 @@ h or *h*
<Left> or *<Left>*
CTRL-H or *CTRL-H* *<BS>*
<BS> [count] characters to the left. |exclusive| motion.
Note: If you prefer <BS> to delete a character, use
Nxte: If [you] prefer <BS> to delete a character, use
the mapping:
:map CTRL-V<BS> X
(to enter "CTRL-V<BS>" type the CTRL-V key, followed

View File

@ -106,6 +106,7 @@ function M.add(lang, opts)
path = paths[1]
end
vim._ts_remove_language(lang)
vim._ts_add_language(path, lang, symbol_name)
M.register(lang, filetype)
end

View File

@ -614,6 +614,9 @@ local function visit_node(root, level, lang_tree, headings, opt, stats)
return text
end
local class = node_name == 'optional' and ' class="optional"' or ''
if node_name == 'optional' then
return ('%s<code%s>%s</code>'):format(ws(), class, trimmed)
end
local s = (
node_name == 'keycode'
-- TODO: use <kbd>. Currently has a layout issue, example: ":help _".
@ -773,9 +776,10 @@ local function parse_buf(fname, parser_path)
vim.cmd('sbuffer ' .. tostring(fname)) -- Buffer number.
end
if parser_path then
vim.treesitter.language.add('vimdoc', { path = parser_path })
vim.treesitter.language.add('vimdoc2', { path = parser_path })
end
local lang_tree = vim.treesitter.get_parser(buf)
local lang_tree = vim.treesitter.get_parser(buf, 'vimdoc2')
-- vim.print(lang_tree)
return lang_tree, buf
end

View File

@ -121,6 +121,12 @@ int tslua_add_language(lua_State *L)
TREE_SITTER_LANGUAGE_VERSION, lang_version);
}
bool present = map_has(cstr_t, &langs, lang_name);
if (present) {
cstr_t key;
pmap_del(cstr_t)(&langs, lang_name, &key);
xfree((void *)key);
}
pmap_put(cstr_t)(&langs, xstrdup(lang_name), lang);
lua_pushboolean(L, true);