Eliminating Viewport Jumping in GNU nano with Smooth Scrolling
Learn how to enable smooth scrolling in GNU nano to prevent jarring viewport jumps when editing long files, including .nanorc configuration and performance trade-offs.
29 Jul 2026, 11:19 UTC

The Problem: Jarring Viewport Jumps
By default, GNU nano uses a "paging" scroll mechanism. When you navigate a file that exceeds the height of your terminal window, the screen remains static until your cursor hits the very top or bottom edge. Once that boundary is reached, the editor shifts the entire view by a full page or a large block of lines to keep the cursor visible.
For developers and sysadmins editing long configuration files, this creates a disjointed experience where the surrounding context of a line disappears suddenly, making it harder to track related settings across a few lines of code.
The Solution: Smooth Scrolling
Smooth scrolling changes this behavior so that the viewport shifts by a single line every time the cursor moves. This maintains a consistent visual relationship between the cursor and the surrounding text, providing a fluid movement similar to modern GUI text editors.
Implementing Smooth Scrolling via .nanorc
To make smooth scrolling permanent across all sessions, you must modify the nano configuration file (.nanorc) located in your home directory. This file defines the editor's behavior, keybindings, and visual preferences.
Run the following commands in your terminal to enable the feature:
# Create or edit the .nanorc file in the home directory
nano ~/.nanorc
# Add the following line to the file
set smooth
# Save and exit (Ctrl+O, Enter, Ctrl+X)
Verification: To verify the change, open a file that is longer than your current terminal window height. Use the Down arrow key to move the cursor. With set smooth enabled, the text should shift upward one line at a time as soon as the cursor reaches the bottom edge, rather than jumping a full page.
Comparison of Scrolling Behaviors
| Feature | Default (nosmooth) | Smooth Scrolling |
|---|---|---|
| Trigger | Cursor hits window boundary | Cursor hits window boundary |
| Movement | Full page/block shift | Single line shift |
| Context | Context is lost during jump | Context is preserved line-by-line |
| Network Load | Lower (fewer redraws) | Higher (frequent redraws) |
Technical Limitations and Risks
Smooth scrolling relies on the terminal emulator's ability to process frequent redraw requests. Because every single-line move triggers a screen update, certain environments may experience issues:
- Terminal Flickering: Older terminal emulators or those with poor rendering engines may exhibit "ghosting" or flickering during rapid scrolling.
- SSH Latency: On extremely slow or high-latency SSH connections, the increased volume of redraw data can lead to perceived input lag. If you notice the cursor "stuttering" over a remote connection, disabling smooth scrolling may improve responsiveness.
- Session Persistence: Changes to
.nanorcare only loaded when nano starts. If you edit the config file while a nano session is already open, you must exit and restart the editor for the changes to apply.
Rollback Procedure
If you experience flickering or latency, you can revert to the default paging behavior by editing your ~/.nanorc file and changing the directive to:
set nosmooth
Alternatively, you can delete the set smooth line entirely to return to the system defaults.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.