Module buffer-closer.modules.buffer

A module for managing buffers and closing retired buffers.

This module provides functions for managing buffers and closing retired buffers

Functions

close_retired_buffers (opts) Closes the retired buffers based on the retirement policy specified in the options.
get_retired_bufnrs (opts) Returns the list of buffer numbers that should be closed based on the retirement policy specified in the options.
is_excluded (bufnr, excluded) Checks whether a buffer is excluded based on the given exclusion criteria.
is_outdated_buffer (lastused_secs, retirement_minutes) Checks whether a buffer is outdated based on the given retirement policy.
is_unsaved_buffer (bufnr) Checks whether a buffer is unsaved.


Functions

close_retired_buffers (opts)
Closes the retired buffers based on the retirement policy specified in the options.

This function closes the retired buffers based on the retirement policy specified in the options. Buffers that should be excluded based on the exclusion criteria are not closed.

Parameters:

  • opts table : The retirement policy options.

See also:

get_retired_bufnrs (opts)
Returns the list of buffer numbers that should be closed based on the retirement policy specified in the options.

This function returns the list of buffer numbers that should be closed based on the retirement policy specified in the options. Buffers that should be excluded based on the exclusion criteria are not included in the returned list.

Parameters:

  • opts table : The user options.

Returns:

    table : The list of buffer numbers to close.

See also:

is_excluded (bufnr, excluded)
Checks whether a buffer is excluded based on the given exclusion criteria.

This function checks whether the given buffer should be excluded from being closed based on the given exclusion criteria. The exclusion criteria include filetypes, buffer types, and filenames.

Parameters:

  • bufnr number : The buffer number to check.
  • excluded table : The exclusion criteria.

Returns:

    boolean : Whether the buffer should be excluded.
is_outdated_buffer (lastused_secs, retirement_minutes)
Checks whether a buffer is outdated based on the given retirement policy.

This function checks whether the given buffer is outdated based on the given retirement policy. A buffer is considered outdated if it has not been used in the specified number of minutes.

Parameters:

  • lastused_secs number : The timestamp of when the buffer was last used, in seconds.
  • retirement_minutes number : The number of minutes after which a buffer is considered outdated.

Returns:

    boolean : Whether the buffer is outdated.
is_unsaved_buffer (bufnr)
Checks whether a buffer is unsaved.

This function checks whether the given buffer has unsaved changes.

Parameters:

  • bufnr number : The buffer number to check.

Returns:

    boolean : Whether the buffer has unsaved changes.
generated by LDoc 1.5.0 Last updated 2023-10-02 08:50:00