Viewport control for the micro editor. Put the line you are reading where you want it on screen, and move half a screen at a time without losing your cursor.
The companion to navz, which does the same job for VS Code.
| Command | Effect |
|---|---|
scrollz top |
Scroll the cursor's line to the top of the view |
scrollz bottom |
Scroll the cursor's line to the bottom of the view |
scrollz center |
Scroll the cursor's line to the center of the view |
scrollz halfdown |
Move down half a screen, cursor comes along, recentered |
scrollz halfup |
Move up half a screen, cursor comes along, recentered |
The first three move the view only — your cursor does not budge. The last two
are vim's Ctrl-D / Ctrl-U: cursor and view move together, cursor lands
centered.
micro ships Center (which scrollz center simply wraps) but has no
equivalent of vim's zt or zb — its CursorToViewTop / CursorToViewBottom
do the opposite, moving the cursor rather than the view.
It also ships HalfPageUp / HalfPageDown, but those scroll the view and
leave the cursor where it was. As soon as you move the cursor, micro relocates
the view back and the scroll is undone. scrollz halfup / halfdown move the
cursor as well, so the jump actually sticks.
Add this repo to pluginrepos in ~/.config/micro/settings.json:
"pluginrepos": ["https://raw.githubusercontent.com/vish9812/micro-scrollz/main/repo.json"]Then:
> plugin install scrollz
git clone https://github.com/vish9812/micro-scrollz ~/.config/micro/plug/scrollzEither way, restart micro. Verify with > help scrollz.
scrollz binds nothing by default. Add to ~/.config/micro/bindings.json:
{
"Alt-d": "lua:scrollz.halfDown",
"Alt-u": "lua:scrollz.halfUp",
"<Alt-z><t>": "lua:scrollz.top",
"<Alt-z><b>": "lua:scrollz.bottom",
"<Alt-z><z>": "Center"
}None of these overwrite a micro default. Ctrl-D and Ctrl-U are already
Duplicate and ToggleMacro, so the half-page pair lives on Alt. The
Alt-z prefix mirrors vim's z namespace and keeps room for more view
commands later.
All movement counts display rows rather than buffer lines, so with softwrap
enabled half a screen means half of what you can actually see. scrollmargin
is respected by top and bottom; set it to 0 if you want the cursor flush
against the edge of the view.
micro 2.0.0 or newer.
- palette — a searchable palette for micro: help topics, options, colorschemes, open buffers and files behind one keystroke.
- ember — four warm truecolor colorschemes for micro, two of them transparent.
- navz — keyboard-first navigation for VS Code, and the companion to this plugin.
MIT