netrw_target.lua (602B)
1 function TargetDir() 2 local target = vim.api.nvim_call_function('netrw#Expose', { 'netrwmftgt' }) 3 if target == 'n/a' then 4 return 'No target set' 5 else 6 target = target:gsub("^" .. vim.loop.os_homedir(), "~") 7 return 'Target: ' .. target .. ' ' 8 end 9 end 10 11 vim.api.nvim_create_augroup('netrw_target', { clear = true }) 12 vim.api.nvim_create_autocmd('FileType', { 13 group = 'netrw_target', 14 pattern = 'netrw', 15 callback = function() 16 vim.opt_local.winbar = '%!v:lua.WinBarNetRW()' 17 end 18 }) 19 20 WinBarNetRW = function() 21 return table.concat { 22 '%#StatusLineNC#', 23 TargetDir(), 24 } 25 end