1
0
mirror of https://github.com/jbranchaud/til synced 2026-01-03 15:18:01 +00:00

Add Scrolling Relative to the Cursor as a vim til.

This commit is contained in:
jbranchaud
2015-04-11 08:47:19 -05:00
parent c4d3ecef17
commit 45c6143c93
2 changed files with 15 additions and 0 deletions

View File

@@ -66,6 +66,7 @@ smart people at [Hashrocket](http://hashrocket.com/).
- [Quick Quickfix List Navigation](vim/quick-quickfix-list-navigation.md)
- [Rename Current File](vim/rename-current-file.md)
- [Repeat The Previous Change](vim/repeat-the-previous-change.md)
- [Scrolling Relative to the Window](vim/scrolling-relative-to-the-window.md)
- [Split Different](vim/split-different.md)
- [Tabs To Spaces](vim/tabs-to-spaces.md)
- [View Commit History of a File](vim/view-commit-history-of-a-file.md)

View File

@@ -0,0 +1,14 @@
# Scrolling Relative to the Cursor
If you hit `zt` while in normal mode, the window will be redrawn such that
the line the cursor is positioned on is at the top of the window. Similarly,
if you hit `zb`, the window will be redrawn such that the line the cursor is
currently on will be at the bottom of the window.
The one that comes in really handy, though, is `zz` (note: this is not
`ZZ`) which will reposition the current line to the center of the screen.
This can come in really handy if you have scrolled to the top (or bottom) of
the visible part of the buffer and you want to quickly view more of the
context around the current line.
See `:h scroll-cursor` for more details and commands.