vlopes11 / rrust.nvim

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RRust

This is a helper tool to record the execution of a Rust test with rr, and replay it using termdebug. For more information, check :h termdebug.

Requirements

Minimum version of neovim: 0.9.0

packadd termdebug

Installation

Plug 'vlopes11/rrust.nvim'

Usage

Position your cursor on a Rust test, and run:

:lua require('rrust').RustRRTestRecord()

It will call rr to record the execution of the test.

To debug the test, run:

:lua require('rrust').RustRRTestReplay()

Etc

I created the following convenience setup:

local rrust = require('rrust')

vim.cmd('packadd termdebug')

vim.keymap.set("n", "<leader>ed", function()
    if rrust.RustRRTestRecord() then
        rrust.RustRRTestReplay()
        vim.cmd([[
            wincmd L
            wincmd h
            vertical resize 73
            wincmd l
            stopinsert
        ]])
    end
end)

vim.keymap.set('n', '<F4>', function() vim.cmd('Stop') end)
vim.keymap.set('n', '<F5>', function() vim.cmd('Continue') end)
vim.keymap.set('n', '<F6>', function() vim.cmd('Finish') end)
vim.keymap.set('n', '<F7>', function() vim.cmd('Step') end)
vim.keymap.set('n', '<F8>', function() vim.cmd('Over') end)
vim.keymap.set('n', '<F9>', function() vim.cmd('Break') end)
vim.keymap.set('n', '<F10>', function() vim.cmd('Evaluate') end)

output

About

License:GNU General Public License v3.0


Languages

Language:Lua 100.0%