diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index b3c087d..23137ba 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -40,7 +40,6 @@ jobs: run: | # We have to build the parser every single time to keep up with parser changes cd ~/.local/share/nvim/site/pack/vendor/start/tree-sitter-lua - git checkout 86f74dfb69c570f0749b241f8f5489f8f50adbea make dist cd - diff --git a/doc/unclutter.txt b/doc/unclutter.txt index 5bc6ee8..0bb3531 100644 --- a/doc/unclutter.txt +++ b/doc/unclutter.txt @@ -8,7 +8,7 @@ unclutter.setup({opts}) *unclutter.setup()* Parameters: ~ - {opts} (unclutter.config) + {opts} (unclutter) .config @@ -252,7 +252,7 @@ config.set({opts}) *config.set()* Parameters: ~ - {opts} (unclutter.config) + {opts} (unclutter) .config @@ -270,7 +270,7 @@ plugin.enable({opts}) *plugin.enable()* Parameters: ~ - {opts} (unclutter.config) + {opts} (unclutter) .config plugin.disable() *plugin.disable()* @@ -399,10 +399,13 @@ tabline.get_tab_label({buf}) *tabline.get_tab_label()* string|nil -tabline.list() *tabline.list()* +tabline.list({hide_current}) *tabline.list()* Get all buffers to be displayed in the tabline + Parameters: ~ + {hide_current} (boolean) ? + Return: ~ table @@ -430,6 +433,11 @@ tabline.prev() *tabline.prev()* +tabline.keep_all_buffers() *tabline.keep_all_buffers()* + Mark all open buffers as listed + + + ================================================================================ unclutter.telescope *unclutter.telescope* diff --git a/lua/unclutter/tabline.lua b/lua/unclutter/tabline.lua index 260e6da..e608dd5 100644 --- a/lua/unclutter/tabline.lua +++ b/lua/unclutter/tabline.lua @@ -272,4 +272,11 @@ function tabline.prev() end end +--- Mark all open buffers as listed +function tabline.keep_all_buffers() + for _, buf in ipairs(vim.api.nvim_list_bufs()) do + tabline.keep_buffer(buf) + end +end + return tabline diff --git a/lua/unclutter/tabline_spec.lua b/lua/unclutter/tabline_spec.lua index e6e21a9..c7437df 100644 --- a/lua/unclutter/tabline_spec.lua +++ b/lua/unclutter/tabline_spec.lua @@ -42,6 +42,16 @@ describe("Buffer management", function() assert.is_true(M.is_buffer_kept(1)) end) + it("keeps all open buffers", function() + vim.api.nvim_list_bufs = function() + return { 1, 2, 3 } + end + M.keep_all_buffers() + assert.is_true(M.is_buffer_kept(1)) + assert.is_true(M.is_buffer_kept(2)) + assert.is_true(M.is_buffer_kept(3)) + end) + it("removes a buffer", function() M.keep_buffer(1) M.remove_buffer(1) diff --git a/readme.md b/readme.md index f8b57ab..997463f 100644 --- a/readme.md +++ b/readme.md @@ -110,6 +110,7 @@ local buffer = require("unclutter.buffer") local plugin = require("unclutter.plugin") tabline.keep_buffer(bufnr) -- Show buffer in tabline +tabline.keep_all_buffers() -- Show all open buffers in tabline tabline.remove_buffer(bufnr) -- Show buffer in tabline tabline.toggle_buffer(bufnr) -- Toggle buffer in tabline tabline.list() -- List tabline buffers