mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-09-10 07:36:27 -04:00
Change a-enter keybinding to m-enter on mac, and c-enter elsewhere
This commit is contained in:
parent
09d671e642
commit
578ee9a31b
|
|
@ -637,7 +637,9 @@ keybinding:
|
|||
confirm: <enter>
|
||||
confirmMenu: <enter>
|
||||
confirmSuggestion: <enter>
|
||||
confirmInEditor: <a-enter>
|
||||
|
||||
# <m-enter> on Mac
|
||||
confirmInEditor: <c-enter>
|
||||
confirmInEditor-alt: <c-s>
|
||||
remove: d
|
||||
new: "n"
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ func Start(buildInfo *BuildInfo, integrationTest integrationTypes.IntegrationTes
|
|||
if cliArgs.PrintDefaultConfig {
|
||||
var buf bytes.Buffer
|
||||
encoder := yaml.NewEncoder(&buf)
|
||||
err := encoder.Encode(config.GetDefaultConfig())
|
||||
err := encoder.Encode(config.GetDefaultConfigForPlatform(runtime.GOOS))
|
||||
if err != nil {
|
||||
log.Fatal(err.Error())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import (
|
|||
"os"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
"runtime"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
|
|
@ -136,7 +137,7 @@ func findOrCreateConfigDir() (string, error) {
|
|||
}
|
||||
|
||||
func loadUserConfigWithDefaults(configFiles []*ConfigFile, isGuiInitialized bool) (*UserConfig, error) {
|
||||
return loadUserConfig(configFiles, GetDefaultConfig(), isGuiInitialized)
|
||||
return loadUserConfig(configFiles, GetDefaultConfigForPlatform(runtime.GOOS), isGuiInitialized)
|
||||
}
|
||||
|
||||
func loadUserConfig(configFiles []*ConfigFile, base *UserConfig, isGuiInitialized bool) (*UserConfig, error) {
|
||||
|
|
|
|||
|
|
@ -461,7 +461,7 @@ type KeybindingUniversalConfig struct {
|
|||
Confirm string `yaml:"confirm"`
|
||||
ConfirmMenu string `yaml:"confirmMenu"`
|
||||
ConfirmSuggestion string `yaml:"confirmSuggestion"`
|
||||
ConfirmInEditor string `yaml:"confirmInEditor"`
|
||||
ConfirmInEditor string `yaml:"confirmInEditor"` // <m-enter> on Mac
|
||||
ConfirmInEditorAlt string `yaml:"confirmInEditor-alt"`
|
||||
Remove string `yaml:"remove"`
|
||||
New string `yaml:"new"`
|
||||
|
|
@ -766,6 +766,12 @@ type IconProperties struct {
|
|||
}
|
||||
|
||||
func GetDefaultConfig() *UserConfig {
|
||||
// This is only for tests; we don't want to use the test runner's host platform in that case,
|
||||
// but always use the fallback bindings
|
||||
return GetDefaultConfigForPlatform("")
|
||||
}
|
||||
|
||||
func GetDefaultConfigForPlatform(platform string) *UserConfig {
|
||||
return &UserConfig{
|
||||
Gui: GuiConfig{
|
||||
ScrollHeight: 2,
|
||||
|
|
@ -934,7 +940,7 @@ func GetDefaultConfig() *UserConfig {
|
|||
Confirm: "<enter>",
|
||||
ConfirmMenu: "<enter>",
|
||||
ConfirmSuggestion: "<enter>",
|
||||
ConfirmInEditor: "<a-enter>",
|
||||
ConfirmInEditor: platformKeyBinding(platform, map[string]string{"darwin": "<m-enter>"}, "<c-enter>"),
|
||||
ConfirmInEditorAlt: "<c-s>",
|
||||
Remove: "d",
|
||||
New: "n",
|
||||
|
|
@ -1081,3 +1087,10 @@ func GetDefaultConfig() *UserConfig {
|
|||
},
|
||||
}
|
||||
}
|
||||
|
||||
func platformKeyBinding(platform string, bindingByPlatform map[string]string, fallback string) string {
|
||||
if binding, ok := bindingByPlatform[platform]; ok {
|
||||
return binding
|
||||
}
|
||||
return fallback
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1440,7 +1440,8 @@
|
|||
},
|
||||
"confirmInEditor": {
|
||||
"type": "string",
|
||||
"default": "\u003ca-enter\u003e"
|
||||
"description": "\u003cm-enter\u003e on Mac",
|
||||
"default": "\u003cc-enter\u003e"
|
||||
},
|
||||
"confirmInEditor-alt": {
|
||||
"type": "string",
|
||||
|
|
|
|||
Loading…
Reference in a new issue