-
Notifications
You must be signed in to change notification settings - Fork 187
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
Centralize splash screen horizontally #400
Comments
Unfortunately that's not easily possible right now. Startify adds lines one after the other. This is done on purpose, because then even when you have slow disk I/O or network drive access, you can actually see stuff happening when the Startify buffer is "loading". For centralizing, all lines would have to be collected in a list first, because one have to find out the longest line. But given the slow I/O example, then, when using You can set The design of adding lines one after the other won't change, but I try to think about this some more anyway. Maybe there's another way. (Ideas welcome!) I would be possible to centralize after everything loaded normally, but then you would shortly see all lines on the left side before they get moved to the middle. This also involves resetting the syntax, because it relies on fixed columns. Probably not a nice experience. |
Hi, thanks for the really fast feedback! I see your point and it does make sense. But I think there's a solution - you should not have to wait for all lines to be read before deciding on a left padding, simply because the centralization could be approximate. Here's my suggestion. Give users the option to specify the max characters the splash screen' width should have and then centralize based on that (in case users turn the option on). For example, suppose that I set in the config the splash screen to have 80 chars per line. Then, Startify could detect via code how many characters the current buffer is displaying horizontally. Say it is 105. Then, the left-padding is automatically set to int((105-80)/2). Sure, this has the caveat that lines longer than (for example) 80 chars would not be displayed in their entirety and could only have their hidden part see when one navigates to them and go to the right with the cursor. But this is true no matter what, if the Vim window has less width than the line. Also, since my suggestion is for that to be an optional feature, users will be obviously aware of the trade-off when choosing to set a "max_width" to their splash screen. Alternatively, but less ideal, I do think your suggested workaround (centralize after reading the lines) could end up working, if it were an optional feature. For instance, if users don't have a problem with disk I/O, then having the read content centralized in the end could work well because in all cases I tried it reads really fast. Naturally, that would be an optional feature turned off by default. Another possible option is to also give the additional option of having Startify display its content only after everything is read and centralized.make possible to only display the content after it is all loaded (and centralized). I would certainly turn both on, since in my case at least Startify generates the splash screen really fast. Let me know what you think. |
Let's just start playing around a bit! Have a look at #401 It's just a proof of concept. Much left to improve. |
Wow, that was fast! So, let me thank you via testing and giving feedback. Just downloaded the files directly and tested. Up to specifying 80 chars, the line-centering works perfectly, with one exception: custom headers do not get aligned. Above 80 chars, the alignment becomes off, which is to be expected because then there is the natural extra space to the right due to no lines being long enough. See attached pics (first at 80, second at 120). |
Oh, also note that in your description given to the test branch you named the config option |
Another feedback: while the centralization seems to work consistently in Vim, it is more inconsistent in gVim. By that I mean: in gVim, sometimes I open it and the splash screen is centralized, sometimes I open it and the splash screen is to the left. |
😱Please use a plugin manager like vim-plug. Then you could just put
Yup, that's to be expected. I consider this a documentation issue. This is just an approximation, so people need to play around a bit to find their perfect value which probably is between 50 to 80.
Right, I'll look into this.
Oops! That's what you get for constantly switching between projects.
Hmm, I play around with it in my Ubuntu VM, but I guess somehow gVim's window size is changed at start, e.g. the window gets maximized? Could be a race issue. |
Ah, I just noticed that the "custom header not centered" issue is already solved. The
This makes the header use the exact same padding as the rest of the menu. |
Hi @mhinz, I was taking a look at this and found out that using I found it weird, as default headers were working just fine, so I took a look at the code and found a solution, here is my proposal:
(Remove the
This will cause the custom headers to work as expected (at least on my opinion) This may not be the best approach 🤷♂ |
Also, the custom header doesn't get centered, for that I found that this works: Line 87-90:
|
Alternatively, startify could display several columns to use the width: it does feel awkward to have all this right space empty. |
Any updates on this? I'm currently using the branch so I can use this feature... Custom headings not being aligned is what's annoying me right now though. I'd be glad to help if I get some pointers where to look. |
I too would like to have this feature, it's not a deal breaker by any means, but it would help have a nicer feel. Thank you for this amazing "Dashboard" |
I'm looking forward to having this feature! I tried the I was able to get some sort of centralization of the "splash screen" by using let g:startify_custom_header =
\ 'startify#center(startify#fortune#cowsay())'
let g:startify_lists = [
\ { 'type': 'dir', 'header': startify#center(['MRU '.getcwd()]) },
\ { 'type': 'sessions', 'header': startify#center(['Sessions']) },
\ { 'type': 'files', 'header': startify#center(['MRU']) },
\ { 'type': 'bookmarks', 'header': startify#center(['Bookmarks']) },
\ { 'type': 'commands', 'header': startify#center(['Commands']) },
\ ]
let g:startify_padding_left = 68 " Hard coded padding for lists PS: I changed the order of the lists. |
Not sure if this project is maintained so, after a lot of searching, I moved to using mini.starter. It recognised my sessions and got it to where I wanted with minimal configuration. My config: local header_art =
[[
╭╮╭┬─╮╭─╮┬ ┬┬╭┬╮
│││├┤ │ │╰┐┌╯││││
╯╰╯╰─╯╰─╯ ╰╯ ┴┴ ┴
]]
-- using the mini plugins
require('mini.sessions').setup({
-- Whether to read latest session if Neovim opened without file arguments
autoread = false,
-- Whether to write current session before quitting Neovim
autowrite = false,
-- Directory where global sessions are stored (use `''` to disable)
directory = '~/.vim/sessions', --<"session" subdir of user data directory from |stdpath()|>,
-- File for local session (use `''` to disable)
file = '' -- 'Session.vim',
})
local starter = require('mini.starter')
starter.setup({
-- evaluate_single = true,
items = {
starter.sections.sessions(77, true),
starter.sections.builtin_actions(),
},
content_hooks = {
function(content)
local blank_content_line = { { type = 'empty', string = '' } }
local section_coords = starter.content_coords(content, 'section')
-- Insert backwards to not affect coordinates
for i = #section_coords, 1, -1 do
table.insert(content, section_coords[i].line + 1, blank_content_line)
end
return content
end,
starter.gen_hook.adding_bullet("» "),
starter.gen_hook.aligning('center', 'center'),
},
header = header_art,
footer = '',
})
Apologies for being off topic in regards to the current repo but I thought it may be useful to someone. |
First of all, thanks for this amazing VIM plugin. It is a simple but crazy useful idea, that brings VIM way closer to being a full IDE.
My only request/question: is there a way to have the splash screen auto centralized? When Vim or GVim are expanded, attached is an example of how it looks like. I find it particularly relevant because I set my GVim to re-display Startify whenever all buffers are closed.
Thanks a lot!
The text was updated successfully, but these errors were encountered: