/visidata.nvim

A plugin for neovim to render pandas dataframes in nvim-dap using the power of visidata.

Primary LanguageLuaGNU General Public License v3.0GPL-3.0

visidata.nvim

A plugin for neovim to render pandas dataframes in nvim-dap using the power of visidata.

Installation

  • Requires nvim-dap
  • Requires visidata to be available in the active python environment
  • Install like any other neovim plugin:
    # Using: lazy
    {
         "Willem-J-an/visidata.nvim",
        dependencies = {
            "mfussenegger/nvim-dap",
            "rcarriga/nvim-dap-ui"
        },
        config = function()
            local dap = require("dap")
            dap.defaults.fallback.external_terminal = {
                command = "<Path to your terminal of choice>",
                args = { "--hold", "--command" },
            }
            vim.keymap.set("v", "<leader>vp", require('visidata').visualize_pandas_df, { desc = "[v]isualize [p]andas df" })
        end,
    }

Usage

  1. Configure an external-terminal for nvim-dap
  2. Configure a keymap to execute the visualize_pandas_df function.
  3. Configure your dap session to use externalTerminal:
{
    "name": "Python: Current File",
    "type": "python",
    "request": "launch",
    "program": "${file}",
    "console": "externalTerminal"
}
  1. Debug your code as usual, load a pandas dataframe, add a breakpoint after it.
  2. Select the pandas dataframe and execute the keymap.