Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Returning a statusline item from a component function #675

Closed
mihaifm opened this issue Mar 24, 2024 · 2 comments
Closed

Returning a statusline item from a component function #675

mihaifm opened this issue Mar 24, 2024 · 2 comments

Comments

@mihaifm
Copy link

mihaifm commented Mar 24, 2024

Hi and thanks for this great plugin!

Is there a way to return a statusline item from a component function?
For example, this doesn't work:

func! LightPercent()
   return '%P'
endfunc

It just displays %P in the statusline, instead of the percent. I can't set the component to %P directly because I want to have additional logic in the component function.

@itchyny
Copy link
Owner

itchyny commented Mar 24, 2024

This is impossible. Use printf('%2d%%', line('.') * 100 / line('$')) for your case.

@mihaifm
Copy link
Author

mihaifm commented Mar 25, 2024

thanks

@mihaifm mihaifm closed this as completed Mar 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants