feat: Norg provider and support of external providers
- Closes #3 - Ref: simrat39/symbols-outline.nvim#190 Norg contains indents and different types of verbatim tags, I was rather lazy to read the spec properly and parse norg using regex line-by-line like markdown, so used treesitter instead. The only requirement is the `norg` parser for treesitter to be installed. Tested on nvim 0.7.2. This should lead the way for supporting vimdoc files in a similar manner. Documentation for how external providers could look like as of now has been added. In the future we could let the provider determine what to do for each keymap, such as `goto_location` and `toggle_preview`. This would allow the zk extension[1] to work properly without having to override existing functions (bad practice). [1]: https://github.com/mickael-menu/zk-nvim/discussions/134
This commit is contained in:
@@ -89,7 +89,7 @@ M.defaults = {
|
||||
up_and_jump = '<C-k>',
|
||||
},
|
||||
providers = {
|
||||
priority = { 'lsp', 'coc', 'markdown' },
|
||||
priority = { 'lsp', 'coc', 'markdown', 'norg' },
|
||||
lsp = {
|
||||
blacklist_clients = {},
|
||||
},
|
||||
@@ -211,8 +211,8 @@ end
|
||||
---@return boolean include
|
||||
function M.should_include_symbol(kind, bufnr)
|
||||
local ft = vim.api.nvim_buf_get_option(bufnr, 'ft')
|
||||
-- There can only be one kind in markdown as of now
|
||||
if ft == 'markdown' or kind == nil then
|
||||
-- There can only be one kind in markdown and norg as of now
|
||||
if ft == 'markdown' or ft == 'norg' or kind == nil then
|
||||
return true
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user