git-blame.nvim icon indicating copy to clipboard operation
git-blame.nvim copied to clipboard

Align virtual text

Open jchilders opened this issue 3 years ago • 6 comments

This is a solid plugin. Very fast.

Small request: would it be possible to add an option have the virtual text right justify itself? Currently the text appears immediately following the line you are on, with a single space separating the physical EOL and the beginning of the virtual text. It would be nice if there were a way to adjust that.

jchilders avatar Mar 21 '21 20:03 jchilders

I'm not sure I understood how you would like the text to be justified. Do you want more space or what? Do you know any vim plugins which display virtual text the way you want?

f-person avatar Mar 24 '21 06:03 f-person

You can customize the message template with

let g:gitblame_message_template = 'format'

Please refer to this section of the README for more details. You can add as much spacing as you want (or a tab maybe). If this is what you wanted, please close the issue, if not, please explain with a little more details. Thanks!

f-person avatar Mar 24 '21 07:03 f-person

So say your display is 100 characters wide. You have the following code:

puts “Hello”

I decide to have my format string set to “%a”, the abbreviated day name. Now, since our git-blame text will be three characters, the virtual text would start at column 97. Currently, it starts immediately after the final double quote, with a single space in between.

Looking over the documentation for virtual text, though, it looks like this may be something you would have to write: I didn’t see a native way for neocon to right justify virtual text. If that’s the case, that may be more trouble than it’s worth. If so, that’s fine, and I’ll just close this.

jchilders avatar Mar 24 '21 12:03 jchilders

Ah, okay. There's an open issue (#11634) in neovim for native support of text alignment. I'm closing this issue now and will reopen once it's implemented in neovim (I've subscribed to that thread) just to keep issues clean. Thanks!

f-person avatar Mar 24 '21 22:03 f-person

I wonder if the API is working as expected now in Neovim. Will need to check that :)

f-person avatar Dec 19 '21 14:12 f-person

Checked it. Still the same :(

f-person avatar Jan 03 '22 17:01 f-person

I'm gonna close this issue since I'm planning to implement into the plugin itself because Neovim lets you to position virtual text (see https://neovim.io/doc/user/api.html#nvim_buf_set_extmark()) and you can add optional arguments to nvim_buf_set_extmark since c43b6bce173fb99e78561f75bd31d12027a0c644. "right_align" was working incorrectly some time ago but perhaps it's fixed now.

f-person avatar Jan 10 '23 18:01 f-person