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

feat(ui): unified #718

Closed
wants to merge 10 commits into from
Closed

feat(ui): unified #718

wants to merge 10 commits into from

Conversation

vollowx
Copy link

@vollowx vollowx commented May 6, 2023

  1. Similar appearances for cmp and wilder.
  2. Tidy appearance for bufferline working with nvim-tree and outline (lspsaga).
  3. Colored indent-blankline.
  4. Similar appearances for indent lines in nvim-tree, indent-blankline and outline (lspsaga).
  5. New styles for float windows including Telescope.
  6. Enabled highlights for ts-context, and its mode changed to topline.
  7. Highlight names for alpha changed to the default.

Showcase

Telescope

image

Bufferline and treesitter-context

image

cmp and wilder

image

image

@vollowx vollowx marked this pull request as draft May 6, 2023 11:11
@vollowx vollowx mentioned this pull request May 6, 2023
@ayamir
Copy link
Owner

ayamir commented May 7, 2023

Acceptable, need to be merged before 3.0.0 released.

@vollowx
Copy link
Author

vollowx commented May 7, 2023

Cmp document highlights and cmp menu format updated.

@Saafo
Copy link
Contributor

Saafo commented May 7, 2023

Acceptable, need to be merged before 3.0.0 released.

Seems 3.0 didn't include this pr😢

Any new plans?

@ayamir
Copy link
Owner

ayamir commented May 7, 2023

forgot to call for @Jint-lzxy ...

But after all it is a draft and need more time to discuss, modify and get merged finally.

@vollowx
Copy link
Author

vollowx commented May 7, 2023

There's a new style for lualine but I'm not sure it's mostly acceptable.

image

Tell me if you like this.

(lspsaga outline removed)

@CharlesChiuGit
Copy link
Collaborator

CharlesChiuGit commented May 7, 2023

There's a new style for lualine but I'm not sure it's mostly acceptable.

image

Tell me if you think it's acceptable.

(lspsaga outline removed)

I like this one, but I'm thinking we can add git-blames in the middle of it?

@vollowx
Copy link
Author

vollowx commented May 7, 2023

There's a new style for lualine but I'm not sure it's mostly acceptable.
image
Tell me if you think it's acceptable.
(lspsaga outline removed)

I like this one, but I'm thinking we can add git-blames in the middle of it?

Not sure about this, gitsigns already provides git blame at the end of current line.

@CharlesChiuGit
Copy link
Collaborator

i knw, i just don't like that lol
it's pretty annoying to me.
but it's not my repo, so it's not my call.

@Jint-lzxy
Copy link
Collaborator

There's a new style for lualine but I'm not sure it's mostly acceptable.

image

Tell me if you like this.

(lspsaga outline removed)

Sorry for the delay, I'm also working on this 🤦‍♂️

123456

Several thoughts:

  • Perhaps lualine_y and lualine_z should be kept the same as before? Since they provide important information about document metadata & current cursor location;
  • Loving the reimplementation of lualine_a/b/c, but would it be a bit repetitive to display filename at three different positions (bufferline, lspsaga, lualine)? Maybe we could replace that with show_cwd, but if so, we should support Windows:
    local is_windows = require("core.global").is_windows
    if not is_windows then
    local home = require("core.global").home
  • In terms of file status, I prefer to use glyphs to represent that (instead of occupying lualine_b):
local function is_new_file()
	local filename = vim.fn.expand("%")
	return filename ~= "" and vim.bo.buftype == "" and vim.fn.filereadable(filename) == 0
end
local edit_status = {
	function()
		if vim.bo.modified then
			return icons.lualine.Modified
		elseif not vim.bo.modifiable or vim.bo.readonly then
			return icons.lualine.ReadOnly
		elseif is_new_file() then
			return icons.lualine.NewFile
		else
			return icons.lualine.Normal
		end
	end,
	color = function()
		return {
			fg = vim.bo.modified and colors.green
				or ((not vim.bo.modifiable or vim.bo.readonly) and colors.red or colors.lavender),
			bg = colors.surface0,
		}
	end,
	padding = { left = 1.2, right = 1.3 },
}

@Jint-lzxy
Copy link
Collaborator

I like this one, but I'm thinking we can add git-blames in the middle of it?

@CharlesChiuGit Great idea, but now lualine-c is occupied by git_status. Would adding git_blame result in lualine-c being overcrowded?

@ayamir
Copy link
Owner

ayamir commented May 7, 2023

So should we keep lspsaga winbar symbols showed in lualine? Becase more visual elements are added, and the region of lualine_c will be fully occupied when in a deep embeded position. So the whole lualine looks bloated and can't show the complete lspsaga winbar symbols. Maybe let it just in the winbar will better.

@Jint-lzxy
Copy link
Collaborator

@ayamir I've removed that: #718 (comment). But as a smaller matter, shall we enable symbol_in_winbar.show_file? Otherwise Winbar will be empty when there're no symbols to show (e.g., at init.lua).

Side effect: It will repeat with bufferline.

@ayamir
Copy link
Owner

ayamir commented May 7, 2023

@ayamir I've removed that: #718 (comment). But as a smaller matter, shall we enable symbol_in_winbar.show_file? Otherwise Winbar will be empty when there're no symbols to show (e.g., at init.lua).

Side effect: It will repeat with bufferline.

I prefer to show_file = false.

@CharlesChiuGit
Copy link
Collaborator

CharlesChiuGit commented May 7, 2023

@CharlesChiuGit Great idea, but now lualine-c is occupied by git_status. Would adding git_blame result in lualine-c being overcrowded?

Ys, if the commit is super long then is well be overcrowded.

So should we keep lspsaga winbar symbols showed in lualine? Becase more visual elements are added, and the region of lualine_c will be fully occupied when in a deep embeded position. So the whole lualine looks bloated and can't show the complete lspsaga winbar symbols. Maybe let it just in the winbar will better.

Root for taking winbar back.

I've removed that: #718 (comment). But as a smaller matter, shall we enable symbol_in_winbar.show_file? Otherwise Winbar will be empty when there're no symbols to show (e.g., at init.lua).

Side effect: It will repeat with bufferline.

Personally I think it's fine to disable symbol_in_winbar.show_file.
In terms of user experience, we still need to wait for lsp to give us the diagnostics for few seconds sometimes. So I think it's okay to let the winbar to jitter the window a bit.

@vollowx
Copy link
Author

vollowx commented May 7, 2023

* I'm only free at Chinese weekends, the following 5 days I can't do anything...

@CharlesChiuGit
Copy link
Collaborator

  • I'm only free at Chinese weekends, the following 5 days I can't do anything...

It's okay lol. We all are, well, in a certain level.

@CharlesChiuGit
Copy link
Collaborator

I like the gray-out effect on the git diffs and the smaller gaps between diagnostics.

Other parts I like @Jint-lzxy 's version more.

Not being offensive, just from a pure personal aesthetic perspective.

@Jint-lzxy
Copy link
Collaborator

I like the gray-out effect on the git diffs and the smaller gaps between diagnostics.

Also loving the reimplementation of lualine_a/b/c 😄 I'll merge these two versions into one.

@ayamir
Copy link
Owner

ayamir commented May 7, 2023

I'd like @Jint-lzxy left part and @huge-pancake right part combined personally.

huge-pancake and others added 2 commits May 12, 2023 22:06
@vollowx
Copy link
Author

vollowx commented May 12, 2023

I'm back! Should we merge it soon or we wait for the new lualine config completely done?

My current lualine config

return function()
	local icons = {
		diagnostics = require("modules.utils.icons").get("diagnostics", true),
		misc = require("modules.utils.icons").get("misc", true),
		git = require("modules.utils.icons").get("git", true),
		ui = require("modules.utils.icons").get("ui", true),
	}

	local function diff_source()
		local gitsigns = vim.b.gitsigns_status_dict
		if gitsigns then
			return {
				added = gitsigns.added,
				modified = gitsigns.changed,
				removed = gitsigns.removed,
			}
		end
	end

	local function lsp_status()
		if rawget(vim, "lsp") then
			for _, client in ipairs(vim.lsp.get_active_clients()) do
				if client.attached_buffers[vim.api.nvim_get_current_buf()] and client.name ~= "null-ls" then
					return (vim.o.columns > 100 and "%#St_LspStatus#" .. " LSP [" .. client.name .. "]") or " LSP"
				end
			end
		end
	end

	local function get_cwd()
		local cwd = vim.fn.getcwd()
		local is_windows = require("core.global").is_windows
		if not is_windows then
			local home = require("core.global").home
			if cwd:find(home, 1, true) == 1 then
				cwd = "~" .. cwd:sub(#home + 1)
			end
		end
		return icons.ui.RootFolderOpened .. cwd
	end

	local mini_sections = {
		lualine_a = { "filetype" },
		lualine_b = {},
		lualine_c = {},
		lualine_x = {},
		lualine_y = {},
		lualine_z = {},
	}
	local outline = {
		sections = mini_sections,
		filetypes = { "lspsagaoutline" },
	}
	local diffview = {
		sections = mini_sections,
		filetypes = { "DiffviewFiles" },
	}

	local function python_venv()
		local function env_cleanup(venv)
			if string.find(venv, "/") then
				local final_venv = venv
				for w in venv:gmatch("([^/]+)") do
					final_venv = w
				end
				venv = final_venv
			end
			return venv
		end

		if vim.bo.filetype == "python" then
			local venv = os.getenv("CONDA_DEFAULT_ENV")
			if venv then
				return string.format("%s", env_cleanup(venv))
			end
			venv = os.getenv("VIRTUAL_ENV")
			if venv then
				return string.format("%s", env_cleanup(venv))
			end
		end
		return ""
	end

	local colors = require("modules.utils").get_palette()
	local custom_catppuccin = require("lualine.themes.catppuccin")
	custom_catppuccin.normal.c.fg = colors.overlay0

	require("lualine").setup({
		options = {
			icons_enabled = true,
			theme = custom_catppuccin,
			disabled_filetypes = {},
			component_separators = "",
			section_separators = { left = "", right = "" },
		},
		sections = {
			lualine_a = {
				{
					"mode",
					fmt = function(name)
						return icons.misc.Vim .. name
					end,
				},
			},
			lualine_b = {
				{ "filetype", colored = false, icon_only = true, padding = { left = 1 } },
				{ "filename" },
			},
			lualine_c = {
				{ "branch", icon = string.sub(icons.git.Branch, 1, 4), padding = { left = 1 } },
				{
					"diff",
					colored = false,
					symbols = {
						added = icons.git.Add,
						modified = icons.git.Mod,
						removed = icons.git.Remove,
					},
					source = diff_source,
				},
				-- This can make things after this in section c centered
				-- function()
				-- 	return "%="
				-- end,
			},
			lualine_x = {
				{
					"diagnostics",
					sources = { "nvim_diagnostic" },
					sections = { "error", "warn", "info", "hint" },
					symbols = {
						error = icons.diagnostics.Error,
						warn = icons.diagnostics.Warning,
						info = icons.diagnostics.Information,
						hint = icons.diagnostics.Hint,
					},
				},
				lsp_status,
			},
			lualine_y = {
				get_cwd,
				python_venv,
			},
			lualine_z = { "location" },
		},
		inactive_sections = {
			lualine_a = {},
			lualine_b = {},
			lualine_c = { "filename" },
			lualine_x = { "location" },
			lualine_y = {},
			lualine_z = {},
		},
		tabline = {},
		extensions = {
			"quickfix",
			"nvim-tree",
			"nvim-dap-ui",
			"toggleterm",
			"fugitive",
			outline,
			diffview,
		},
	})
end

@vollowx
Copy link
Author

vollowx commented May 12, 2023

Also IMO the similar things should be in one place, for example, filename, filetype (icon) and file format should be in same place but not place the filename on the left and others on the right. @Jint-lzxy

@CharlesChiuGit
Copy link
Collaborator

Should we merge it soon or we wait for the new lualine config completely done?

i prefer merge when things r settled

@CharlesChiuGit
Copy link
Collaborator

Also IMO the similar things should be in one place, for example, filename, filetype (icon) and file format should be in same place but not place the filename on the left and others on the right. @Jint-lzxy

seems like a gd idea

@Jint-lzxy
Copy link
Collaborator

Also IMO the similar things should be in one place, for example, filename, filetype (icon) and file format should be in same place but not place the filename on the left and others on the right.

Agreed. (#718 (comment))

Should we merge it soon or we wait for the new lualine config completely done?

We need to wait until the upstream PR catppuccin/nvim#481 gets merged. It will introduce many changes.

@ayamir
Copy link
Owner

ayamir commented May 20, 2023

Can't wait to merge it

@Jint-lzxy
Copy link
Collaborator

IMHO we can first merge the commits that won't change their states due to upstream changes (such as cmp, wilder).

@vollowx
Copy link
Author

vollowx commented Jun 2, 2023

IMHO we can first merge the commits that won't change their states due to upstream changes (such as cmp, wilder).

Sure

@vollowx
Copy link
Author

vollowx commented Jun 3, 2023

New style for nvim-tree.

Customized nvim-web-devicons.

image

@vollowx
Copy link
Author

vollowx commented Jun 10, 2023

The other customization will be divided in some other prs, unsure new styles will be discussed at #698.

@vollowx vollowx closed this Jun 10, 2023
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

Successfully merging this pull request may close these issues.

5 participants