chore(doc): add tips for nvim 0.7 users and new content for nvim 0.11

Added documentation for new field _G._outline_nvim_has[11]
This commit is contained in:
27Onion Nebell
2025-04-18 17:15:34 +08:00
parent e93286a489
commit ce039c3022
2 changed files with 7 additions and 1 deletions

View File

@@ -918,6 +918,7 @@ symbols = {
```lua ```lua
symbols = { symbols = {
icon_fetcher = function(kind, bufnr, symbol) icon_fetcher = function(kind, bufnr, symbol)
-- Use nvim_buf_get_option(bufnr, 'ft') for nvim 0.7 users
local ft = vim.api.nvim_get_option_value('ft', { buf = bufnr }) local ft = vim.api.nvim_get_option_value('ft', { buf = bufnr })
-- ... -- ...
end, end,
@@ -1112,6 +1113,7 @@ and `icons` as fallback.
```lua ```lua
symbols = { symbols = {
icon_fetcher = function(kind, bufnr) icon_fetcher = function(kind, bufnr)
-- Use nvim_buf_get_option(bufnr, 'ft') for nvim 0.7 users
local ft = vim.api.nvim_get_option_value('ft', { buf = bufnr }) local ft = vim.api.nvim_get_option_value('ft', { buf = bufnr })
-- ... -- ...
end, end,
@@ -1152,6 +1154,7 @@ other filetypes.
```lua ```lua
symbols = { symbols = {
icon_fetcher = function(k, buf) icon_fetcher = function(k, buf)
-- Use nvim_buf_get_option(bufnr, 'ft') for nvim 0.7 users
local ft = vim.api.nvim_get_option_value("ft", { buf = buf }) local ft = vim.api.nvim_get_option_value("ft", { buf = buf })
if ft == 'markdown' then if ft == 'markdown' then
return "" return ""

View File

@@ -500,7 +500,7 @@ and uses regex; the built-in norg <./lua/outline/providers/norg.lua> provider
is an example which uses treesitter. is an example which uses treesitter.
All providers should support at least nvim 0.7. You can make use of All providers should support at least nvim 0.7. You can make use of
`_G._outline_nvim_has` with fields `[8]`, `[9]`, and `[10]`. For instance, `_G._outline_nvim_has` with fields `[8]`, `[9]`, `[10]`, and `[11]`. For instance,
`_G._outline_nvim_has[8]` is equivalent to: `vim.fn.has('nvim-0.8') == 1`. `_G._outline_nvim_has[8]` is equivalent to: `vim.fn.has('nvim-0.8') == 1`.
If a higher nvim version is required, it is recommended to check for this If a higher nvim version is required, it is recommended to check for this
@@ -806,6 +806,7 @@ based on the filetype.
>lua >lua
symbols = { symbols = {
icon_fetcher = function(kind, bufnr, symbol) icon_fetcher = function(kind, bufnr, symbol)
-- Use nvim_buf_get_option_value(buf, 'ft') for nvim 0.7 users
local ft = vim.api.nvim_get_option_value('ft', { buf = bufnr }) local ft = vim.api.nvim_get_option_value('ft', { buf = bufnr })
-- ... -- ...
end, end,
@@ -1007,6 +1008,7 @@ DIFFERENT ICONS BASED ON FILETYPE ~
>lua >lua
symbols = { symbols = {
icon_fetcher = function(kind, bufnr) icon_fetcher = function(kind, bufnr)
-- Use nvim_buf_get_option_value(buf, 'ft') for nvim 0.7 users
local ft = vim.api.nvim_get_option_value('ft', { buf = bufnr }) local ft = vim.api.nvim_get_option_value('ft', { buf = bufnr })
-- ... -- ...
end, end,
@@ -1048,6 +1050,7 @@ other filetypes.
>lua >lua
symbols = { symbols = {
icon_fetcher = function(k, buf) icon_fetcher = function(k, buf)
-- Use nvim_buf_get_option_value(buf, 'ft') for nvim 0.7 users
local ft = vim.api.nvim_get_option_value("ft", { buf = buf }) local ft = vim.api.nvim_get_option_value("ft", { buf = buf })
if ft == 'markdown' then if ft == 'markdown' then
return "" return ""