diff --git a/CHANGELOG.md b/CHANGELOG.md index 241576f..35f5728 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -54,9 +54,9 @@ - Floating windows are now used for `show_help` keymap and `:OutlineStatus` command - `:OutlineStatus` command is now more informative (and prettier!) - New command `:OutlineRefresh` and corresponding lua API function - `refresh_outline()` triggers re-requesting of symbols from provider and - updating the outline -- New lua API function `is_focus_in_outline()` + `refresh()` triggers re-requesting of symbols from provider and updating the + outline +- New lua API function `has_focus()` - Auto-unfold root nodes when there is only N nodes. Where N defaults to 1 (meaning when there is only 1 root node, keep it unfolded). The added config option is `symbol_folding.auto_unfold` with keys `hovered` and `only`. @@ -77,6 +77,8 @@ provided. This requires `norg` parser to be installed for treesitter - Outline.nvim now supports per-tabpage outlines ([#37](https://github.com/hedyhli/outline.nvim/issues/37)) +- Added `get_symbol` and `get_breadcrumb` functions (useful in + statusline/winbar) ([#24](https://github.com/hedyhli/outline.nvim/issues/24)) ### Fixes diff --git a/README.md b/README.md index 4a7b23e..c34ed29 100644 --- a/README.md +++ b/README.md @@ -729,19 +729,19 @@ require'outline' ``` - setup(opts) -- **toggle_outline(opts)** +- **toggle(opts)** Toggle opening/closing of outline window. If `opts.focus_outline=false`, keep focus on previous window. -- **open_outline(opts)** +- **open(opts)** Open the outline window. If `opts.focus_outline=false`, keep focus on previous window. -- **close_outline()** +- **close()** Close the outline window. @@ -767,7 +767,7 @@ require'outline' - **has_provider()** - Returns whether a provider is available for current window. + Returns whether a provider is available. - **follow_cursor(opts)** @@ -779,11 +779,11 @@ require'outline' This is automatically called on events `outline_items.auto_update_events.follow` from config. -- **is_focus_in_outline()** +- **has_focus()** Return whether outline is open and current focus is in outline. -- **refresh_outline()** +- **refresh()** Re-request symbols from provider and update outline items. diff --git a/lua/outline/init.lua b/lua/outline/init.lua index 4b7a81d..43b3832 100644 --- a/lua/outline/init.lua +++ b/lua/outline/init.lua @@ -64,14 +64,14 @@ function M._sidebar_do(method, args) return sidebar[method](sidebar, unpack(args)) end ----Close the current outline window function M.close_outline() return M._sidebar_do('close') end +M.close = M.close_outline + ---Toggle the outline window, and return whether the outline window is open -- after this operation. ----@see open_outline ---@param opts outline.OutlineOpts? Table of options ---@return boolean is_open Whether outline window is now open function M.toggle_outline(opts) @@ -83,6 +83,8 @@ function M.toggle_outline(opts) return sidebar:toggle(opts) end +M.toggle = M.toggle_outline + ---Set cursor to focus on the outline window, return whether the window is -- currently open. ---@return boolean is_open Whether the window is open @@ -115,6 +117,8 @@ function M.refresh_outline() return M._sidebar_do('__refresh') end +M.refresh = M.refresh_outline + ---Open the outline window. ---@param opts outline.OutlineOpts? Field focus_outline=false means don't focus on outline window after opening. If opts is not provided, focus will be on outline window after opening. function M.open_outline(opts) @@ -131,6 +135,8 @@ function M.open_outline(opts) return sidebar:open(opts) end +M.open = M.open_outline + ---@return boolean? has_focus Nil when no outline opened yet, otherwise returns whether cursor is in outline window. function M.is_focus_in_outline() return M._sidebar_do('has_focus')