Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/AckslD/messages.nvim
Capture and show any messages in a customisable (floating) buffer
https://github.com/AckslD/messages.nvim
Last synced: about 1 month ago
JSON representation
Capture and show any messages in a customisable (floating) buffer
- Host: GitHub
- URL: https://github.com/AckslD/messages.nvim
- Owner: AckslD
- Created: 2022-09-18T11:30:33.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-07-20T11:03:25.000Z (10 months ago)
- Last Synced: 2024-01-24T10:41:18.778Z (4 months ago)
- Language: Lua
- Size: 22.5 KB
- Stars: 85
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Lists
- awesome-neovim - AckslD/messages.nvim - Capture and show any messages in a customisable (floating) buffer. (Utility / Cursorline)
- awesome-stars - AckslD/messages.nvim - Capture and show any messages in a customisable (floating) buffer (Lua)
- awesome-stars - AckslD/messages.nvim - Capture and show any messages in a customisable (floating) buffer (Lua)
- awesome-stars - AckslD/messages.nvim - Capture and show any messages in a customisable (floating) buffer (Lua)
- awesome-stars - AckslD/messages.nvim - Capture and show any messages in a customisable (floating) buffer (Lua)
- awesome-neovim - AckslD/messages.nvim - Capture and show any messages in a customisable (floating) buffer. (Utility / Cursorline)
- awesome-neovim - AckslD/messages.nvim - Capture and show any messages in a customisable (floating) buffer. (Utility / Cursorline)
README
# messages.nvim
Capture and show any messages in a customisable (floating) buffer.![gscreenshot_2022-09-18-134000](https://user-images.githubusercontent.com/23341710/190900297-3914fddd-cf39-49b1-b870-642b80b389f1.png)
## Installation
For example using [`packer`](https://github.com/wbthomason/packer.nvim):
```lua
use {
'AckslD/messages.nvim',
config = 'require("messages").setup()',
}
```## Usage
Prefix and command with `Messages`, for example:
```
:Messages messages
```You can also pass any lua object to `require('messages.api').capture_thing`. A tip is to add the following global function in your config:
```lua
Msg = function(...)
require('messages.api').capture_thing(...)
end
```
Then you can do for example
```
:lua Msg(vim.lsp)
```## Configuration
Pass a dictionary into `require("messages").setup()` with callback functions.
These are the defaults:
```lua
require('messages').setup({
command_name = 'Messages',
-- should prepare a new buffer and return the winid
-- by default opens a floating window
-- provide a different callback to change this behaviour
-- @param opts: the return value from float_opts
prepare_buffer = function(opts)
local buf = vim.api.nvim_create_buf(false, true)
return vim.api.nvim_open_win(buf, true, opts)
end,
-- should return options passed to prepare_buffer
-- @param lines: a list of the lines of text
buffer_opts = function(lines)
local gheight = vim.api.nvim_list_uis()[1].height
local gwidth = vim.api.nvim_list_uis()[1].width
return {
relative = 'editor',
width = gwidth - 2,
height = clip_val(1, #lines, gheight * 0.5),
anchor = 'SW',
row = gheight - 1,
col = 0,
style = 'minimal',
border = 'rounded',
zindex = 1,
}
end,
-- what to do after opening the float
post_open_float = function(winnr)
end
})
```## Credit
@AndrewRadev for creating https://github.com/AndrewRadev/bufferize.vim which inspired this.