macOS trackpad and mouse-wheel scrolling for Neovim. A Darwin background
handler taps scrollWheel events, swallows them, and RPCs this plugin so
Warp, Terminal.app, iTerm, Kitty, Ghostty, WezTerm, and Alacritty cannot
drop sideways motion or rewrite vertical wheels before Neovim sees them.
Requires Neovim 0.10+ and, for the handler, Xcode Command Line Tools. The handler cannot see trackpad or mouse-wheel events until macOS Accessibility is granted. See Accessibility and the tutorial.
{
'LFSCamargo/macscroll.nvim',
lazy = false,
build = 'make worker',
opts = {},
}
macscroll.nvim-scm-1.rockspec is in the repo for LuaRocks / rocks.nvim.
Until a versioned rock is on luarocks.org, install from the spec:
luarocks --lua-version=5.1 make macscroll.nvim-scm-1.rockspec
After a publish, :Rocks install macscroll.nvim works too. Then build
the Darwin handler with :MacscrollBuild (or make worker).
Plug 'LFSCamargo/macscroll.nvim'
Then run :MacscrollBuild once, or make worker from the plugin directory.
:packaddClone into pack/*/start/macscroll.nvim so lua/ and plugin/ load on
startup. The plugin/macscroll.lua entry calls setup() unless you set
vim.g.macscroll_auto = false.
require('macscroll').setup({
horiz_step = 6,
vert_step = 3,
mouse = true,
keymaps = true,
auto_worker = true,
skip_buftypes = { 'prompt' },
})
On first launch the plugin compiles handler/darwin into
stdpath('data')/macscroll/macscroll-worker and starts it. It will not
scroll from the trackpad until you grant Accessibility (below).
macOS blocks session-wide event taps unless the process is allowed under
Privacy & Security → Accessibility. macscroll-worker uses that tap so
the terminal never filters horizontal or vertical wheels. Without the
checkbox, the worker starts, prints an error on stderr, and Neovim only
sees whatever the TTY decides to forward.
Build and start the worker (:MacscrollBuild, :MacscrollStart, or
restart Neovim after build = 'make worker').
Open System Settings → Privacy & Security → Accessibility.
Unlock the pane (the lock at the bottom, or Touch ID).
Enable macscroll-worker. If it is missing, click + and add:
~/.local/share/nvim/macscroll/macscroll-worker
That is stdpath('data')/macscroll/macscroll-worker. If you set
NVIM_APPNAME or XDG_DATA_HOME, use that data dir instead.
Quit the old worker and start a new one (:MacscrollStop then
:MacscrollStart, or quit Neovim). macOS does not attach the tap to
an already-running binary that was denied.
If you run make install, the LaunchAgent starts the same binary at
login. Grant Accessibility to that same path, not to swift or nvim.
Rebuilding the worker can make macOS treat it as a new app; toggle the
row off and on, or add the file again.
Confirm with :checkhealth macscroll. Extra terminal bundle IDs can be
set with MACSCROLL_BUNDLE_IDS=com.foo.term,com.bar.term.
Optional login helper:
make install # LaunchAgent
make uninstall
| Command | Action |
|---|---|
:MacscrollBuild |
Compile the Darwin handler |
:MacscrollStart |
Listen and start the handler |
:MacscrollStop |
Close the RPC socket |
:checkhealth macscroll |
Diagnose worker, socket, and toolchain |
make test # Lua unit + Swift unit + e2e + packpath nvim suite
make test-lua
make test-swift
make e2e
make test-nvim # isolated XDG + pack/*/start install
See docs/E2E-TESTPLAN.md.