You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Sublime Text 3疑似Bug:Ctrl+z与Ctrl+s功能异常求助

Fixing Ctrl+Z/Ctrl+S Being Hijacked by Tab Formatting in Sublime Text

Hey there! Sounds like your keybindings are getting overridden by that "Emacs Tabstop to Spaces" feature, which is why your Ctrl+Z and Ctrl+S are acting weird instead of doing undo/save like you expect. Let's walk through how to fix this step by step:

1. Fix Your User Keybinding Syntax First

First off, there's a tiny syntax issue in your current config that might be stopping it from working properly. Sublime Text expects keybindings to be wrapped in an array, and key names shouldn't have spaces. Update your user keybindings file (open via Preferences > Key Bindings) to look like this:

[
    { "keys": ["ctrl+z"], "command": "undo" },
    { "keys": ["ctrl+s"], "command": "save" }
]

This ensures Sublime reads your bindings correctly and prioritizes them over default or plugin-based ones.

2. Track Down the Culprit Plugin/Feature

The "Undo Emacs Tabstop to Spaces" label in your edit menu points directly to what's hijacking your keys. This is almost certainly coming from:

  • An Emacs emulation plugin (like Emacs Pro Essentials or similar) that's overriding standard shortcuts
  • A third-party tab/space formatting tool that accidentally mapped to these keys

To test this:

  • Open Preferences > Package Control > Disable Package and turn off any Emacs-related packages first.
  • Restart Sublime and check if Ctrl+Z/Ctrl+S work as expected. If they do, you’ve found the culprit—you can either keep the plugin disabled, or dig into its settings to re-map its tab-related shortcuts to other keys.

3. Explicitly Override the Hijacked Command

If disabling plugins isn’t an option, you can force Sublime to prioritize your desired commands by adding context to your keybindings. Update your user keybindings array to this:

[
    { "keys": ["ctrl+z"], "command": "undo", "context": [
        { "key": "setting.command_mode", "operator": "equal", "operand": false }
    ] },
    { "keys": ["ctrl+s"], "command": "save" }
]

The context line ensures this binding only applies when you’re in normal edit mode (not command mode, which some Emacs plugins use), making it more reliable.

4. Double-Check Default Bindings (Optional)

To confirm the issue, you can peek at the default keybindings: go to Preferences > Key Bindings - Default and search for "undo_emacs_tabstop_to_spaces". If you find it mapped to Ctrl+Z, you don’t need to edit this read-only file—just know your user bindings need to explicitly override it.

After making these changes, restart Sublime Text and your Ctrl+Z/Ctrl+S should go back to their normal undo/save behavior.

内容的提问来源于stack exchange,提问作者TaGy

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.20 10:34:04