From 9828a5dc2f1d27e7570a2e63b285e23103a30b47 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 4 Aug 2023 19:12:35 +0000 Subject: [PATCH] chore(build): auto-generate vimdoc --- doc/api.md | 103 ++++++++++++++++++++++++++++++++++++++----- doc/astrocore.txt | 109 +++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 192 insertions(+), 20 deletions(-) diff --git a/doc/api.md b/doc/api.md index 648187f..abdb5b8 100644 --- a/doc/api.md +++ b/doc/api.md @@ -415,15 +415,6 @@ function astrocore.buffer.close_tab() Close the current tab -### comparator - - -```lua -table -``` - - A table of buffer comparator functions - ### current_buf @@ -539,13 +530,105 @@ function astrocore.buffer.sort(compare_func: string|function, skip_autocmd: bool Sort a the buffers in the current tab based on some comparator -*param* `compare_func` — a string of a comparator defined in require("astrocore.buffer").comparator or a custom comparator function +*param* `compare_func` — a string of a comparator defined in require("astrocore.buffer.comparator") or a custom comparator function *param* `skip_autocmd` — whether or not to skip triggering AstroBufsUpdated autocmd event *return* — Whether or not the buffers were sorted +## astrocore.buffer.comparator + +AstroNvim Buffer Comparators + +Buffer comparator functions for sorting buffers + +This module can be loaded with `local buffer_comparators = require "astrocore.buffer.comparator"` + +copyright 2023 +license GNU General Public License v3.0 + +### bufnr + + +```lua +function astrocore.buffer.comparator.bufnr(bufnr_a: integer, bufnr_b: integer) + -> comparison: boolean +``` + + Comparator of two buffer numbers + +*param* `bufnr_a` — buffer number A + +*param* `bufnr_b` — buffer number B + +*return* `comparison` — true if A is sorted before B, false if B should be sorted before A + +### extension + + +```lua +function astrocore.buffer.comparator.extension(bufnr_a: integer, bufnr_b: integer) + -> comparison: boolean +``` + + Comparator of two buffer numbers based on the file extensions + +*param* `bufnr_a` — buffer number A + +*param* `bufnr_b` — buffer number B + +*return* `comparison` — true if A is sorted before B, false if B should be sorted before A + +### full_path + + +```lua +function astrocore.buffer.comparator.full_path(bufnr_a: integer, bufnr_b: integer) + -> comparison: boolean +``` + + Comparator of two buffer numbers based on the full path + +*param* `bufnr_a` — buffer number A + +*param* `bufnr_b` — buffer number B + +*return* `comparison` — true if A is sorted before B, false if B should be sorted before A + +### modified + + +```lua +function astrocore.buffer.comparator.modified(bufnr_a: integer, bufnr_b: integer) + -> comparison: boolean +``` + + Comparator of two buffers based on modification date + +*param* `bufnr_a` — buffer number A + +*param* `bufnr_b` — buffer number B + +*return* `comparison` — true if A is sorted before B, false if B should be sorted before A + +### unique_path + + +```lua +function astrocore.buffer.comparator.unique_path(bufnr_a: integer, bufnr_b: integer) + -> comparison: boolean +``` + + Comparator of two buffers based on their unique path + +*param* `bufnr_a` — buffer number A + +*param* `bufnr_b` — buffer number B + +*return* `comparison` — true if A is sorted before B, false if B should be sorted before A + + ## astrocore.mason Mason Utilities diff --git a/doc/astrocore.txt b/doc/astrocore.txt index e81e279..4adc549 100644 --- a/doc/astrocore.txt +++ b/doc/astrocore.txt @@ -7,6 +7,7 @@ Table of Contents *astrocore-table-of-contents* 2. Lua API |astrocore-lua-api| - astrocore |astrocore-lua-api-astrocore| - astrocore.buffer |astrocore-lua-api-astrocore.buffer| + - astrocore.buffer.comparator|astrocore-lua-api-astrocore.buffer.comparator| - astrocore.mason |astrocore-lua-api-astrocore.mason| - astrocore.toggles |astrocore-lua-api-astrocore.toggles| @@ -456,15 +457,6 @@ CLOSE_TAB ~ Close the current tab -COMPARATOR ~ - ->lua - table -< - -A table of buffer comparator functions - - CURRENT_BUF ~ >lua @@ -582,7 +574,7 @@ SORT ~ Sort a the buffers in the current tab based on some comparator _param_ `compare_func` — a string of a comparator defined in -require("astrocore.buffer").comparator or a custom comparator function +require("astrocore.buffer.comparator") or a custom comparator function _param_ `skip_autocmd` — whether or not to skip triggering AstroBufsUpdated autocmd event @@ -590,6 +582,103 @@ autocmd event _return_ — Whether or not the buffers were sorted +ASTROCORE.BUFFER.COMPARATOR *astrocore-lua-api-astrocore.buffer.comparator* + +AstroNvim Buffer Comparators + +Buffer comparator functions for sorting buffers + +This module can be loaded with `local buffer_comparators = require +"astrocore.buffer.comparator"` + +copyright 2023 license GNU General Public License v3.0 + + +BUFNR ~ + +>lua + function astrocore.buffer.comparator.bufnr(bufnr_a: integer, bufnr_b: integer) + -> comparison: boolean +< + +Comparator of two buffer numbers + +_param_ `bufnr_a` — buffer number A + +_param_ `bufnr_b` — buffer number B + +_return_ `comparison` — true if A is sorted before B, false if B should be +sorted before A + + +EXTENSION ~ + +>lua + function astrocore.buffer.comparator.extension(bufnr_a: integer, bufnr_b: integer) + -> comparison: boolean +< + +Comparator of two buffer numbers based on the file extensions + +_param_ `bufnr_a` — buffer number A + +_param_ `bufnr_b` — buffer number B + +_return_ `comparison` — true if A is sorted before B, false if B should be +sorted before A + + +FULL_PATH ~ + +>lua + function astrocore.buffer.comparator.full_path(bufnr_a: integer, bufnr_b: integer) + -> comparison: boolean +< + +Comparator of two buffer numbers based on the full path + +_param_ `bufnr_a` — buffer number A + +_param_ `bufnr_b` — buffer number B + +_return_ `comparison` — true if A is sorted before B, false if B should be +sorted before A + + +MODIFIED ~ + +>lua + function astrocore.buffer.comparator.modified(bufnr_a: integer, bufnr_b: integer) + -> comparison: boolean +< + +Comparator of two buffers based on modification date + +_param_ `bufnr_a` — buffer number A + +_param_ `bufnr_b` — buffer number B + +_return_ `comparison` — true if A is sorted before B, false if B should be +sorted before A + + +UNIQUE_PATH ~ + +>lua + function astrocore.buffer.comparator.unique_path(bufnr_a: integer, bufnr_b: integer) + -> comparison: boolean +< + +Comparator of two buffers based on their unique path + +_param_ `bufnr_a` — buffer number A + +_param_ `bufnr_b` — buffer number B + +_return_ `comparison` — true if A is sorted before B, false if B should be +sorted before A + + ASTROCORE.MASON *astrocore-lua-api-astrocore.mason* Mason Utilities