Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Templating the statusline #224

Closed
wants to merge 5 commits into
from

Conversation

Projects
None yet
2 participants

jdeniau commented Jul 11, 2012

Hello,

This pull request allows to "template" the statusline method.
Usually, the statusline show something like "[Git(master)]", you can now add a argument to the method call to change this :

Exemple : %{fugitive#statusline("[%status%]")} will output just : "[master]".

The default value will still be [Git(%status%)]

Owner

tpope commented Jul 11, 2012

Not a bad start but this needs some more thought. For starters, you've changed the existing format from [Git:commit(branch)] to [Git(commit:branch)], which is an unacceptable regression.

More fundamentally, %status% is a pretty meaningless name. Much better would be something like fugitive#statusline('[Git%commit%(%branch%)]'). Though I think I'd rather just use single character codes as opposed to those ambiguous names, resulting in a final format like fugitive#statusline('[Git%c(%b)]').

Mind you, if all you want is the branch in your prompt, you can just use fugitive#head().

jdeniau commented Jul 11, 2012

You are right, it's best to separate the "branch" and the "commit" (to be honest, I did not understand when the "commit" is shown !).

And yes, the fugitive#head() is the method I was looking for.

So I put a %c and %b arguments.

@jdeniau jdeniau closed this Apr 24, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment