Skip to content

How to shorten the branch name to 40 characters if not enough space? #894

Answered by fitrh
alexventuraio asked this question in Q&A
Discussion options

You must be logged in to vote

You can use the fmt component options

{
    "branch",
    fmt = function(str)
        if vim.api.nvim_strwidth(str) > 40 then
            return ("%s…"):format(str:sub(1, 39))
        end

        return str
    end,
}

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@alexventuraio
Comment options

Comment options

You must be logged in to vote
2 replies
@alexventuraio
Comment options

@fitrh
Comment options

Answer selected by alexventuraio
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants