Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Developer documentation

Shawon edited this page Feb 5, 2025 · 1 revision

πŸ’» Dev documentations

Mostly for extending plugin functionalities.

πŸ“‘ States

Plugin states are stored in require("helpview").states.

--- Table containing various plugin states.
---@class helpview.state
---
--- List of attached buffers.
---@field attached_buffers integer[]
---
--- Buffer local states.
---@field buffer_states { [integer]: { enable: boolean, hybrid_mode: boolean? } }
---
--- Source buffer for hybrid mode.
---@field splitview_source? integer
--- Preview buffer for hybrid mode.
---@field splitview_buffer? integer
--- Preview window for hybrid mode.
---@field splitview_window? integer
helpview.state = {
 attached_buffers = {},
 buffer_states = {},
 splitview_buffer = nil,
 splitview_source = nil,
 splitview_window = nil
};

Warning

splitview_buffer might not be nil even after closing splitview as there's no point in creating a new buffer every time.

πŸš€ Internal functions

Tip

The sub-command implementation can be found in require("helpview").commands.

Commonly used functions can be found inside require("helpview").actions. These are,

  • __exec_callback, Safely executes a given callback.

    Usage: helpview.actions.__exec_callback(callback, ...)

    • callback, callback name.
    • ... arguments.
  • __is_attached, Checks if helpview is attached to a buffer or not.

    Usage: helpview.actions.__is_attached(buffer)

    • buffer, buffer ID(defaults to current buffer).

    Return: boolean

  • __is_enabled, Checks if helpview is enabled on a buffer or not.

    Usage: helpview.actions.__is_enabled(buffer)

    • buffer, buffer ID(defaults to current buffer).

    Return: boolean

  • __splitview_setup Sets up the buffer & window for splitview.

    Usage: helpview.actions.__splitview_setup()

Warning

Anti-pattern: Prevents users from forcefully closing the splitview window.


  • attach Attaches helpview to a buffer.

    Usage: helpview.actions.attach(buffer)

    • buffer, buffer ID(defaults to current buffer).
  • detach Detaches helpview to a buffer.

    Usage: helpview.actions.detach(buffer)

    • buffer, buffer ID(defaults to current buffer).

  • enable Enables previews for the given buffer.

    Usage: helpview.actions.enable(buffer)

    • buffer, buffer ID(defaults to current buffer).
  • disable Disables previews for the given buffer.

    Usage: helpview.actions.disable(buffer)

    • buffer, buffer ID(defaults to current buffer).

  • hybridEnable Enables hybrid mode for the given buffer.

    Usage: helpview.actions.hybridEnable(buffer)

    • buffer, buffer ID(defaults to current buffer).
  • hybridDisable Disables hybrid mode for the given buffer.

    Usage: helpview.actions.hybridDisable(buffer)

    • buffer, buffer ID(defaults to current buffer).

  • splitOpen Opens splitview for the given buffer.

    Usage: helpview.actions.splitOpen(buffer)

    • buffer, buffer ID(defaults to current buffer).
  • splitClose Closes any open splitview window.

✨ Manual previews

You can manually show previews via these functions,

  • helpview.render(buffer) Renders preview on buffer(defaults to current buffer).

  • helpview.clear(buffer) Clears previews of buffer(defaults to current buffer).


  • helpview.clean() Detaches helpview from any invalid buffer.

Also available in vimdoc, :h helpview.nvim-dev.

Clone this wiki locally

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /