amp icon indicating copy to clipboard operation
amp copied to clipboard

Show percentage through the file in the statusline/modeline

Open oldaccountdeadname opened this issue 2 years ago • 3 comments

Not quite sure if there's a proper name for this; here's a screenshot of the new behavior (see the "61%" in the modeline):

screenshot-of-changes

I personally like this, but I don't know if everyone does. Tell me if you'd prefer this to be an option in the config rather than hard-coded!

oldaccountdeadname avatar Oct 23 '21 05:10 oldaccountdeadname

I like it! I have a couple of questions/suggestions:

  • The percentage seems based on the cursor position, but it might be better to use the last visible line of the window. That would prevent the number from changing when the cursor is moved within the window, which feels distracting. I also tend to think of these indicators as answering "how far down in the document am I looking?", which aligns with the window. Any idea what other editors have landed on for this?
  • Does the percentage still display if all of the buffer content fits on-screen? This relates to my earlier point: if it's meant to be an indicator of the how far down the window is looking into the buffer, we should hide it if the answer to that question is obvious.
  • I kinda feel like it might be a better fit at the end of the line, since it's not critical information, unlike the name or editor mode. What do you think?

jmacdonald avatar Jan 23 '22 16:01 jmacdonald

The percentage seems based on the cursor position, but it might be better to use the last visible line of the window. That would prevent the number from changing when the cursor is moved within the window, which feels distracting. I also tend to think of these indicators as answering "how far down in the document am I looking?", which aligns with the window. Any idea what other editors have landed on for this?

Hm, interesting. I hadn't thought of it that way. As for what other editors do, Neovim looks to provide this percentage via the location of the cursor (in src/nvim/buffer.c, line 4022, current HEAD), though I'm not sure about anything else. What would you think about a config toggle for it? I think this might just be a matter of personal taste and/or what people are used to.

Though FWIW, I've been using this basically since I patched it in (add8bbc), and I haven't found the constant changing distracting. The indicator only pops up in normal mode, where the cursor can't really change positions, so I personally like it as is given the extra 'precision' of the cursor. Happy to add in a config option if you think it's a good idea, though.

  • Does the percentage still display if all of the buffer content fits on-screen? This relates to my earlier point: if it's meant to be an indicator of the how far down the window is looking into the buffer, we should hide it if the answer to that question is obvious.

Oh, I hadn't thought of that - done in fc43e26!

  • I kinda feel like it might be a better fit at the end of the line, since it's not critical information, unlike the name or editor mode. What do you think?

Agreed! Done across d7fbd47 and ff0dc68

oldaccountdeadname avatar Jan 23 '22 19:01 oldaccountdeadname

I rebased the commits to fix up the merge conflict. The hashes mentioned above are now out-of-date, but hopefully the log is clear enough - thanks!

oldaccountdeadname avatar Jan 23 '22 21:01 oldaccountdeadname