AckslD / swenv.nvim

Tiny plugin to quickly switch python virtual environments from within neovim without restarting.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to use the swenv component in lualine?

desilinguist opened this issue · comments

Sorry, I am new to neovim so it's not obvious to me how to use the lualine component provided by this plugin? It'd be great if this was in the documentation too.

Never mind. It works.

Happy to hear it worked! :) If you have a snippet you think would be useful for others. Feel free to open a PR to add it to the README.

hey! does the icon work though? I use a jetbrains nerd font and it doesn't seem to render the icon. Is it possible to change the icon through config?

@skolj, I see I didn't expose any configuration for this but could easily be done. Is that something you would like contribute with :)

Sure, I'd be happy to help! However, it looks like I can use the default icon component option and customize it. But the hardcoded icon and highlight from the swenv component are still there.

This line in my config
image

gives me this result.
image

Do you need help with any changes?

Maybe the lualine plugin should be restructured, I honestly wasn't fully sure how it should look like so I put the icon directly in the string returned from update_status:

return string.format('%s %s', highlight.component_format_highlight(self.color), venv.name)

Maybe only the venv name should be returned and icons etc go into self.options in init? Any thoughts on this?

yeah, that'd be nice I guess. I could move the hardcoded icon to default icon option. Also, do we really need a default highlight?

Sounds good @skolj, yeah maybe default highlight is not needed indeed and the user can set that instead

Created a PR as discussed :) let me know if anything needs updating.

Thanks both to the work on the icon stuff. Can one of you help me the last bit? I prefer no icon. Here is my sections part from the lualine config:

  sections = {
    lualine_a = {'mode'},
    lualine_b = {'branch', 'diff', 'swenv', icon=''},
    lualine_c = {'filename'},
    lualine_x = {'filetype'},
    lualine_y = {'searchcount'},
    lualine_z = {'progress'}
  },

But that does not work.

@DanielAndreasen wrap swenv component in braces, i.e., lualine_b = {'branch', 'diff', { 'swenv', icon='' } },

Perfect - thanks for the reply. Works like a charm