← Blog

How to focus split panes in iTerm2, VS Code and Ghostty without clicking

Splits let you watch a server, a git log and a build at once. The hard part is making sure you type into the right one.

A terminal with three splits is a good setup. The server log is on the left, git is in the middle, and the build is on the right. It works well until you glance at the build output, start typing a git command, and it runs in the build pane instead.

Split panes have the same problem as multiple monitors, just smaller. You're looking at one pane and focus is in another. Here are the usual ways to move between panes, and a way that needs no shortcut at all.

Look at a pane; after a short delay, it takes keyboard focus.

The keyboard shortcuts

Most terminals and editors ship with shortcuts for moving between splits. These are the defaults. If you've remapped keys, yours may be different.

AppMove to a paneNext / previous
iTerm2⌘ ⌥ + arrow keys⌘ ] / ⌘ [
Ghostty⌘ ⌥ + arrow keys⌘ ] / ⌘ [
VS Code⌘ 1, ⌘ 2, ⌘ 3… for editor groupsDepends on the panel. Terminal splits have their own commands.

tmux

tmux draws its own panes inside a single terminal window, so it has its own keys. Press the prefix, ⌃ B by default, then:

After ⌃ BWhat it does
Arrow keyMove to the pane in that direction
OMove to the next pane
;Go back to the last pane you were in
Q then a numberShow pane numbers, then jump to one
ZZoom the current pane to fill the window, and back

Add set -g mouse on to ~/.tmux.conf to be able to click a pane to focus it.

These are worth learning. They're fast when you already know where you are and where you want to go.

Why shortcuts still slow you down

  • You have to work out the direction. Going from the left pane to the right one in a three-way split is two presses, or one press of a different shortcut.
  • Every app is different. Terminal, editor and IDE each have their own keys, and the editor often has separate ones for code and for its built-in terminal.
  • You have to check first. Before you press anything, you look to see which pane has focus, which is the thing you wanted to avoid.

You've already looked at the pane you want before you think of the shortcut. If the computer could see that, you wouldn't need the shortcut.

Focus the pane you look at

Glance Switch moves keyboard focus between screens based on which way you're facing. It also works inside a screen, moving focus to the window or split pane you're looking at. That works with a single display too.

Here's how it behaves on the same screen:

  • It uses where your eyes are, not just your head. Telling panes apart needs more detail than telling screens apart. A short calibration where you follow a dot around each screen gives it that. It also keeps improving from your clicks, because you usually look where you click.
  • There's a short delay before a pane gets focus. You can change it in Settings. Reading across panes doesn't make focus jump around.
  • Panes stay put while you type. A quick look at the log in the next pane won't take the command you're typing.
  • Browsers, chat and docs switch as whole windows. Only terminals and code editors get pane-level focus, so part of a web page never takes focus.
  • It avoids clicking. Focus changes go through macOS Accessibility. A few terminals and editors don't let other apps focus a split directly. For those, it clicks the middle of the pane you're looking at, and you can turn that off.

Split panes in

  • iTerm2
  • Terminal
  • Ghostty
  • Warp
  • kitty
  • WezTerm
  • Hyper
  • VS Code
  • Cursor
  • Windsurf
  • VSCodium
  • Zed
  • Sublime Text
  • Xcode
  • JetBrains IDEs
  • Android Studio

Every other app: whole windows.

Tips for accurate pane focus

  1. Calibrate the way you normally sit. Calibration takes about 20 seconds per screen. Moving closer or farther is handled automatically.
  2. Use a camera that faces you. The built-in camera works best when your laptop is in front of you. You can pick any other camera in Settings.
  3. Turn on the gaze dot to check. Settings has an option that shows a dot where Glance Switch thinks you're looking. It's the quickest way to see whether your panes are easy to tell apart.
  4. Recalibrate when you move things. If you move your monitors or laptop, recalibrate from the menu bar. If focus starts missing, Glance Switch notices and suggests it.

Glance Switch works with the terminal's and editor's own splits. tmux panes live inside one terminal pane, so for those, keep using the tmux keys above.

Shortcuts are still useful. With pane focus handled by where you look, you'll need them much less often. If you have more than one screen, this multi-monitor setup guide covers the rest.