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

[WIP] Center the whole menu #401

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

[WIP] Center the whole menu #401

wants to merge 1 commit into from

Conversation

mhinz
Copy link
Owner

@mhinz mhinz commented Nov 19, 2019

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

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

@rockyzhang24
Copy link

rockyzhang24 commented Dec 21, 2021

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

@Jay1
Copy link

Jay1 commented Dec 26, 2021

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

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

Was this ever merged into master?

@nerun
Copy link

nerun commented Jul 15, 2023

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
Copy link

2hexed commented Sep 28, 2024

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

@akhdanfadh
Copy link

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