Skip to content

maxmaxou2/zoom-sync.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 

Repository files navigation

zoom-sync.nvim

Synchronize zoom between Neovim splits and Tmux panes.

This plugin lets you maximize a Neovim window using windows.nvim while automatically toggling Tmux zoom mode at the same time — and keeps them in sync. If you unzoom in Tmux or Neovim, the other follows. Just press your tmux zoom keybinding and the plugin will sync the zoom state in Neovim.


✨ Features

  • Toggle zoom in Neovim and Tmux together
  • Synchronize zoom state in both directions
  • Automatically unzoom when switching windows or focus
  • Minimal config, no performance overhead
demo_zoom_sync_with_animation.mov
demo_zoom_sync.mov

⚙️ Requirements


📦 Installation

Here's the recommended configuration for lazy.nvim:

{
  "maxmaxou2/zoom-sync.nvim",
  dependencies = {
    "anuvyklack/windows.nvim",
    "anuvyklack/middleclass", -- required by windows.nvim
    "anuvyklack/animation.nvim",
  },
  config = function()
    vim.o.winwidth = 1
    vim.o.winminwidth = 1
    vim.o.equalalways = false -- disable equal window size to let zoomsync handle it
    require("windows").setup({
      autowidth = { enable = false },
      animation = { enable = true, duration = 300, fps = 45, easing = "in_out_sine" },
    })
    require("zoomsync").setup({
      sync_tmux_on = {
        win_enter = true,  -- sync Tmux zoom on Neovim window enter
        focus_lost = true,  -- sync Tmux zoom on Neovim focus lost
      },
      equalalways = true,  -- keep windows equal size upon split or quitting window
    })
    -- The bang version syncs Nvim to Tmux zoom state
    vim.keymap.set("n", "<leader>zs", "<cmd>ZoomToggle!<CR>", { desc = "Toggle and sync Neovim and Tmux zoom" })
    vim.keymap.set("n", "<leader>zz", "<cmd>ZoomToggle<CR>", { desc = "Toggle Neovim zoom" })
  end,
}

⚠️ Note: Don't forget to setup windows.nvim.

.tmux.conf

To enable Tmux zoom synchronization, add the following to your .tmux.conf:

# Enable zoom synchronization with Neovim
unbind z
bind z run-shell ' \
  tmux resize-pane -Z; \
  if [ "$(tmux display-message -p "#{pane_current_command}")" = "nvim" ]; then \
    tmux send-keys Escape : "ZoomToggle!" Enter; \
  fi; \
'

🔍 Commands

This plugin provides the following user commands:

Command Description
:ZoomToggle[!] Toggles zoom in Neovim and optionally Tmux.
Use ! to sync with Tmux.
:ZoomEnable[!] Zoom on in Neovim if not zoomed.
Use ! to avoid zooming if Tmux not zoomed.
:ZoomDisable[!] Zoom off in Neovim if currently zoomed.
Use ! to avoid unzooming if Tmux zoomed.

About

Seamlessly synchronize zoom between Neovim and tmux — full-screen one, and the other follows.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages