Giter Club home page Giter Club logo

messages.nvim's Introduction

messages.nvim

Capture and show any messages in a customisable (floating) buffer.

gscreenshot_2022-09-18-134000

Installation

For example using packer:

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:

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:

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.

messages.nvim's People

Contributors

acksld avatar dsully avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.