diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..8bb1f50 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,31 @@ +--- +name: Bug report +about: Something isn't working +title: '' +labels: bug +assignees: '' + +--- + +## Description + + + + +## Neovim setup + +- Neovim version: +- Outline.nvim version: +- Neovim distro (if applicable): +- Plugin manager: + + + +Config: +``` + +``` diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..5ceff9f --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,19 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: enhancement +assignees: '' + +--- + +## Description + + + diff --git a/doc/outline.txt b/doc/outline.txt index ee54587..48c63a7 100644 --- a/doc/outline.txt +++ b/doc/outline.txt @@ -1,4 +1,4 @@ -*outline.txt* For NVIM v0.7.0 Last change: 2024 July 05 +*outline.txt* For NVIM v0.7.0 Last change: 2024 August 13 ============================================================================== Table of Contents *outline-table-of-contents* diff --git a/lua/outline/init.lua b/lua/outline/init.lua index b57b10b..f02ecef 100644 --- a/lua/outline/init.lua +++ b/lua/outline/init.lua @@ -3,6 +3,7 @@ local cfg = require('outline.config') local highlight = require('outline.highlight') local providers = require('outline.providers.init') local utils = require('outline.utils.init') +local symbols = require('outline.symbols') local M = { ---@type outline.Sidebar[] @@ -354,6 +355,7 @@ function M.setup(opts) cfg.setup(opts) highlight.setup() + symbols.setup() setup_global_autocmd() setup_commands() diff --git a/lua/outline/symbols.lua b/lua/outline/symbols.lua index ac6c542..a3a4b68 100644 --- a/lua/outline/symbols.lua +++ b/lua/outline/symbols.lua @@ -45,6 +45,11 @@ for k, v in pairs(M.kinds) do M.str_to_kind[v] = k end +-- use a stub if lspkind is missing or not configured +local lspkind = { + symbolic = function(kind, opts) return '' end +} + ---@param kind string|integer ---@param bufnr integer ---@return string icon @@ -65,22 +70,26 @@ function M.icon_from_kind(kind, bufnr) end end - if cfg.o.symbols.icon_source == 'lspkind' then - local has_lspkind, lspkind = pcall(require, 'lspkind') - if not has_lspkind then - vim.notify( - '[outline]: icon_source set to lspkind but failed to require lspkind!', - vim.log.levels.ERROR - ) - else - local icon = lspkind.symbolic(kindstr, { with_text = false }) - if icon and icon ~= '' then - return icon - end - end + local icon = lspkind.symbolic(kindstr, { with_text = false }) + if icon and icon ~= '' then + return icon end return cfg.o.symbols.icons[kindstr].icon end +function M.setup() + if cfg.o.symbols.icon_source == 'lspkind' then + local has_lspkind, _lspkind = pcall(require, 'lspkind') + if has_lspkind then + lspkind = _lspkind + else + vim.notify( + '[outline]: icon_source set to lspkind but failed to require lspkind!', + vim.log.levels.ERROR + ) + end + end +end + return M