From caf29f7fc05e7b1ac02c6b2b537a6e8bfd8da043 Mon Sep 17 00:00:00 2001 From: hedyhli Date: Fri, 5 Jul 2024 04:52:16 +0000 Subject: [PATCH] chore(vimdoc): Auto update --- doc/outline.txt | 58 +++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 54 insertions(+), 4 deletions(-) diff --git a/doc/outline.txt b/doc/outline.txt index 9ff4826..7b595d6 100644 --- a/doc/outline.txt +++ b/doc/outline.txt @@ -1,4 +1,4 @@ -*outline.txt* For NVIM v0.7.0 Last change: 2024 June 05 +*outline.txt* For NVIM v0.7.0 Last change: 2024 July 05 ============================================================================== Table of Contents *outline-table-of-contents* @@ -342,6 +342,10 @@ Show defaults ~ -- You can use a custom function that returns the icon for each symbol kind. -- This function takes a kind (string) as parameter and should return an -- icon as string. + ---@param kind string + ---@param bufnr integer Code buffer + ---@returns string|boolean The icon string (key of `icons` table), or `false` + --- to fallback to `icon_source`. icon_fetcher = nil, -- 3rd party source for fetching icons. Fallback if icon_fetcher returned -- empty string. Currently supported values: 'lspkind' @@ -782,6 +786,21 @@ TIPS *outline-tips* } < +The `icon_fetcher` function may also accept a second parameter, the buffer +number of the code buffer. For example, you can use it to determine the icon to +use based on the filetype. + +>lua + symbols = { + icon_fetcher = function(kind, bufnr) + local ft = vim.api.nvim_buf_get_option(bufnr, 'ft') + -- ... + end, + } +< + +See |outline-this-section| for other examples of this function. + - You can customize the split command used for creating the outline window split using `outline_window.split_command`, such as `"topleft vsp"`. See |windows| - Is the outline window too slow when first opening a file? This is usually due @@ -945,7 +964,7 @@ that simply returns in plain text, the first letter of the given kind. >lua symbols = { - icon_fetcher = function(kind) return kind:sub(1,1) end + icon_fetcher = function(kind, bufnr) return kind:sub(1,1) end, } < @@ -954,13 +973,25 @@ and `icons` as fallback. +DIFFERENT ICONS BASED ON FILETYPE ~ + +>lua + symbols = { + icon_fetcher = function(kind, bufnr) + local ft = vim.api.nvim_buf_get_option(bufnr, 'ft') + -- ... + end, + } +< + + DISABLE ICONS ~ Disable all icons: >lua symbols = { - icon_fetcher = function(_) return "" end, + icon_fetcher = function() return "" end, } < @@ -968,7 +999,7 @@ Disable icons for specific kinds, and for others use lspkind: >lua symbols = { - icon_fetcher = function(k) + icon_fetcher = function(k, buf) if k == 'String' then return "" end @@ -980,6 +1011,25 @@ Disable icons for specific kinds, and for others use lspkind: +DISABLE ICONS FOR A SPECIFIC FILETYPE ~ + +In this example, icons are disabled for markdown, and `lspkind` is used for +other filetypes. + +>lua + symbols = { + icon_fetcher = function(k, buf) + local ft = vim.api.nvim_buf_get_option(buf, "ft") + if ft == 'markdown' then + return "" + end + return false + end, + icon_source = "lspkind", + } +< + + LIVE, EDITABLE PREVIEWS ~ Press `K` to open the preview, press `K` again to focus on the preview window