Skip to content

[WIP] Center the whole menu#401

Open
mhinz wants to merge 1 commit into
masterfrom
center
Open

[WIP] Center the whole menu#401
mhinz wants to merge 1 commit into
masterfrom
center

Conversation

@mhinz

@mhinz mhinz commented Nov 19, 2019

Copy link
Copy Markdown
Owner

This is a PR for playing around with centering the menu.

Introduces: g:startify_center. This option should be set to the longest line you expect in the menu. Values between 50 - 80 probably make sense. Just play around a bit.

@zdcthomas

Copy link
Copy Markdown

Just fyi I've been using this branch for a while now with no problems

@rockyzhang24

rockyzhang24 commented Dec 21, 2021

Copy link
Copy Markdown

Nice feature. Can't wait. Please merge, please.

@Jay1

Jay1 commented Dec 26, 2021

Copy link
Copy Markdown

I've been running this at work for a while with my colleagues.
Nothing to report, you can merge as you see fit.

@Andy3153

Copy link
Copy Markdown

How would I go about using this in my configuration to center my menu as well? So, there's this new variable, but how can I use it? I didn't find anything in :h startify mentioning this..

@mxaddict

Copy link
Copy Markdown

Was this ever merged into master?

@nerun

nerun commented Jul 15, 2023

Copy link
Copy Markdown

2023
I have added the changes to the current master branch. Not working. For example, setting let g:startify_center=80 make the cursor cannot go back from a certain column, but the text remains in the same place.

@2hexed

2hexed commented Sep 28, 2024

Copy link
Copy Markdown

Hello, I would really love to have this feature. Will it ever be merged?

@akhdanfadh

Copy link
Copy Markdown

The custom headers is not centered in this branch, here is my minimal lazy.nvim config that works:

return {
  "mhinz/vim-startify",
  branch = "center",
  config = function()
    vim.g.startify_center = 50

    local function get_padding()
      local padding_left = 3
      if vim.g.startify_center then
        padding_left = math.floor((vim.fn.winwidth("%") - vim.g.startify_center) / 2)
      end
      return string.rep(" ", padding_left)
    end

    vim.g.startify_lists = {
      { type = "sessions", header = { get_padding() .. "Sessions" } },
      { type = "dir", header = { get_padding() .. "Most Recently Used (MRU)" } },
      { type = "dir", header = { get_padding() .. "(MRU) " .. vim.fn.getcwd() } },
      { type = "bookmarks", header = { get_padding() .. "Bookmarks" } },
    }
  end,
}

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.

9 participants