Module textredux.buffer_list
The buffer list module provides a text based replacement for the standard Textadept buffer list.
Usage
Use the textredux.hijack function or load the buffer list
in your ~/.textadept/init.lua
:
local textredux = require('textredux') keys["ctrl+b"] = textredux.buffer_list.show
Features
- Close a buffer from the buffer list (bound to
Ctrl + D
by default) - Close all files in the directory of the selected buffer
(bound to
Ctrl + Shift + D
andMeta + D
in Curses by default) - The list of buffers is sorted and the current buffer is pre-selected
- The buffers to show can be specified using a function
Functions
currently_selected_buffer (list) | Returns the currently selected buffer in the list. |
close_buffer (list) | Closes the currently selected buffer in the buffer list. |
close_selected (list) | Closes all currently selected/filtered files in the buffer list. |
show (buffers) | Shows a list of the specified buffers, or _G.BUFFERS if not specified. |
Tables
keys | The key bindings for the buffer list. |
Fields
list | The Textredux list instance used by the buffer list. |
Functions
- currently_selected_buffer (list)
-
Returns the currently selected buffer in the list.
Parameters:
- list The Textredux list instance used by the buffer list. If not provided, then the global list is used automatically.
Returns:
- The currently selected buffer, if any.
- The currently selected buffer's name, if any.
- close_buffer (list)
-
Closes the currently selected buffer in the buffer list.
Parameters:
- list The Textredux list instance used by the buffer list. This function is ordinarily invoked as the result of a key binding, and you should thus not need to specify this yourself. If list isn't provided, the global list is automatically used.
- close_selected (list)
-
Closes all currently selected/filtered files in the buffer list.
Parameters:
- list The Textredux list instance used by the buffer list. This function is ordinarily invoked as the result of a key binding, and you should thus not need to specify this yourself. If list isn't provided, the global list is automatically used.
- show (buffers)
-
Shows a list of the specified buffers, or _G.BUFFERS if not specified.
Parameters:
- buffers Either nil, in which case all buffers within _G.BUFFERS are displayed, or a function returning a table of buffers to display.
Tables
- keys
-
The key bindings for the buffer list.
You can modifiy this to customise the key bindings to your liking. The key bindings are passed directly to the Textredux list, so note that the first argument to any function will be the Textredux list itself. You can read more about the Textredux list's keys in the list documentation.
If you like to add a custom key binding for closing a buffer or all buffers in the current selection you can bind the close_buffer and close_selected functions to a key of your choice. For other actions it's likely that you want to obtain the currently selected buffer - you can use the currently_selected_buffer function for that.
Fields:
- [ctrl+d]
Default for
close buffer
- [CURSES]
- [ctrl+d]
Default for