A Neovim plugin that provides YAML breadcrumb navigation, showing the hierarchical path to your current position in YAML files.
- π Visual breadcrumb display - Shows the current YAML path as virtual text
- π Auto-update on cursor movement - Breadcrumb updates as you navigate through the file
- π’ Array index tracking - Handles YAML arrays with proper indexing (
[0],[1], etc.) - π― Line number integration - Optional display of line numbers in breadcrumb
- β¨οΈ Customizable keymaps - Default keybindings with full customization support
- π¨ Configurable appearance - Custom separators, highlight groups, and formatting
- π§ Statusline integration - Export breadcrumb to your statusline
- π©Ί Health check support - Built-in health check command
Using lazy.nvim
{
"vasuadari/yaml-breadcrumb.nvim",
ft = { "yaml", "yml" },
config = function()
require("yaml-breadcrumb").setup({
-- your configuration here
})
end,
}Using packer.nvim
use {
"vasuadari/yaml-breadcrumb.nvim",
ft = { "yaml", "yml" },
config = function()
require("yaml-breadcrumb").setup()
end
}Using vim-plug
Plug 'vasuadari/yaml-breadcrumb.nvim'require("yaml-breadcrumb").setup({
enabled = true, -- Enable/disable the plugin
show_on_cursor_move = true, -- Auto-update breadcrumb on cursor movement
virtual_text = true, -- Show breadcrumb as virtual text
separator = " -> ", -- Separator between breadcrumb items
show_line_numbers = false, -- Show line numbers in breadcrumb
highlight_group = "Comment", -- Highlight group for virtual text
})| Option | Type | Default | Description |
|---|---|---|---|
enabled |
boolean | true |
Enable or disable the plugin |
show_on_cursor_move |
boolean | true |
Automatically update breadcrumb when cursor moves |
virtual_text |
boolean | true |
Display breadcrumb as virtual text at end of line |
separator |
string | " -> " |
String used to separate breadcrumb components |
show_line_numbers |
boolean | false |
Include line numbers in breadcrumb display |
highlight_group |
string | "Comment" |
Neovim highlight group for virtual text styling |
The plugin provides the following commands:
:YamlBreadcrumb- Show breadcrumb for current line in a notification:YamlBreadcrumbToggle- Toggle the plugin on/off:YamlBreadcrumbHealth- Run health check to verify plugin status
| Key | Mode | Action |
|---|---|---|
<leader>yb |
Normal | Show YAML breadcrumb |
<leader>yt |
Normal | Toggle YAML breadcrumb |
You can set up your own keymaps:
vim.keymap.set("n", "<your-key>", function()
require("yaml-breadcrumb").show_breadcrumb()
end, { desc = "Show YAML breadcrumb" })
vim.keymap.set("n", "<your-key>", function()
require("yaml-breadcrumb").toggle()
end, { desc = "Toggle YAML breadcrumb" })For this YAML file:
apiVersion: v1
kind: ConfigMap
metadata:
name: my-config
namespace: default
data:
config.yaml: |
database:
host: localhost
port: 5432When your cursor is on the port: 5432 line, the breadcrumb would show:
π apiVersion > kind > metadata > data > config.yaml > database > port
For this YAML file:
users:
- name: john
email: john@example.com
roles:
- admin
- user
- name: jane
email: jane@example.comWhen your cursor is on email: jane@example.com, the breadcrumb would show:
π users > [1] > email
With show_line_numbers = true, the same breadcrumb would show:
π users (L1) > [1] (L8) > email (L9)
You can integrate the breadcrumb into your statusline:
require('lualine').setup {
sections = {
lualine_c = {
'filename',
function()
return require('yaml-breadcrumb').get_current_breadcrumb()
end
}
}
}vim.o.statusline = vim.o.statusline .. '%{luaeval("require(\'yaml-breadcrumb\').get_current_breadcrumb()")}'Create custom highlight groups for better visual integration:
-- Define custom highlight
vim.api.nvim_set_hl(0, "YamlBreadcrumb", {
fg = "#61AFEF",
bg = "NONE",
italic = true
})
-- Use in configuration
require("yaml-breadcrumb").setup({
highlight_group = "YamlBreadcrumb",
})Enable only for specific file patterns:
require("yaml-breadcrumb").setup({
enabled = vim.fn.expand("%:t"):match(".*%.ya?ml$") ~= nil,
})Run the health check to diagnose issues:
:YamlBreadcrumbHealth- Breadcrumb not showing: Ensure you're in a YAML file (
.yamlor.ymlextension) - Virtual text not appearing: Check that
virtual_text = truein your configuration - Incorrect indentation detection: The plugin uses space-based indentation detection
Enable debug notifications to see what the plugin detects:
-- The plugin includes debug output in the show_breadcrumb() function
-- Use :YamlBreadcrumb to see debug information- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Add tests if applicable
- Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Inspired by IDE breadcrumb navigation features
- Built for the Neovim community
- Thanks to all contributors and testers
Note: This plugin requires Neovim 0.7+ for virtual text support and modern Lua APIs.