lualine.nvim icon indicating copy to clipboard operation
lualine.nvim copied to clipboard

Feat: git worktree component

Open OscarCreator opened this issue 1 year ago • 4 comments

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 worktrees it would be useful to see which worktree you are currently on.

OscarCreator avatar Oct 30 '23 15:10 OscarCreator

It works with the branch component for me. Can you include some steps to reproduce your issue?

This is what has worked for me:

  1. git clone --bare https://github.com/nvim-lualine/lualine.nvim && cd $_ Now we have a bare repo of lualine.nvim
  2. git add worktree test_work_tree master Create a worktree on branch master
  3. nvim README.md
Schermata 2023-11-01 alle 17 40 46

If this is not what you desire, let me know I'm happy to help! 😀

25d96b avatar Nov 01 '23 16:11 25d96b

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

OscarCreator avatar Nov 01 '23 17:11 OscarCreator

Something like this?

Schermata 2023-11-01 alle 22 57 49

I have maintained the same icon as the branch because I'm unable to find a specific symbol for worktrees.

25d96b avatar Nov 01 '23 22:11 25d96b

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.

OscarCreator avatar Nov 02 '23 05:11 OscarCreator