explaingit

tomkhoailang/buffer-switch-release

14LuaAudience · developerComplexity · 2/5Setup · moderate

TLDR

A Neovim plugin that adds VS Code-style Ctrl+Tab buffer switching by using a background Python script to detect when modifier keys are released.

Mindmap

mindmap
  root((buffer-switch-release))
    What it does
      Ctrl+Tab buffer cycling
      Key release detection
      Popup file switcher
    How it works
      Background Python script
      OS-level key monitoring
      Neovim RPC message
    Features
      Recent files sorted
      Quick-jump letters
      Configurable keys
    Tech stack
      Lua plugin
      Python helper
      lazy.nvim support
    Platform
      Linux input devices
      Windows API
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Switch between open Neovim buffers the same way you cycle tabs in VS Code using Ctrl+Tab

USE CASE 2

Jump directly to any open file by pressing its assigned quick-jump letter from the popup menu

USE CASE 3

Use this plugin as a reference implementation for detecting key-release events in Neovim on Linux or Windows

Tech stack

LuaPythonNeovim

Getting it running

Difficulty · moderate Time to first run · 30min

Python must be installed and accessible in PATH for the key-release detection script to work alongside Neovim.

No license information was mentioned in the explanation.

In plain English

This repository contains a plugin for Neovim, a keyboard-driven text editor used mainly by programmers. The plugin solves a specific frustration: if you have used Visual Studio Code or JetBrains editors, you may be used to holding Ctrl and pressing Tab repeatedly to cycle through open files, then releasing Ctrl to jump to whichever file you landed on. Neovim does not support this out of the box because it has no built-in way to detect when a key is released, only when one is pressed. The plugin works around this limitation by spawning a small background Python script when you open the switcher menu. That script operates at the operating system level, watching for the release of the modifier key (Ctrl by default). On Linux, it reads directly from keyboard input device files to detect the key state. On Windows, it polls the keyboard state using a standard Windows API call. As soon as the key is released, the script sends a message back to Neovim to close the menu and confirm the selected file. The actual switcher displays a popup menu of your open files, sorted by how recently you used them. While holding Ctrl, you press the trigger key repeatedly to move through the list. Each entry in the menu also gets a short quick-jump key, so you can jump directly to any file by pressing its assigned letter without cycling through the whole list. The plugin is configured by passing options to a setup function, typically through a plugin manager like lazy.nvim. You can change which key acts as the hold key, which key triggers navigation, control the popup window appearance, and adjust the sorting order of files. Python must be installed and accessible for the key-release detection to work. The README is well-written and honest about the workaround involved, framing the project as both a useful tool and a reference for anyone else trying to solve the same problem in Neovim.

Copy-paste prompts

Prompt 1
I want to install buffer-switch-release in Neovim using lazy.nvim. Show me the exact plugin spec and setup call to enable Ctrl+Tab buffer switching.
Prompt 2
How does buffer-switch-release detect when the Ctrl key is released on Linux? Walk me through how the Python background script reads from keyboard input device files.
Prompt 3
I want to change buffer-switch-release so Tab cycles buffers instead of a custom key. Which setup options do I need to change and what values do I pass?
Prompt 4
buffer-switch-release is not detecting key release on my Windows machine. What does the Python script do to poll keyboard state and what might prevent it from working?
Open on GitHub → Explain another repo

← tomkhoailang on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.