Skip to content

Commit

Permalink
Make Keybindings definition in UserConfig struct last
Browse files Browse the repository at this point in the history
This makes the generated default config in Config.md match the original
order.
  • Loading branch information
karimkhaleel committed May 19, 2024
1 parent 21dd70c commit 88e57fd
Show file tree
Hide file tree
Showing 3 changed files with 568 additions and 568 deletions.
118 changes: 59 additions & 59 deletions docs/Config.md
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,65 @@ refresher:
# Auto-fetch can be disabled via option 'git.autoFetch'.
fetchInterval: 60

# Config relating to things outside of Lazygit like how files are opened, copying to clipboard, etc
os:
# Command for editing a file. Should contain "{{filename}}".
edit: ""

# Command for editing a file at a given line number. Should contain
# "{{filename}}", and may optionally contain "{{line}}".
editAtLine: ""

# Same as EditAtLine, except that the command needs to wait until the
# window is closed.
editAtLineAndWait: ""

# For opening a directory in an editor
openDirInEditor: ""

# A built-in preset that sets all of the above settings. Supported presets
# are defined in the getPreset function in editor_presets.go.
editPreset: ""

# Command for opening a file, as if the file is double-clicked. Should
# contain "{{filename}}", but doesn't support "{{line}}".
open: ""

# Command for opening a link. Should contain "{{link}}".
openLink: ""

# EditCommand is the command for editing a file.
# Deprecated: use Edit instead. Note that semantics are different:
# EditCommand is just the command itself, whereas Edit contains a
# "{{filename}}" variable.
editCommand: ""

# EditCommandTemplate is the command template for editing a file
# Deprecated: use EditAtLine instead.
editCommandTemplate: ""

# OpenCommand is the command for opening a file
# Deprecated: use Open instead.
openCommand: ""

# OpenLinkCommand is the command for opening a link
# Deprecated: use OpenLink instead.
openLinkCommand: ""

# CopyToClipboardCmd is the command for copying to clipboard.
# See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#custom-command-for-copying-to-clipboard
copyToClipboardCmd: ""

# What to do when opening Lazygit outside of a git repo.
# - 'prompt': (default) ask whether to initialize a new repo or open in the most recent repo
# - 'create': initialize a new repo
# - 'skip': open most recent repo
# - 'quit': exit Lazygit
notARepository: prompt

# If true, display a confirmation when subprocess terminates. This allows you to view the output of the subprocess before returning to Lazygit.
promptToReturnFromSubprocess: true

# Keybindings
keybinding:
universal:
Expand Down Expand Up @@ -465,65 +524,6 @@ keybinding:
bulkMenu: b
commitMessage:
commitMenu: <c-o>

# Config relating to things outside of Lazygit like how files are opened, copying to clipboard, etc
os:
# Command for editing a file. Should contain "{{filename}}".
edit: ""

# Command for editing a file at a given line number. Should contain
# "{{filename}}", and may optionally contain "{{line}}".
editAtLine: ""

# Same as EditAtLine, except that the command needs to wait until the
# window is closed.
editAtLineAndWait: ""

# For opening a directory in an editor
openDirInEditor: ""

# A built-in preset that sets all of the above settings. Supported presets
# are defined in the getPreset function in editor_presets.go.
editPreset: ""

# Command for opening a file, as if the file is double-clicked. Should
# contain "{{filename}}", but doesn't support "{{line}}".
open: ""

# Command for opening a link. Should contain "{{link}}".
openLink: ""

# EditCommand is the command for editing a file.
# Deprecated: use Edit instead. Note that semantics are different:
# EditCommand is just the command itself, whereas Edit contains a
# "{{filename}}" variable.
editCommand: ""

# EditCommandTemplate is the command template for editing a file
# Deprecated: use EditAtLine instead.
editCommandTemplate: ""

# OpenCommand is the command for opening a file
# Deprecated: use Open instead.
openCommand: ""

# OpenLinkCommand is the command for opening a link
# Deprecated: use OpenLink instead.
openLinkCommand: ""

# CopyToClipboardCmd is the command for copying to clipboard.
# See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#custom-command-for-copying-to-clipboard
copyToClipboardCmd: ""

# What to do when opening Lazygit outside of a git repo.
# - 'prompt': (default) ask whether to initialize a new repo or open in the most recent repo
# - 'create': initialize a new repo
# - 'skip': open most recent repo
# - 'quit': exit Lazygit
notARepository: prompt

# If true, display a confirmation when subprocess terminates. This allows you to view the output of the subprocess before returning to Lazygit.
promptToReturnFromSubprocess: true
```
<!-- END CONFIG YAML -->
Expand Down
20 changes: 10 additions & 10 deletions pkg/config/user_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ type UserConfig struct {
ConfirmOnQuit bool `yaml:"confirmOnQuit"`
// If true, exit Lazygit when the user presses escape in a context where there is nothing to cancel/close
QuitOnTopLevelReturn bool `yaml:"quitOnTopLevelReturn"`
// Keybindings
Keybinding KeybindingConfig `yaml:"keybinding"`
// Config relating to things outside of Lazygit like how files are opened, copying to clipboard, etc
OS OSConfig `yaml:"os,omitempty"`
// If true, don't display introductory popups upon opening Lazygit.
Expand All @@ -38,6 +36,8 @@ type UserConfig struct {
NotARepository string `yaml:"notARepository" jsonschema:"enum=prompt,enum=create,enum=skip,enum=quit"`
// If true, display a confirmation when subprocess terminates. This allows you to view the output of the subprocess before returning to Lazygit.
PromptToReturnFromSubprocess bool `yaml:"promptToReturnFromSubprocess"`
// Keybindings
Keybinding KeybindingConfig `yaml:"keybinding"`
}

type RefresherConfig struct {
Expand Down Expand Up @@ -736,8 +736,14 @@ func GetDefaultConfig() *UserConfig {
Method: "prompt",
Days: 14,
},
ConfirmOnQuit: false,
QuitOnTopLevelReturn: false,
ConfirmOnQuit: false,
QuitOnTopLevelReturn: false,
OS: OSConfig{},
DisableStartupPopups: false,
CustomCommands: []CustomCommand(nil),
Services: map[string]string(nil),
NotARepository: "prompt",
PromptToReturnFromSubprocess: true,
Keybinding: KeybindingConfig{
Universal: KeybindingUniversalConfig{
Quit: "q",
Expand Down Expand Up @@ -904,11 +910,5 @@ func GetDefaultConfig() *UserConfig {
CommitMenu: "<c-o>",
},
},
OS: OSConfig{},
DisableStartupPopups: false,
CustomCommands: []CustomCommand(nil),
Services: map[string]string(nil),
NotARepository: "prompt",
PromptToReturnFromSubprocess: true,
}
}
Loading

0 comments on commit 88e57fd

Please sign in to comment.