Yosh
Yosh

Reputation: 2742

Move current display line at top of window in vim (j : zt = gj : ???)

zt or z<CR> in normal mode redraws the buffer, cursor line at top of window. This is handy, but it is worthless when reading a file with very long lines.

I have set wrap, so sometimes one line fills up the entire display, when I want zt-like functionalities.

Is there a correspondent, "redraw the buffer, current display line at top of window"?

Upvotes: 0

Views: 294

Answers (1)

Ingo Karkat
Ingo Karkat

Reputation: 172738

Vim's support of editing wrapped lines is limited; there is little support beyond the by-screen-line navigation of gj / gk. A similar question has been asked recently. In particular, commands like zt or <C-E> / <C-Y> are based on physical lines. It certainly would be great to have corresponding commands that work on screen lines, too. I'll invite you to write a patch for that (note that this isn't trivial and requires some knowledge about Vim's implementation).

Without that, you can only try to emulate this. I think the only way to scroll by screen line is via moving the cursor to the bottom of the window and then doing gj.

Upvotes: 2

Related Questions