Home

Awesome

CI Status <a href="https://dotfyle.com/plugins/idanarye/nvim-blunder"> <img src="https://dotfyle.com/plugins/idanarye/nvim-blunder/shield" /> </a>

INTRODUCTION

Neovim's :make command can parse the output from a shell command to generate entries for the quickfix list. :make uses the non-interactive shell, which means that:

Blunder allows using Neovim's builtin interactive terminal for the same purpose. This means that the build commands can fully utilize the PTY, and that the terminal buffer remains open and the text in it can be searched and scrolled using Neovim's full power.

asciicast

INSTALLATION

Install idanarye/nvim-blunder using your favorite plugin manager, and in your init.lua call:

require'blunder'.setup {
    -- Default settings
    formats = {},
    fallback_format = ..., -- reducted - its very long
    commands_prefix = 'B',
}

This will configure Blunder register the commands |:Bmake| and |:Brun|.

USAGE

USAGE WITH CHANNELOT (AND MOONICIPAL)

Channelot is a plugin that streamlines running shell commands in a Neovim terminal. It needs to be run in a coroutine - or in a Moonicipal task, since Moonicipal runs its tasks in coroutines, and Channelot was made to work well with Moonicipal.

ChannelotJob has a using method, which Blunder's for_channelot can use to parse the output of a the job into the quickfix list. To combine it inside a Moonicipal task, add something like this to the Moonicipal tasks file:

local blunder = require'blunder'
local channelot = require'channelot'

function T:run()
    -- This will create a window for running the shell commands.
    blunder.create_window_for_terminal()

    -- This will create a terminal in the window, prompt the user to close it
    -- once all the jobs finish, and handle the `check` method calls inside it
    -- by properly displaying in the terminal the exit status of a failed shell
    -- command.
    channelot.terminal():with(function(t)
        -- When running gcc, use Blunder to parse the output.
        t:job{'gcc', 'main.c'}:using(blunder.for_channelot):check()
        -- ./a.out runs without blunder, so its output won't get parsed into
        -- the quickfix list.
        t:job{'./a.out'}:check()
    end)
end

CONTRIBUTION GUIDELINES