Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

custom keybind is lower precedence than vim keybind #21358

Open
1 task done
penzboti opened this issue Nov 30, 2024 · 5 comments
Open
1 task done

custom keybind is lower precedence than vim keybind #21358

penzboti opened this issue Nov 30, 2024 · 5 comments
Labels
bug [core label] keybinds Keyboard shortcuts, mapping, binding, keymaps, etc setting Feedback for preferences, configuration, etc vim

Comments

@penzboti
Copy link

Check for existing issues

  • Completed

Describe the bug / provide steps to reproduce it

I can't because multiple keybinds work normally while overwriting the default vim keybind, but one doesn't.

Environment

Zed: v0.161.2 (Zed)
OS: Linux Wayland nixos 25.05
Memory: 3.5 GiB
Architecture: x86_64
GPU: Intel(R) Graphics (ADL-N) || Intel open-source Mesa driver || Mesa 24.2.6

If applicable, add mockups / screenshots to help explain present your vision of the feature

a keybind that works:
image
image
and a keybind that doesn't:
(the vim mode was insert, but my screenshot tool updated the context)
image
image

If applicable, attach your Zed.log file to this issue.

Zed.log
2024-11-30T11:32:08.313041988+01:00 [INFO] ========== starting zed ==========
2024-11-30T11:32:08.424142075+01:00 [INFO] Opening main db
2024-11-30T11:32:08.426613281+01:00 [INFO] perform;
2024-11-30T11:32:08.426681127+01:00 [INFO] authenticate;
2024-11-30T11:32:08.427500992+01:00 [INFO] read_command;
2024-11-30T11:32:08.432375326+01:00 [INFO] socket reader;
2024-11-30T11:32:08.432696013+01:00 [INFO] new;
2024-11-30T11:32:08.433065404+01:00 [INFO] Opening main db
2024-11-30T11:32:08.435486482+01:00 [INFO] keep_updated;
2024-11-30T11:32:08.441460141+01:00 [INFO] Using git binary path: None
2024-11-30T11:32:08.453260664+01:00 [INFO] no tokio runtime found, creating one for Reqwest...
2024-11-30T11:32:08.488592611+01:00 [INFO] set environment variables from shell:/run/current-system/sw/bin/bash, path:/nix/store/rsl5pj2xkhbrpfw60w8asz6ln27lv5fc-kitty-0.37.0/bin:/nix/store/ym0d0c1hpxinxvr2qrfg1d1b9wnz6i71-imagemagick-7.1.1-40/bin:/nix/store/inpspwqhgpld2zdk89hra7xjh3nxll2x-ncurses-6.4.20221231-dev/bin:/run/wrappers/bin:/home/penzboti/.nix-profile/bin:/nix/profile/bin:/home/penzboti/.local/state/nix/profile/bin:/etc/profiles/per-user/penzboti/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin:/nix/store/9bacph866qhmr2zfib1h49jixq5hhd01-binutils-wrapper-2.43.1/bin:/nix/store/m3b8p80179lk83w6hpzjxn6wd6hk80xx-pciutils-3.13.0/bin:/nix/store/6rh5syqf6nv5l84vn4a9qp22yrixlaw3-pkgconf-wrapper-2.3.0/bin:/home/penzboti/.spicetify:/nix/store/0xvgzkl74v6jrh79ibh7ss770dh4hb69-nodejs-22.10.0/bin
2024-11-30T11:32:08.528705433+01:00 [ERROR] theme not found: Catppuccin Mocha
2024-11-30T11:32:08.529309816+01:00 [ERROR] No such file or directory (os error 2) about ["/home/penzboti/.config/github-copilot"]
2024-11-30T11:32:08.533453985+01:00 [INFO] initializing context server client
2024-11-30T11:32:08.534692115+01:00 [INFO] Registering built-in prompt template: content_prompt
2024-11-30T11:32:08.536544092+01:00 [INFO] Registering built-in prompt template: project_slash_command
2024-11-30T11:32:08.536627329+01:00 [INFO] Registering built-in prompt template: suggest_edits
2024-11-30T11:32:08.536873803+01:00 [INFO] Registering built-in prompt template: terminal_assistant_prompt
2024-11-30T11:32:08.537656247+01:00 [INFO] No prompt template overrides directory found at /home/penzboti/.local/share/zed/prompt_overrides. Using built-in prompts.
2024-11-30T11:32:08.543424092+01:00 [INFO] extensions updated. loading 4, reloading 0, unloading 0
2024-11-30T11:32:08.558846334+01:00 [INFO] activate is not implemented on Linux, ignoring the call
2024-11-30T11:32:08.573191584+01:00 [INFO] perform;
2024-11-30T11:32:08.573246608+01:00 [INFO] authenticate;
2024-11-30T11:32:08.573304023+01:00 [INFO] read_command;
2024-11-30T11:32:08.574406735+01:00 [INFO] socket reader;
2024-11-30T11:32:08.586177888+01:00 [INFO] Opening main db
2024-11-30T11:32:08.593682438+01:00 [ERROR] DBus error service error org.freedesktop.zbus.Error: The name org.freedesktop.secrets was not provided by any .service files
2024-11-30T11:32:08.676752447+01:00 [INFO] Enabling Vulkan Portability
2024-11-30T11:32:08.676793309+01:00 [INFO] Enabling color space support
2024-11-30T11:32:08.702584766+01:00 [INFO] Adapter: "Intel(R) Graphics (ADL-N)"
2024-11-30T11:32:08.702657965+01:00 [INFO] No ray tracing extensions are supported
2024-11-30T11:32:08.705597219+01:00 [INFO] Using surface present mode MAILBOX
2024-11-30T11:32:08.705982672+01:00 [WARN] Unable to forbid exclusive full screen
2024-11-30T11:32:08.706502278+01:00 [INFO] Creating a descriptor pool for at most 16 sets
2024-11-30T11:32:08.706649082+01:00 [INFO] Creating a descriptor pool for at most 16 sets
2024-11-30T11:32:08.706788914+01:00 [INFO] Initializing Blade pipelines for surface SurfaceInfo { format: Bgra8UnormSrgb, alpha: PreMultiplied }
2024-11-30T11:32:08.723738807+01:00 [INFO] Using GPU: GPUSpecs { is_software_emulated: false, device_name: "Intel(R) Graphics (ADL-N)", driver_name: "Intel open-source Mesa driver", driver_info: "Mesa 24.2.6" }
2024-11-30T11:32:08.72689806+01:00 [INFO] Using surface present mode MAILBOX
2024-11-30T11:32:08.727331721+01:00 [WARN] Unable to forbid exclusive full screen
2024-11-30T11:32:08.727583023+01:00 [INFO] Initializing Blade pipelines for surface SurfaceInfo { format: Bgra8UnormSrgb, alpha: Ignored }
2024-11-30T11:32:08.737680734+01:00 [INFO] Using surface present mode MAILBOX
2024-11-30T11:32:08.738071466+01:00 [WARN] Unable to forbid exclusive full screen
2024-11-30T11:32:08.763559715+01:00 [INFO] Opening main db
2024-11-30T11:32:08.781904736+01:00 [INFO] Using surface present mode MAILBOX
2024-11-30T11:32:08.78256755+01:00 [WARN] Unable to forbid exclusive full screen
2024-11-30T11:32:08.784680176+01:00 [INFO] Using surface present mode MAILBOX
2024-11-30T11:32:08.785443221+01:00 [WARN] Unable to forbid exclusive full screen
2024-11-30T11:32:08.793892528+01:00 [INFO] open paths ["/home/penzboti/.config/zed/keymap.json"]
2024-11-30T11:32:08.806680368+01:00 [INFO] Opening main db
2024-11-30T11:32:08.905188567+01:00 [ERROR] missing field `name` at line 23 column 1
2024-11-30T11:32:08.933920595+01:00 [INFO] using project environment variables from CLI. PATH="/nix/store/rsl5pj2xkhbrpfw60w8asz6ln27lv5fc-kitty-0.37.0/bin:/nix/store/ym0d0c1hpxinxvr2qrfg1d1b9wnz6i71-imagemagick-7.1.1-40/bin:/nix/store/inpspwqhgpld2zdk89hra7xjh3nxll2x-ncurses-6.4.20221231-dev/bin:/run/wrappers/bin:/home/penzboti/.nix-profile/bin:/nix/profile/bin:/home/penzboti/.local/state/nix/profile/bin:/etc/profiles/per-user/penzboti/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin:/nix/store/9bacph866qhmr2zfib1h49jixq5hhd01-binutils-wrapper-2.43.1/bin:/nix/store/m3b8p80179lk83w6hpzjxn6wd6hk80xx-pciutils-3.13.0/bin:/nix/store/6rh5syqf6nv5l84vn4a9qp22yrixlaw3-pkgconf-wrapper-2.3.0/bin:/home/penzboti/.spicetify"
2024-11-30T11:32:08.971704587+01:00 [INFO] attempting to start language server "json-language-server", path: "/home/penzboti/.config/zed/keymap.json", id: 1
2024-11-30T11:32:08.971835282+01:00 [INFO] Initializing default prettier with plugins {}
2024-11-30T11:32:08.976398276+01:00 [INFO] Initializing default prettier with plugins {}
2024-11-30T11:32:08.977924513+01:00 [INFO] fetching latest version of language server "json-language-server"
2024-11-30T11:32:09.09874079+01:00 [INFO] attempting to start language server "rust-analyzer", path: "/home/penzboti/programming/advent-of-code/2024", id: 2
2024-11-30T11:32:09.099246971+01:00 [INFO] Initializing default prettier with plugins {}
2024-11-30T11:32:09.10107018+01:00 [INFO] found rust-analyzer in PATH. trying to run `rust-analyzer --help`
2024-11-30T11:32:09.622793371+01:00 [INFO] starting language server process. binary path: "/nix/store/0xvgzkl74v6jrh79ibh7ss770dh4hb69-nodejs-22.10.0/bin/node", working directory: "/", args: ["/home/penzboti/.local/share/zed/copilot/copilot-v0.5.0/dist/agent.js", "--stdio"]
2024-11-30T11:32:10.042849288+01:00 [INFO] Initializing default prettier with plugins {}
2024-11-30T11:32:10.386373843+01:00 [ERROR] failed to run rust-analyzer after detecting it in PATH: binary: "/run/current-system/sw/bin/rust-analyzer": exit status: 1, stdout: "", stderr: "error: Unknown binary 'rust-analyzer' in official toolchain 'stable-x86_64-unknown-linux-gnu'.\n"
2024-11-30T11:32:10.386507704+01:00 [INFO] fetching latest version of language server "rust-analyzer"
2024-11-30T11:32:10.67053053+01:00 [INFO] Language server with id 0 sent unhandled notification LogMessage:
{
  "level": 0,
  "message": "[DEBUG] [agent] [2024-11-30T10:32:10.654Z] Agent service starting",
  "metadataStr": "[DEBUG] [agent] [2024-11-30T10:32:10.654Z]",
  "extra": [
    "Agent service starting"
  ]
}
2024-11-30T11:32:10.674595768+01:00 [INFO] Language server with id 0 sent unhandled notification client/registerCapability:
{
  "registrations": [
    {
      "id": "227a06bc-315a-4c65-b33d-6db1e416f1a8",
      "method": "workspace/didChangeWorkspaceFolders",
      "registerOptions": {}
    }
  ]
}
2024-11-30T11:32:10.734623712+01:00 [INFO] Language server with id 0 sent unhandled notification LogMessage:
{
  "level": 0,
  "message": "[DEBUG] [agent] [2024-11-30T10:32:10.688Z] Telemetry initialized",
  "metadataStr": "[DEBUG] [agent] [2024-11-30T10:32:10.688Z]",
  "extra": [
    "Telemetry initialized"
  ]
}
2024-11-30T11:32:10.899121534+01:00 [INFO] downloading language server "json-language-server"
2024-11-30T11:32:11.251350599+01:00 [INFO] downloading language server "rust-analyzer"
2024-11-30T11:32:11.251491879+01:00 [INFO] using project environment for language server LanguageServerName("rust-analyzer")
2024-11-30T11:32:11.252023116+01:00 [INFO] starting language server process. binary path: "/home/penzboti/.local/share/zed/languages/rust-analyzer/rust-analyzer-2024-11-25", working directory: "/home/penzboti/programming/advent-of-code/2024", args: []
2024-11-30T11:32:11.286153777+01:00 [INFO] using project environment for language server LanguageServerName("json-language-server")
2024-11-30T11:32:11.286318568+01:00 [INFO] starting language server process. binary path: "/nix/store/0xvgzkl74v6jrh79ibh7ss770dh4hb69-nodejs-22.10.0/bin/node", working directory: "/home/penzboti/.config/zed", args: ["/home/penzboti/.local/share/zed/languages/json-language-server/node_modules/vscode-langservers-extracted/bin/vscode-json-language-server", "--stdio"]
2024-11-30T11:32:12.448697451+01:00 [ERROR] No such file or directory (os error 2) about ["/home/penzboti/.config/rust-analyzer"]
2024-11-30T11:32:14.453230514+01:00 [ERROR] No such file or directory (os error 2) about ["/home/penzboti/.config/rust-analyzer"]
2024-11-30T11:32:14.466486761+01:00 [WARN] Generic lsp request to rust-analyzer failed: content modified
2024-11-30T11:32:14.466833218+01:00 [ERROR] content modified
2024-11-30T11:32:15.365846837+01:00 [WARN] Generic lsp request to rust-analyzer failed: content modified


@penzboti penzboti added admin read bug [core label] labels Nov 30, 2024
@JosephTLyons JosephTLyons added vim setting Feedback for preferences, configuration, etc keybinds Keyboard shortcuts, mapping, binding, keymaps, etc and removed triage labels Dec 3, 2024
@ConradIrwin
Copy link
Member

@penzboti on Linux, ctrl-k is used to namespace a large number of extra Zed commands. If you want to bind to it, you'll want to create a binding to null to disable the other ones.

@penzboti
Copy link
Author

penzboti commented Dec 5, 2024

After setting ctrl-k to null, when no context is present, it does not do anything, even while keymap in the previous picture is still there.

And also, i found out, that lower precedence also applies to keybinds that have never been assigned.
image

@ConradIrwin
Copy link
Member

oh. I thought from your previous

@ConradIrwin ConradIrwin reopened this Dec 6, 2024
@ConradIrwin
Copy link
Member

I looked into this a bit today, and I can reproduce the problem with ctrl-k; I am not sure yet why it is broken.

You also seem to have issues with é being spelled as eacute - I'd like to fix this when we do the next pass on Linux shortcuts.

@dream-dasher
Copy link

dream-dasher commented Dec 14, 2024

Related problem with key precedence:
There a number of default bindings that I can't override except with null.

e.g. I was setting up more helix-like tab throughs.:

Defaults

  {
    "context": "Editor && showing_completions",
    "bindings": {
      "enter": "editor::ConfirmCompletion",
      "tab": "editor::ComposeCompletion"
    }
  },

Custom -- higher precedence, will override

[
  {
    "context": "Editor && showing_completions",
    "bindings": {
      "tab": null,
      "shift-tab": null
    }
  },

Custom -- low precedence, won't work

[
  {
    "context": "Editor && showing_completions",
    "bindings": {
      "tab": "menu::SelectNext",
      "shift-tab": "editor::ContextMenuPrev"

    }
  },

(Adjusting the location of the overrides in the keymap.json also had no effect. Precedence viewed with the KeybindDebugger)


Edit

menu::SelectNext ~~> editor::ContextMenuNext does override.
But the failure with menu::SelectNext is "(low precedence)" not "(no match)". The docs suggest that it's the context menu depth && rule ordering to tie break that impact precedence.
Does the command itself carry a precedence modifier? (e.g. related to parent [pre-::])

precedence

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug [core label] keybinds Keyboard shortcuts, mapping, binding, keymaps, etc setting Feedback for preferences, configuration, etc vim
Projects
None yet
Development

No branches or pull requests

4 participants