Skip to content

loctvl842/breadcrumb.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 

Repository files navigation

📦 Installation

use("loctvl842/breadcrumb.nvim", requires = {"nvim-tree/nvim-web-devicons"})

⚙️ Configuration

require("breadcrumb").setup({
	disabled_filetype = {
		"",
		"help",
	},
	icons = {
		File = "",
		Module = "",
		Namespace = "",
		Package = "",
		Class = "",
		Method = "",
		Property = "",
		Field = "",
		Constructor = "",
		Enum = "",
		Interface = "",
		Function = "",
		Variable = "",
		Constant = "",
		String = "",
		Number = "",
		Boolean = "",
		Array = "",
		Object = "",
		Key = "",
		Null = "",
		EnumMember = "",
		Struct = "",
		Event = "",
		Operator = "",
		TypeParameter = "",
	},
	separator = ">",
	depth_limit = 0,
	depth_limit_indicator = "..",
    	color_icons = true,
	highlight_group = {
		component = "BreadcrumbText",
		separator = "BreadcrumbSeparator",
	},
})

To have breadcrumb, it must be attached to lsp server.

Example:

local breadcrumb = require("breadcrumb")

local on_attach = function(client, bufnr)
    ...
    if client.server_capabilities.documentSymbolProvider then
        breadcrumb.attach(client, bufnr)
    end
    ...
end

🚀 Usage

  • We can turn on breadcrumb by put this in the config file:
require("breadcrumb").init()
  • Using method get_breadcrumb() combine with status line plugin for example lualine
local breadcrumb = function()
	local breadcrumb_status_ok, breadcrumb = pcall(require, "breadcrumb")
	if not breadcrumb_status_ok then
		return
	end
	return breadcrumb.get_breadcrumb()
end

local config = {
	winbar = {
		lualine_a = {},
		lualine_b = {},
		lualine_c = { breadcrumb },
		lualine_x = {},
		lualine_y = {},
		lualine_z = {},
	},
	inactive_winbar = {
		lualine_a = {},
		lualine_b = {},
		lualine_c = { breadcrumb },
		lualine_x = {},
		lualine_y = {},
		lualine_z = {},
	},
}

lualine.setup(config)

Command

  • BreadcrumbEnable command to enable breadcrumb
  • BreadcrumbDisable command to disable breadcrumb

TODO

  • add default highlight for icons

About

breadcrumb for neovim

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published

Languages