lualine.nvim
lualine.nvim copied to clipboard
Feat: git worktree component
Requested feature
Add worktree
component https://github.com/nvim-lualine/lualine.nvim/blob/master/doc/lualine.txt#L240
Motivation
When using a bare
git repo with multiple worktree
s it would be useful to see which worktree you are currently on.
It works with the branch
component for me.
Can you include some steps to reproduce your issue?
This is what has worked for me:
-
git clone --bare https://github.com/nvim-lualine/lualine.nvim && cd $_
Now we have a bare repo of lualine.nvim -
git add worktree test_work_tree master
Create a worktree on branch master -
nvim README.md
If this is not what you desire, let me know I'm happy to help! 😀
The worktree I mean in this case is test_work_tree
. So a way to display that folder name is what I am after.
Something like this could the status bar look like:
NORMAL | master | test_work_tree | README.md
It can be evaluated with:
function()
local res, match = vim.fn.FugitiveGitDir():gsub(".*worktrees/", "")
if match == 1 then
return res
else
return ""
end
end
Something like this?
I have maintained the same icon as the branch because I'm unable to find a specific symbol for worktrees.
Yes something like that. I have to see if I can find a symbol for it, otherwise it can just be changed (or removed) at a later time.