@@ -41,21 +41,25 @@ navic.setup {
4141}
4242
4343-- copy breadcrumb to clipboard
44- keymap .set (' n' , ' <leader>yb' ,
45- function ()
44+ keymap .set (' n' , ' <leader>yb' , function ()
45+ local ok , err = pcall ( function ()
4646 local bufnr = vim .api .nvim_get_current_buf ()
4747 local breadcrumb = ' '
4848 if navic .is_available (bufnr ) then
4949 local navic_data = navic .get_data (bufnr )
5050 for _ , comp in ipairs (navic_data ) do
51- -- if comp.name contains '.' then put '' around it
51+ print ( comp .name )
5252 if string.find (comp .name , ' %.' ) then
53- comp .name = ' \' ' .. comp .name .. ' \' '
53+ comp .name = " ' " .. comp .name .. " ' "
5454 end
5555 breadcrumb = breadcrumb .. ' .' .. comp .name
5656 end
5757 end
5858 vim .fn .setreg (' *' , breadcrumb )
59- end ,
60- { noremap = true , silent = true , desc = ' Copy breadcrumb to clipboard' }
61- )
59+ vim .notify (' Breadcrumb copied: ' .. breadcrumb )
60+ end )
61+
62+ if not ok then
63+ vim .notify (' Error: ' .. tostring (err ), vim .log .levels .ERROR )
64+ end
65+ end , { noremap = true , silent = true , desc = ' Copy breadcrumb to clipboard' })
0 commit comments