VimTrick: Nudge current line up or down
Get a better view of surrounding code by moving your current line up or down a bit
†We recently wrote about how to reposition the current line to the top, middle, or bottom of the current viewport. This can help you get a better view of the working area. But there is another related tip that can give you finer-grained control over the position of your current line: Move the current line up or down one with ctrl-e and ctrl-y.
ctrl-e - Repositions the current line in the viewport up one line. Your cursor remains on the present line, but the line shifts upward exposing an additional line of code below.
ctrl-y - Repositions the current line in the viewport down one line. Your cursor remains on the present line, but the line shifts downward exposing an additional line of code above.
Here’s a quick screencast of both of these:
Was this useful? Help us improve!
With your feedback, we can improve VimTricks. Click a link to vote: