micro-editor / micro-editor/micro

[Feature Request] Keybindings depending on the filetype

Open
#2,518 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
29.6k
Forks
1.4k
Avg merge
2d 18h
Merged PRs (30d)
10

Description

Keybindings depending on the filetype to have build actions and quickfix plugin work together nicely

Depending on the file type, it might be better to bind the same key to a different command.
I.e with quickfix, depending on the filetype the user might want to execute a different command.
I know about chaining commands with ,, |, &` but that's not the same thing.
The snippet below raises some error when running micro

"*.cs": {
    "F5": "command:fexec dotnet build",
    "Shift-F5": "command:fexec dotnet test",
    },
"*.zig": {
    "F5": "command:fexec zig build",
    "F7": "command:fexec zig ast-check {f}",
    "Shift-F5": "command:fexec zig test {f}",
},

Error

Micro encountered an error: runtime.errorString runtime error: invalid memory address or nil pointer dereference
/usr/lib/golang/src/runtime/panic.go:212 (0x55f1979d3273)
/usr/lib/golang/src/runtime/panic.go:211 (0x55f1979d30f3)
/builddir/build/BUILD/micro-2.0.8/_build/src/github.com/zyedidia/micro/internal/action/bindings.go:88 (0x55f197ed9cbf)
/builddir/build/BUILD/micro-2.0.8/_build/src/github.com/zyedidia/micro/internal/action/bindings.go:70 (0x55f197ed96d7)
/builddir/build/BUILD/micro-2.0.8/_build/src/github.com/zyedidia/micro/cmd/micro/micro.go:318 (0x55f197f15eea)
/usr/lib/golang/src/runtime/proc.go:204 (0x55f1979bfbe9)
/usr/lib/golang/src/runtime/asm_amd64.s:1374 (0x55f1979f34a1)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the filetype-specific keybinding configuration and inspect the panic path in internal/action/bindings.go, starting from the call in cmd/micro/micro.go. Determine the intended handling for bindings that vary by filetype; done means the shown configuration loads without a nil-pointer error and the requested commands can be bound per filetype.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.