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

Status Line Integration #44

Open
sanchit1053 opened this issue Sep 25, 2023 · 2 comments
Open

Status Line Integration #44

sanchit1053 opened this issue Sep 25, 2023 · 2 comments

Comments

@sanchit1053
Copy link

Hello,
Can you please explain how to integrate statusline variables name using lualine, that is what is your configuration to produce the second screenshot in the README?
For me the status line shows the name of the file when it is not active which I would like to keep, but change the statusline only if your buffer variable is set,
Thanks

@xeluxee
Copy link
Owner

xeluxee commented Sep 25, 2023

See https://github.com/xeluxee/competitest.nvim#statusline-and-winbar-integration
I use feline, but lualine configuration shouldn't be much different:

  1. Create a statusline for filetype CompetiTest
  2. Create a component that shows the value of vim.b.competitest_title

Here's my config for feline:

conditional_components = {
	{
		condition = function()
			return vim.bo.filetype == "CompetiTest"
		end,
		inactive = {
			{
				{
					provider = "",
					hl = { bg = "bg" },
				},
			},
			{
				{
					left_sep = "slant_left",
					provider = function()
						return vim.b.competitest_title or "CompetiTest"
					end,
					hl = { fg = "main_fg", bg = "main_bg" },
					right_sep = "slant_right",
				},
			},
			{},
		},
	},
},

@hedyhli
Copy link

hedyhli commented Oct 24, 2023

This is my setup for lualine:
image

-- Custom extension
local competitest_line = {
  filetypes = {'CompetiTest'},
  sections = {
    lualine_b = { function()
                    return vim.b.competitest_title or 'CompetiTest'
                  end },
    lualine_y = {'searchcount'},
    lualine_z = {lineinfo},
  },
  inactive_sections = {
    lualine_b = { function()
                    return vim.b.competitest_title or 'CompetiTest'
                  end },
  },
}

-- Add extension to your require('lualine').setup block
require('lualine').setup { extensions = {competitest_line} }

Alternatively, if you want to have the same statusline for when a window is focused or when it is inactive:

local competitest_line = {
  filetypes = {'CompetiTest'},
  inactive_sections = {
    lualine_b = { function()
                    return vim.b.competitest_title or 'CompetiTest'
                  end },
  },
}

require('lualine').setup {
  ignore_focus = {'CompetiTest'},
  extensions = {competitest_line},
}

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

3 participants