diff --git a/README.md b/README.md index 321a6eb..10385bb 100644 --- a/README.md +++ b/README.md @@ -11,8 +11,9 @@ It also adds many more features listed [below](#features). It does not attempt to be an up-to-date successor of the original repo, nor does it attempt to ensure everyone's use-cases are satisfied by providing an overall -better experience. It is merely a fork which I maintain for my personal -use-cases which incorporates some selected PRs. +better experience. For now, it is a fork which I maintain for my personal +use-cases that incorporates a significant number of existing [PRs](#prs) and [fixes](#fixes) +many previously reported issues. ## Maintenance status diff --git a/doc/symbols-outline.txt b/doc/symbols-outline.txt index 9d8df76..cde1f22 100644 --- a/doc/symbols-outline.txt +++ b/doc/symbols-outline.txt @@ -273,6 +273,17 @@ Default values are shown: -- Symbols to ignore. -- Possible values are the Keys in the icons table below. blacklist = {}, + -- Added in this fork: + -- 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. + icon_fetcher = nil, + -- 3rd party source for fetching icons. Fallback if icon_fetcher returned + -- empty string. Currently supported values: 'lspkind' + icon_source = nil, + -- The next fall back if both icon_fetcher and icon_source has failed, is + -- the custom mapping of icons specified below. The icons table is also + -- needed for specifying hl group. -- Changed in this fork to fix deprecated icons not showing. icons = { File = { icon = "󰈔", hl = "@text.uri" }, @@ -317,6 +328,15 @@ To find out exactly what some of the options do, please see the |symbols-outline-recipes| section of the readme at the bottom for screen-recordings. +The order in which the sources for icons are checked is: + +1. Icon fetcher function +2. Icon source (only `lspkind` is supported for this option as of now) +3. Icons table + +A fallback is always used if the previous candidate returned either an empty +string or a falsey value. + COMMANDS *symbols-outline-commands* @@ -404,6 +424,9 @@ Possible highlight groups provided by symbols-outline to customize: You can customize any other highlight groups using `winhl` too, this option is passed directly to the `winhl` vim option unprocessed. +To customize colors of the symbol icons, use the `symbols.icons` table. See +|symbols-outline-config|. + PREVIEW WINDOW ~ @@ -461,6 +484,17 @@ TIPS *symbols-outline-tips* - To customize the background colors, text colors, and borders, you can use `outline_window.winhl` for the outline window or `preview_window.winhl` for the preview floating window. See |symbols-outline-highlights|. +- To fix symbol icon related issues, there are several options. If you use + `lspkind`, you can set `symbols.icon_source = 'lspkind'` to use lspkind for + fetching icons. You can also use your own function `symbols.icon_fetcher` that + takes a string and should return an icon. Otherwise, you can edit the + `symbols.icons` table for specifying icons. + The order in which the sources of icons are checked is: + 1. Icon fetcher function + 2. Icon source + 3. Icons table + A fallback is always used if the previous candidate returned either an empty + string or a falsey value. RECIPES *symbols-outline-recipes* @@ -560,6 +594,22 @@ the outline becomes more readable this way, hence this is an option. This feature is newly added in this fork, and is currently experimental (may be unstable). +- **Custom icons** + +You can write your own function for fetching icons. Here is one such example +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 + } +< + +The fetcher function, if provided, is checked first before using `icon_source` +and `icons` as fallback. + + + ============================================================================== 1. Links *symbols-outline-links*