Eliot00 / git-lens.vim

A vim9 plugin inspired by VSCode's GitLens.
GNU Affero General Public License v3.0
59 stars 1 forks source link

How to disable auto wrapping? #3

Open wanaiqing opened 1 year ago

wanaiqing commented 1 year ago

How to disable auto wrapping? It's annoying if the screen is narrow.

Eliot00 commented 1 year ago

80f65d161587f052c7f5d4e8b97877d9c8379ca0 support disable wrapping:

g:GIT_LENS_CONFIG = {
    blame_wrap: false,
}
wanaiqing commented 1 year ago

80f65d1 support disable wrapping:

g:GIT_LENS_CONFIG = {
    blame_wrap: false,
}

What's the right syntax for this in .vimrc? It's causing an error.

Eliot00 commented 1 year ago

80f65d1 support disable wrapping:

g:GIT_LENS_CONFIG = {
    blame_wrap: false,
}

What's the right syntax for this in .vimrc? It's causing an error.

I guess your .vimrc is not vim9 script, try this:

vim9cmd g:GIT_LENS_CONFIG = {
    blame_wrap: false,
}
wanaiqing commented 1 year ago

80f65d1 support disable wrapping:

g:GIT_LENS_CONFIG = {
    blame_wrap: false,
}

What's the right syntax for this in .vimrc? It's causing an error.

I guess your .vimrc is not vim9 script, try this:

vim9cmd g:GIT_LENS_CONFIG = {
    blame_wrap: false,
}

It works now. But actually my output of :echo has('vim9script') is 1... But thx

wanaiqing commented 1 year ago

There's still a problem of it. If there is a long line which is so long that it could totally hide the blame line(no letter will appear in screen), the blame line will entirely wrap to next line. For example([] indicates screen, {} indicates blame line): [This is a normal text line which is very long. ] { Author · Date · Commit Log } It supposed to be rendered like below. [This is a normal text line which is very long. { ] Author · Date · Commit Log }

Eliot00 commented 1 year ago

There's still a problem of it. If there is a long line which is so long that it could totally hide the blame line(no letter will appear in screen), the blame line will entirely wrap to next line. For example([] indicates screen, {} indicates blame line): [This is a normal text line which is very long. ] { Author · Date · Commit Log } It supposed to be rendered like below. [This is a normal text line which is very long. { ] Author · Date · Commit Log }

Can you put you :version output here?

Eliot00 commented 1 year ago

Cannot reproduce in Vim-9.0.1441

wanaiqing commented 1 year ago

The key to reproduce it is that you have a line which's tail is touching the right border of screen. I don't think it's a version specific issue. But my version is as below. v

Eliot00 commented 1 year ago

Try the latest version, I think c27b09f should fix this.

wanaiqing commented 1 year ago

@Eliot00 I have just tried, but another problem appeared... Say, we have three lines: [some text... Author · Date · Log ] [a line that is very long so that it is touching screen ] [some text... ] Now you use j/k to move upward or downward and stay at the long line, the blame info of the line before the long line or after the long line won't disappear... It looks like above or below. [some text... ] [a line that is very long so that it is touching screen ] [some text... Author · Date · Log ]

Eliot00 commented 1 year ago

Fixed, looking forward to your feedback.

wanaiqing commented 1 year ago

Fixed, looking forward to your feedback.

It looks great now, thanks.

wanaiqing commented 1 year ago

Still has a problem. [this is a long line.........................................] [............end of it. ] The blame info won't be rendered...

Eliot00 commented 1 year ago

In fact, this should be an upstream bug. If a line of text just occupies the entire line width, virtual text will wrap. Vim doesn't provide a way to judge this situation, I'm not sure my method can cover all situations

if !GetConfig('blame_wrap') && (winwidth(0) - &numberwidth - 1) == virtcol('$')
    return
endif
Eliot00 commented 1 year ago

https://github.com/vim/vim/issues/12640