diff --git a/README.md b/README.md index 87a0bcd..678bbdc 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/vim/scrolling-relative-to-the-cursor.md b/vim/scrolling-relative-to-the-cursor.md new file mode 100644 index 0000000..7d5bf3f --- /dev/null +++ b/vim/scrolling-relative-to-the-cursor.md @@ -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.