A Neovim plugin that helps you debug Elixir code by quickly inserting IO.inspect/2
statements with the current function name as label.
- Quickly insert
IO.inspect
statements with customizable prefix symbol - Automatically detects and uses current function name as label
- Maintains proper indentation
Using lazy.nvim:
{
"apayu/nvim-elixir-inspect",
config = function()
require("elixir-inspect").setup()
end,
}
Using packer.nvim:
use {
"apayu/nvim-elixir-inspect",
config = function()
require("elixir-inspect").setup()
end
}
The plugin comes with these defaults:
require("elixir-inspect").setup({
-- Symbol prefix for IO.inspect output
symbol = "🔍 >>>>>>>",
-- Default insert mode keymap
keymap_insert = "<C-e>i"
})
Use the :InsertIOInspect
command to insert an IO.inspect statement at the current cursor position.
In insert mode, press <C-e>i
(or your configured keymap) to insert an IO.inspect statement.
If you're in a function named process_data
, the plugin will insert:
IO.inspect("🔍 >>>>>>>", label: "process_data")
The inserted statement will maintain the current line's indentation.
You can customize the plugin behavior by passing options to the setup function:
require("elixir-inspect").setup({
-- Change the inspect prefix symbol
symbol = "DEBUG >>>",
-- Change or disable the insert mode keymap
keymap_insert = "<C-x>i", -- or set to false to disable
})