2026-04-29
VSCode Neovim - Prevent Output Panel from Stealing Focus
2026-04-29 ~ 2026-04-29

The note is generated by Opus-4.7

Problem

When using the vscode-neovim extension, the VSCode Output panel automatically reveals and steals focus from the terminal whenever Neovim logs appear.

Root Cause

In src/messages_manager.ts, the extension calls this.channel.show(true) (which reveals and focuses the Output panel) whenever the number of lines in a Neovim message exceeds cmdheight:

1
2
3
4
5
6
const lineCount = outputMsg.split("\n").length;
const cmdheight = (await this.main.client.getOption("cmdheight")) as number;

if (lineCount > cmdheight) {
  this.channel.show(true);
}
  • cmdheight=0 (default when ext_messages is enabled): every message exceeds 0 lines → Output panel steals focus on every log
  • cmdheight=1: only messages with more than 1 line trigger the Output panel
  • cmdheight=N: only messages exceeding N lines trigger it

Fix

Set cmdheight=1 in the VSCode-specific Neovim config (~/.config/nvim/lua/plugins/vscode.lua):

2025-10-23
Use tmux save-buffer to sync clipboard
2025-10-23 ~ 2025-10-23

The note is generated by ChatGPT.

This note explains how to:

  1. Synchronize text copied in a remote Neovim session with your local clipboard via tmux.
  2. Implement a cpwd command to copy the current working directory of your shell to the local clipboard.
  3. Understand the underlying principle of how tmux buffers bridge remote Neovim and local clipboard.

1. Prerequisites

  • tmux 3.3a+ (supports load-buffer -w)
  • Neovim installed on the remote server

2. Principle: How tmux Buffers Bridge Remote and Local Clipboard

  1. tmux Buffers as an Intermediate Clipboard