mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-04-23 12:18:51 +02:00
have typed default config
This commit is contained in:
parent
ca31e5258f
commit
7d9aa97f96
10
main.go
10
main.go
@ -48,6 +48,9 @@ func main() {
|
|||||||
configFlag := false
|
configFlag := false
|
||||||
flaggy.Bool(&configFlag, "c", "config", "Print the default config")
|
flaggy.Bool(&configFlag, "c", "config", "Print the default config")
|
||||||
|
|
||||||
|
configDirFlag := false
|
||||||
|
flaggy.Bool(&configDirFlag, "cd", "config-dir", "Print the config directory")
|
||||||
|
|
||||||
workTree := ""
|
workTree := ""
|
||||||
flaggy.String(&workTree, "w", "work-tree", "equivalent of the --work-tree git argument")
|
flaggy.String(&workTree, "w", "work-tree", "equivalent of the --work-tree git argument")
|
||||||
|
|
||||||
@ -85,7 +88,12 @@ func main() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err.Error())
|
log.Fatal(err.Error())
|
||||||
}
|
}
|
||||||
fmt.Printf("%v\n", buf.String())
|
fmt.Printf("%s\n", buf.String())
|
||||||
|
os.Exit(0)
|
||||||
|
}
|
||||||
|
|
||||||
|
if configDirFlag {
|
||||||
|
fmt.Printf("%s\n", config.ConfigDir())
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ type AppConfigurer interface {
|
|||||||
|
|
||||||
// NewAppConfig makes a new app config
|
// NewAppConfig makes a new app config
|
||||||
func NewAppConfig(name, version, commit, date string, buildSource string, debuggingFlag bool) (*AppConfig, error) {
|
func NewAppConfig(name, version, commit, date string, buildSource string, debuggingFlag bool) (*AppConfig, error) {
|
||||||
configDir, err := findOrCreateConfigDir(name)
|
configDir, err := findOrCreateConfigDir()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -80,11 +80,15 @@ func NewAppConfig(name, version, commit, date string, buildSource string, debugg
|
|||||||
return appConfig, nil
|
return appConfig, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func findOrCreateConfigDir(projectName string) (string, error) {
|
func ConfigDir() string {
|
||||||
// chucking my name there is not for vanity purposes, the xdg spec (and that
|
// chucking my name there is not for vanity purposes, the xdg spec (and that
|
||||||
// function) requires a vendor name. May as well line up with github
|
// function) requires a vendor name. May as well line up with github
|
||||||
configDirs := xdg.New("jesseduffield", projectName)
|
configDirs := xdg.New("jesseduffield", "lazygit")
|
||||||
folder := configDirs.ConfigHome()
|
return configDirs.ConfigHome()
|
||||||
|
}
|
||||||
|
|
||||||
|
func findOrCreateConfigDir() (string, error) {
|
||||||
|
folder := ConfigDir()
|
||||||
|
|
||||||
err := os.MkdirAll(folder, 0755)
|
err := os.MkdirAll(folder, 0755)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -186,7 +190,7 @@ func (c *AppConfig) GetUserConfigDir() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func configFilePath(filename string) (string, error) {
|
func configFilePath(filename string) (string, error) {
|
||||||
folder, err := findOrCreateConfigDir("lazygit")
|
folder, err := findOrCreateConfigDir()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
@ -239,184 +243,6 @@ func loadAppState() (*AppState, error) {
|
|||||||
return appState, nil
|
return appState, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetDefaultConfig() *UserConfig {
|
|
||||||
userConfig := &UserConfig{}
|
|
||||||
|
|
||||||
if err := yaml.Unmarshal(GetDefaultConfigBytes(), userConfig); err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
userConfig.OS = GetPlatformDefaultConfig()
|
|
||||||
|
|
||||||
return userConfig
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetDefaultConfigBytes returns the application default configuration
|
|
||||||
func GetDefaultConfigBytes() []byte {
|
|
||||||
return []byte(
|
|
||||||
`gui:
|
|
||||||
## stuff relating to the UI
|
|
||||||
scrollHeight: 2
|
|
||||||
scrollPastBottom: true
|
|
||||||
mouseEvents: true
|
|
||||||
skipUnstageLineWarning: false
|
|
||||||
skipStashWarning: true
|
|
||||||
sidePanelWidth: 0.3333
|
|
||||||
expandFocusedSidePanel: false
|
|
||||||
mainPanelSplitMode: 'flexible' # one of 'horizontal' | 'flexible' | 'vertical'
|
|
||||||
theme:
|
|
||||||
lightTheme: false
|
|
||||||
activeBorderColor:
|
|
||||||
- green
|
|
||||||
- bold
|
|
||||||
inactiveBorderColor:
|
|
||||||
- white
|
|
||||||
optionsTextColor:
|
|
||||||
- blue
|
|
||||||
selectedLineBgColor:
|
|
||||||
- default
|
|
||||||
selectedRangeBgColor:
|
|
||||||
- blue
|
|
||||||
commitLength:
|
|
||||||
show: true
|
|
||||||
git:
|
|
||||||
paging:
|
|
||||||
colorArg: always
|
|
||||||
useConfig: false
|
|
||||||
merging:
|
|
||||||
manualCommit: false
|
|
||||||
args: ""
|
|
||||||
pull:
|
|
||||||
mode: 'merge' # one of 'merge' | 'rebase' | 'ff-only'
|
|
||||||
skipHookPrefix: 'WIP'
|
|
||||||
autoFetch: true
|
|
||||||
branchLogCmd: "git log --graph --color=always --abbrev-commit --decorate --date=relative --pretty=medium {{branchName}} --"
|
|
||||||
overrideGpg: false # prevents lazygit from spawning a separate process when using GPG
|
|
||||||
disableForcePushing: false
|
|
||||||
update:
|
|
||||||
method: prompt # can be: prompt | background | never
|
|
||||||
days: 14 # how often a update is checked for
|
|
||||||
reporting: 'undetermined' # one of: 'on' | 'off' | 'undetermined'
|
|
||||||
splashUpdatesIndex: 0
|
|
||||||
confirmOnQuit: false
|
|
||||||
quitOnTopLevelReturn: true
|
|
||||||
disableStartupPopups: false
|
|
||||||
keybinding:
|
|
||||||
universal:
|
|
||||||
quit: 'q'
|
|
||||||
quit-alt1: '<c-c>'
|
|
||||||
return: '<esc>'
|
|
||||||
quitWithoutChangingDirectory: 'Q'
|
|
||||||
togglePanel: '<tab>'
|
|
||||||
prevItem: '<up>'
|
|
||||||
nextItem: '<down>'
|
|
||||||
prevItem-alt: 'k'
|
|
||||||
nextItem-alt: 'j'
|
|
||||||
prevPage: ','
|
|
||||||
nextPage: '.'
|
|
||||||
gotoTop: '<'
|
|
||||||
gotoBottom: '>'
|
|
||||||
prevBlock: '<left>'
|
|
||||||
nextBlock: '<right>'
|
|
||||||
prevBlock-alt: 'h'
|
|
||||||
nextBlock-alt: 'l'
|
|
||||||
nextMatch: 'n'
|
|
||||||
prevMatch: 'N'
|
|
||||||
startSearch: '/'
|
|
||||||
optionMenu: 'x'
|
|
||||||
optionMenu-alt1: '?'
|
|
||||||
select: '<space>'
|
|
||||||
goInto: '<enter>'
|
|
||||||
confirm: '<enter>'
|
|
||||||
confirm-alt1: 'y'
|
|
||||||
remove: 'd'
|
|
||||||
new: 'n'
|
|
||||||
edit: 'e'
|
|
||||||
openFile: 'o'
|
|
||||||
scrollUpMain: '<pgup>'
|
|
||||||
scrollDownMain: '<pgdown>'
|
|
||||||
scrollUpMain-alt1: 'K'
|
|
||||||
scrollDownMain-alt1: 'J'
|
|
||||||
scrollUpMain-alt2: '<c-u>'
|
|
||||||
scrollDownMain-alt2: '<c-d>'
|
|
||||||
executeCustomCommand: ':'
|
|
||||||
createRebaseOptionsMenu: 'm'
|
|
||||||
pushFiles: 'P'
|
|
||||||
pullFiles: 'p'
|
|
||||||
refresh: 'R'
|
|
||||||
createPatchOptionsMenu: '<c-p>'
|
|
||||||
nextTab: ']'
|
|
||||||
prevTab: '['
|
|
||||||
nextScreenMode: '+'
|
|
||||||
prevScreenMode: '_'
|
|
||||||
undo: 'z'
|
|
||||||
redo: '<c-z>'
|
|
||||||
filteringMenu: <c-s>
|
|
||||||
diffingMenu: 'W'
|
|
||||||
diffingMenu-alt: '<c-e>'
|
|
||||||
copyToClipboard: '<c-o>'
|
|
||||||
status:
|
|
||||||
checkForUpdate: 'u'
|
|
||||||
recentRepos: '<enter>'
|
|
||||||
files:
|
|
||||||
commitChanges: 'c'
|
|
||||||
commitChangesWithoutHook: 'w'
|
|
||||||
amendLastCommit: 'A'
|
|
||||||
commitChangesWithEditor: 'C'
|
|
||||||
ignoreFile: 'i'
|
|
||||||
refreshFiles: 'r'
|
|
||||||
stashAllChanges: 's'
|
|
||||||
viewStashOptions: 'S'
|
|
||||||
toggleStagedAll: 'a'
|
|
||||||
viewResetOptions: 'D'
|
|
||||||
fetch: 'f'
|
|
||||||
branches:
|
|
||||||
createPullRequest: 'o'
|
|
||||||
checkoutBranchByName: 'c'
|
|
||||||
forceCheckoutBranch: 'F'
|
|
||||||
rebaseBranch: 'r'
|
|
||||||
renameBranch: 'R'
|
|
||||||
mergeIntoCurrentBranch: 'M'
|
|
||||||
viewGitFlowOptions: 'i'
|
|
||||||
fastForward: 'f'
|
|
||||||
pushTag: 'P'
|
|
||||||
setUpstream: 'u'
|
|
||||||
fetchRemote: 'f'
|
|
||||||
commits:
|
|
||||||
squashDown: 's'
|
|
||||||
renameCommit: 'r'
|
|
||||||
renameCommitWithEditor: 'R'
|
|
||||||
viewResetOptions: 'g'
|
|
||||||
markCommitAsFixup: 'f'
|
|
||||||
createFixupCommit: 'F'
|
|
||||||
squashAboveCommits: 'S'
|
|
||||||
moveDownCommit: '<c-j>'
|
|
||||||
moveUpCommit: '<c-k>'
|
|
||||||
amendToCommit: 'A'
|
|
||||||
pickCommit: 'p'
|
|
||||||
revertCommit: 't'
|
|
||||||
cherryPickCopy: 'c'
|
|
||||||
cherryPickCopyRange: 'C'
|
|
||||||
pasteCommits: 'v'
|
|
||||||
tagCommit: 'T'
|
|
||||||
checkoutCommit: '<space>'
|
|
||||||
resetCherryPick: '<c-R>'
|
|
||||||
stash:
|
|
||||||
popStash: 'g'
|
|
||||||
commitFiles:
|
|
||||||
checkoutCommitFile: 'c'
|
|
||||||
main:
|
|
||||||
toggleDragSelect: 'v'
|
|
||||||
toggleDragSelect-alt: 'V'
|
|
||||||
toggleSelectHunk: 'a'
|
|
||||||
pickBothHunks: 'b'
|
|
||||||
submodules:
|
|
||||||
init: 'i'
|
|
||||||
update: 'u'
|
|
||||||
bulkMenu: 'b'
|
|
||||||
`)
|
|
||||||
}
|
|
||||||
|
|
||||||
// AppState stores data between runs of the app like when the last update check
|
// AppState stores data between runs of the app like when the last update check
|
||||||
// was performed and which other repos have been checked out
|
// was performed and which other repos have been checked out
|
||||||
type AppState struct {
|
type AppState struct {
|
||||||
|
@ -1,10 +0,0 @@
|
|||||||
package config
|
|
||||||
|
|
||||||
// OSConfig contains config on the level of the os
|
|
||||||
type OSConfig struct {
|
|
||||||
// OpenCommand is the command for opening a file
|
|
||||||
OpenCommand string `yaml:"openCommand,omitempty"`
|
|
||||||
|
|
||||||
// OpenCommand is the command for opening a link
|
|
||||||
OpenLinkCommand string `yaml:"openLinkCommand,omitempty"`
|
|
||||||
}
|
|
@ -1,8 +1,32 @@
|
|||||||
package config
|
package config
|
||||||
|
|
||||||
type CommitPrefixConfig struct {
|
type UserConfig struct {
|
||||||
Pattern string `yaml:"pattern"`
|
Gui GuiConfig `yaml:"gui"`
|
||||||
Replace string `yaml:"replace"`
|
Git GitConfig `yaml:"git"`
|
||||||
|
Update UpdateConfig `yaml:"update"`
|
||||||
|
Reporting string `yaml:"reporting"`
|
||||||
|
SplashUpdatesIndex int `yaml:"splashUpdatesIndex"`
|
||||||
|
ConfirmOnQuit bool `yaml:"confirmOnQuit"`
|
||||||
|
QuitOnTopLevelReturn bool `yaml:"quitOnTopLevelReturn"`
|
||||||
|
Keybinding KeybindingConfig `yaml:"keybinding"`
|
||||||
|
// OS determines what defaults are set for opening files and links
|
||||||
|
OS OSConfig `yaml:"os,omitempty"`
|
||||||
|
DisableStartupPopups bool `yaml:"disableStartupPopups"`
|
||||||
|
CustomCommands []CustomCommand `yaml:"customCommands"`
|
||||||
|
Services map[string]string `yaml:"services"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type GuiConfig struct {
|
||||||
|
ScrollHeight int `yaml:"scrollHeight"`
|
||||||
|
ScrollPastBottom bool `yaml:"scrollPastBottom"`
|
||||||
|
MouseEvents bool `yaml:"mouseEvents"`
|
||||||
|
SkipUnstageLineWarning bool `yaml:"skipUnstageLineWarning"`
|
||||||
|
SkipStashWarning bool `yaml:"skipStashWarning"`
|
||||||
|
SidePanelWidth float64 `yaml:"sidePanelWidth"`
|
||||||
|
ExpandFocusedSidePanel bool `yaml:"expandFocusedSidePanel"`
|
||||||
|
MainPanelSplitMode string `yaml:"mainPanelSplitMode"`
|
||||||
|
Theme ThemeConfig `yaml:"theme"`
|
||||||
|
CommitLength CommitLengthConfig `yaml:"commitLength"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ThemeConfig struct {
|
type ThemeConfig struct {
|
||||||
@ -14,78 +38,60 @@ type ThemeConfig struct {
|
|||||||
SelectedRangeBgColor []string `yaml:"selectedRangeBgColor"`
|
SelectedRangeBgColor []string `yaml:"selectedRangeBgColor"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type CustomCommandMenuOption struct {
|
type CommitLengthConfig struct {
|
||||||
Name string `yaml:"name"`
|
|
||||||
Description string `yaml:"description"`
|
|
||||||
Value string `yaml:"value"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type CustomCommandPrompt struct {
|
|
||||||
Type string `yaml:"type"` // one of 'input' and 'menu'
|
|
||||||
Title string `yaml:"title"`
|
|
||||||
|
|
||||||
// this only apply to prompts
|
|
||||||
InitialValue string `yaml:"initialValue"`
|
|
||||||
|
|
||||||
// this only applies to menus
|
|
||||||
Options []CustomCommandMenuOption
|
|
||||||
}
|
|
||||||
|
|
||||||
type CustomCommand struct {
|
|
||||||
Key string `yaml:"key"`
|
|
||||||
Context string `yaml:"context"`
|
|
||||||
Command string `yaml:"command"`
|
|
||||||
Subprocess bool `yaml:"subprocess"`
|
|
||||||
Prompts []CustomCommandPrompt `yaml:"prompts"`
|
|
||||||
LoadingText string `yaml:"loadingText"`
|
|
||||||
Description string `yaml:"description"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type UserConfig struct {
|
|
||||||
Gui struct {
|
|
||||||
ScrollHeight int `yaml:"scrollHeight"`
|
|
||||||
ScrollPastBottom bool `yaml:"scrollPastBottom"`
|
|
||||||
MouseEvents bool `yaml:"mouseEvents"`
|
|
||||||
SkipUnstageLineWarning bool `yaml:"skipUnstageLineWarning"`
|
|
||||||
SkipStashWarning bool `yaml:"skipStashWarning"`
|
|
||||||
SidePanelWidth float64 `yaml:"sidePanelWidth"`
|
|
||||||
ExpandFocusedSidePanel bool `yaml:"expandFocusedSidePanel"`
|
|
||||||
MainPanelSplitMode string `yaml:"mainPanelSplitMode"`
|
|
||||||
Theme ThemeConfig `yaml:"theme"`
|
|
||||||
CommitLength struct {
|
|
||||||
Show bool `yaml:"show"`
|
Show bool `yaml:"show"`
|
||||||
} `yaml:"commitLength"`
|
}
|
||||||
} `yaml:"gui"`
|
|
||||||
Git struct {
|
type GitConfig struct {
|
||||||
Paging struct {
|
Paging PagingConfig `yaml:"paging"`
|
||||||
ColorArg string `yaml:"colorArg"`
|
Merging MergingConfig `yaml:"merging"`
|
||||||
Pager string `yaml:"pager"`
|
Pull PullConfig `yaml:"pull"`
|
||||||
UseConfig bool `yaml:"useConfig"`
|
|
||||||
} `yaml:"paging"`
|
|
||||||
Merging struct {
|
|
||||||
ManualCommit bool `yaml:"manualCommit"`
|
|
||||||
Args string `yaml:"args"`
|
|
||||||
} `yaml:"merging"`
|
|
||||||
Pull struct {
|
|
||||||
Mode string `yaml:"mode"`
|
|
||||||
} `yaml:"pull"`
|
|
||||||
SkipHookPrefix string `yaml:"skipHookPrefix"`
|
SkipHookPrefix string `yaml:"skipHookPrefix"`
|
||||||
AutoFetch bool `yaml:"autoFetch"`
|
AutoFetch bool `yaml:"autoFetch"`
|
||||||
BranchLogCmd string `yaml:"branchLogCmd"`
|
BranchLogCmd string `yaml:"branchLogCmd"`
|
||||||
OverrideGpg bool `yaml:"overrideGpg"`
|
OverrideGpg bool `yaml:"overrideGpg"`
|
||||||
DisableForcePushing bool `yaml:"disableForcePushing"`
|
DisableForcePushing bool `yaml:"disableForcePushing"`
|
||||||
CommitPrefixes map[string]CommitPrefixConfig `yaml:"commitPrefixes"`
|
CommitPrefixes map[string]CommitPrefixConfig `yaml:"commitPrefixes"`
|
||||||
} `yaml:"git"`
|
}
|
||||||
Update struct {
|
|
||||||
|
type PagingConfig struct {
|
||||||
|
ColorArg string `yaml:"colorArg"`
|
||||||
|
Pager string `yaml:"pager"`
|
||||||
|
UseConfig bool `yaml:"useConfig"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type MergingConfig struct {
|
||||||
|
ManualCommit bool `yaml:"manualCommit"`
|
||||||
|
Args string `yaml:"args"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type PullConfig struct {
|
||||||
|
Mode string `yaml:"mode"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type CommitPrefixConfig struct {
|
||||||
|
Pattern string `yaml:"pattern"`
|
||||||
|
Replace string `yaml:"replace"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type UpdateConfig struct {
|
||||||
Method string `yaml:"method"`
|
Method string `yaml:"method"`
|
||||||
Days int64 `yaml:"days"`
|
Days int64 `yaml:"days"`
|
||||||
} `yaml:"update"`
|
}
|
||||||
Reporting string `yaml:"reporting"`
|
|
||||||
SplashUpdatesIndex int `yaml:"splashUpdatesIndex"`
|
type KeybindingConfig struct {
|
||||||
ConfirmOnQuit bool `yaml:"confirmOnQuit"`
|
Universal KeybindingUniversalConfig `yaml:"universal"`
|
||||||
QuitOnTopLevelReturn bool `yaml:"quitOnTopLevelReturn"`
|
Status KeybindingStatusConfig `yaml:"status"`
|
||||||
Keybinding struct {
|
Files KeybindingFilesConfig `yaml:"files"`
|
||||||
Universal struct {
|
Branches KeybindingBranchesConfig `yaml:"branches"`
|
||||||
|
Commits KeybindingCommitsConfig `yaml:"commits"`
|
||||||
|
Stash KeybindingStashConfig `yaml:"stash"`
|
||||||
|
CommitFiles KeybindingCommitFilesConfig `yaml:"commitFiles"`
|
||||||
|
Main KeybindingMainConfig `yaml:"main"`
|
||||||
|
Submodules KeybindingSubmodulesConfig `yaml:"submodules"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type KeybindingUniversalConfig struct {
|
||||||
Quit string `yaml:"quit"`
|
Quit string `yaml:"quit"`
|
||||||
QuitAlt1 string `yaml:"quit-alt1"`
|
QuitAlt1 string `yaml:"quit-alt1"`
|
||||||
Return string `yaml:"return"`
|
Return string `yaml:"return"`
|
||||||
@ -138,12 +144,14 @@ type UserConfig struct {
|
|||||||
DiffingMenu string `yaml:"diffingMenu"`
|
DiffingMenu string `yaml:"diffingMenu"`
|
||||||
DiffingMenuAlt string `yaml:"diffingMenu-alt"`
|
DiffingMenuAlt string `yaml:"diffingMenu-alt"`
|
||||||
CopyToClipboard string `yaml:"copyToClipboard"`
|
CopyToClipboard string `yaml:"copyToClipboard"`
|
||||||
} `yaml:"universal"`
|
}
|
||||||
Status struct {
|
|
||||||
|
type KeybindingStatusConfig struct {
|
||||||
CheckForUpdate string `yaml:"checkForUpdate"`
|
CheckForUpdate string `yaml:"checkForUpdate"`
|
||||||
RecentRepos string `yaml:"recentRepos"`
|
RecentRepos string `yaml:"recentRepos"`
|
||||||
} `yaml:"status"`
|
}
|
||||||
Files struct {
|
|
||||||
|
type KeybindingFilesConfig struct {
|
||||||
CommitChanges string `yaml:"commitChanges"`
|
CommitChanges string `yaml:"commitChanges"`
|
||||||
CommitChangesWithoutHook string `yaml:"commitChangesWithoutHook"`
|
CommitChangesWithoutHook string `yaml:"commitChangesWithoutHook"`
|
||||||
AmendLastCommit string `yaml:"amendLastCommit"`
|
AmendLastCommit string `yaml:"amendLastCommit"`
|
||||||
@ -155,8 +163,9 @@ type UserConfig struct {
|
|||||||
ToggleStagedAll string `yaml:"toggleStagedAll"`
|
ToggleStagedAll string `yaml:"toggleStagedAll"`
|
||||||
ViewResetOptions string `yaml:"viewResetOptions"`
|
ViewResetOptions string `yaml:"viewResetOptions"`
|
||||||
Fetch string `yaml:"fetch"`
|
Fetch string `yaml:"fetch"`
|
||||||
} `yaml:"files"`
|
}
|
||||||
Branches struct {
|
|
||||||
|
type KeybindingBranchesConfig struct {
|
||||||
CreatePullRequest string `yaml:"createPullRequest"`
|
CreatePullRequest string `yaml:"createPullRequest"`
|
||||||
CheckoutBranchByName string `yaml:"checkoutBranchByName"`
|
CheckoutBranchByName string `yaml:"checkoutBranchByName"`
|
||||||
ForceCheckoutBranch string `yaml:"forceCheckoutBranch"`
|
ForceCheckoutBranch string `yaml:"forceCheckoutBranch"`
|
||||||
@ -168,8 +177,9 @@ type UserConfig struct {
|
|||||||
PushTag string `yaml:"pushTag"`
|
PushTag string `yaml:"pushTag"`
|
||||||
SetUpstream string `yaml:"setUpstream"`
|
SetUpstream string `yaml:"setUpstream"`
|
||||||
FetchRemote string `yaml:"fetchRemote"`
|
FetchRemote string `yaml:"fetchRemote"`
|
||||||
} `yaml:"branches"`
|
}
|
||||||
Commits struct {
|
|
||||||
|
type KeybindingCommitsConfig struct {
|
||||||
SquashDown string `yaml:"squashDown"`
|
SquashDown string `yaml:"squashDown"`
|
||||||
RenameCommit string `yaml:"renameCommit"`
|
RenameCommit string `yaml:"renameCommit"`
|
||||||
RenameCommitWithEditor string `yaml:"renameCommitWithEditor"`
|
RenameCommitWithEditor string `yaml:"renameCommitWithEditor"`
|
||||||
@ -188,28 +198,238 @@ type UserConfig struct {
|
|||||||
TagCommit string `yaml:"tagCommit"`
|
TagCommit string `yaml:"tagCommit"`
|
||||||
CheckoutCommit string `yaml:"checkoutCommit"`
|
CheckoutCommit string `yaml:"checkoutCommit"`
|
||||||
ResetCherryPick string `yaml:"resetCherryPick"`
|
ResetCherryPick string `yaml:"resetCherryPick"`
|
||||||
} `yaml:"commits"`
|
}
|
||||||
Stash struct {
|
|
||||||
|
type KeybindingStashConfig struct {
|
||||||
PopStash string `yaml:"popStash"`
|
PopStash string `yaml:"popStash"`
|
||||||
} `yaml:"stash"`
|
}
|
||||||
CommitFiles struct {
|
|
||||||
|
type KeybindingCommitFilesConfig struct {
|
||||||
CheckoutCommitFile string `yaml:"checkoutCommitFile"`
|
CheckoutCommitFile string `yaml:"checkoutCommitFile"`
|
||||||
} `yaml:"commitFiles"`
|
}
|
||||||
Main struct {
|
|
||||||
|
type KeybindingMainConfig struct {
|
||||||
ToggleDragSelect string `yaml:"toggleDragSelect"`
|
ToggleDragSelect string `yaml:"toggleDragSelect"`
|
||||||
ToggleDragSelectAlt string `yaml:"toggleDragSelect-alt"`
|
ToggleDragSelectAlt string `yaml:"toggleDragSelect-alt"`
|
||||||
ToggleSelectHunk string `yaml:"toggleSelectHunk"`
|
ToggleSelectHunk string `yaml:"toggleSelectHunk"`
|
||||||
PickBothHunks string `yaml:"pickBothHunks"`
|
PickBothHunks string `yaml:"pickBothHunks"`
|
||||||
} `yaml:"main"`
|
}
|
||||||
Submodules struct {
|
|
||||||
|
type KeybindingSubmodulesConfig struct {
|
||||||
Init string `yaml:"init"`
|
Init string `yaml:"init"`
|
||||||
Update string `yaml:"update"`
|
Update string `yaml:"update"`
|
||||||
BulkMenu string `yaml:"bulkMenu"`
|
BulkMenu string `yaml:"bulkMenu"`
|
||||||
} `yaml:"submodules"`
|
}
|
||||||
} `yaml:"keybinding"`
|
|
||||||
// OS determines what defaults are set for opening files and links
|
// OSConfig contains config on the level of the os
|
||||||
OS OSConfig `yaml:"os,omitempty"`
|
type OSConfig struct {
|
||||||
DisableStartupPopups bool `yaml:"disableStartupPopups"`
|
// OpenCommand is the command for opening a file
|
||||||
CustomCommands []CustomCommand `yaml:"customCommands"`
|
OpenCommand string `yaml:"openCommand,omitempty"`
|
||||||
Services map[string]string `yaml:"services"`
|
|
||||||
|
// OpenCommand is the command for opening a link
|
||||||
|
OpenLinkCommand string `yaml:"openLinkCommand,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type CustomCommand struct {
|
||||||
|
Key string `yaml:"key"`
|
||||||
|
Context string `yaml:"context"`
|
||||||
|
Command string `yaml:"command"`
|
||||||
|
Subprocess bool `yaml:"subprocess"`
|
||||||
|
Prompts []CustomCommandPrompt `yaml:"prompts"`
|
||||||
|
LoadingText string `yaml:"loadingText"`
|
||||||
|
Description string `yaml:"description"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type CustomCommandPrompt struct {
|
||||||
|
Type string `yaml:"type"` // one of 'input' and 'menu'
|
||||||
|
Title string `yaml:"title"`
|
||||||
|
|
||||||
|
// this only apply to prompts
|
||||||
|
InitialValue string `yaml:"initialValue"`
|
||||||
|
|
||||||
|
// this only applies to menus
|
||||||
|
Options []CustomCommandMenuOption
|
||||||
|
}
|
||||||
|
|
||||||
|
type CustomCommandMenuOption struct {
|
||||||
|
Name string `yaml:"name"`
|
||||||
|
Description string `yaml:"description"`
|
||||||
|
Value string `yaml:"value"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetDefaultConfig() *UserConfig {
|
||||||
|
return &UserConfig{
|
||||||
|
Gui: GuiConfig{
|
||||||
|
ScrollHeight: 2,
|
||||||
|
ScrollPastBottom: true,
|
||||||
|
MouseEvents: true,
|
||||||
|
SkipUnstageLineWarning: false,
|
||||||
|
SkipStashWarning: true,
|
||||||
|
SidePanelWidth: 0.3333,
|
||||||
|
ExpandFocusedSidePanel: false,
|
||||||
|
MainPanelSplitMode: "flexible",
|
||||||
|
Theme: ThemeConfig{
|
||||||
|
LightTheme: false,
|
||||||
|
ActiveBorderColor: []string{"green", "bold"},
|
||||||
|
InactiveBorderColor: []string{"white"},
|
||||||
|
OptionsTextColor: []string{"blue"},
|
||||||
|
SelectedLineBgColor: []string{"default"},
|
||||||
|
SelectedRangeBgColor: []string{"blue"},
|
||||||
|
},
|
||||||
|
CommitLength: CommitLengthConfig{Show: true},
|
||||||
|
},
|
||||||
|
Git: GitConfig{
|
||||||
|
Paging: PagingConfig{
|
||||||
|
ColorArg: "always",
|
||||||
|
Pager: "",
|
||||||
|
UseConfig: false},
|
||||||
|
Merging: MergingConfig{
|
||||||
|
ManualCommit: false,
|
||||||
|
Args: "",
|
||||||
|
},
|
||||||
|
Pull: PullConfig{
|
||||||
|
Mode: "merge",
|
||||||
|
},
|
||||||
|
SkipHookPrefix: "WIP",
|
||||||
|
AutoFetch: true,
|
||||||
|
BranchLogCmd: "git log --graph --color=always --abbrev-commit --decorate --date=relative --pretty=medium {{branchName}} --",
|
||||||
|
OverrideGpg: false,
|
||||||
|
DisableForcePushing: false,
|
||||||
|
CommitPrefixes: map[string]CommitPrefixConfig(nil),
|
||||||
|
},
|
||||||
|
Update: UpdateConfig{
|
||||||
|
Method: "prompt",
|
||||||
|
Days: 14,
|
||||||
|
},
|
||||||
|
Reporting: "undetermined",
|
||||||
|
SplashUpdatesIndex: 0,
|
||||||
|
ConfirmOnQuit: false,
|
||||||
|
QuitOnTopLevelReturn: true,
|
||||||
|
Keybinding: KeybindingConfig{
|
||||||
|
Universal: KeybindingUniversalConfig{
|
||||||
|
Quit: "q",
|
||||||
|
QuitAlt1: "<c-c>",
|
||||||
|
Return: "<esc>",
|
||||||
|
QuitWithoutChangingDirectory: "Q",
|
||||||
|
TogglePanel: "<tab>",
|
||||||
|
PrevItem: "<up>",
|
||||||
|
NextItem: "<down>",
|
||||||
|
PrevItemAlt: "k",
|
||||||
|
NextItemAlt: "j",
|
||||||
|
PrevPage: ",",
|
||||||
|
NextPage: ".",
|
||||||
|
GotoTop: "<",
|
||||||
|
GotoBottom: ">",
|
||||||
|
PrevBlock: "<left>",
|
||||||
|
NextBlock: "<right>",
|
||||||
|
PrevBlockAlt: "h",
|
||||||
|
NextBlockAlt: "l",
|
||||||
|
NextMatch: "n",
|
||||||
|
PrevMatch: "N",
|
||||||
|
StartSearch: "/",
|
||||||
|
OptionMenu: "x",
|
||||||
|
OptionMenuAlt1: "?",
|
||||||
|
Select: "<space>",
|
||||||
|
GoInto: "<enter>",
|
||||||
|
Confirm: "<enter>",
|
||||||
|
ConfirmAlt1: "y",
|
||||||
|
Remove: "d",
|
||||||
|
New: "n",
|
||||||
|
Edit: "e",
|
||||||
|
OpenFile: "o",
|
||||||
|
ScrollUpMain: "<pgup>",
|
||||||
|
ScrollDownMain: "<pgdown>",
|
||||||
|
ScrollUpMainAlt1: "K",
|
||||||
|
ScrollDownMainAlt1: "J",
|
||||||
|
ScrollUpMainAlt2: "<c-u>",
|
||||||
|
ScrollDownMainAlt2: "<c-d>",
|
||||||
|
ExecuteCustomCommand: ":",
|
||||||
|
CreateRebaseOptionsMenu: "m",
|
||||||
|
PushFiles: "P",
|
||||||
|
PullFiles: "p",
|
||||||
|
Refresh: "R",
|
||||||
|
CreatePatchOptionsMenu: "<c-p>",
|
||||||
|
NextTab: "]",
|
||||||
|
PrevTab: "[",
|
||||||
|
NextScreenMode: "+",
|
||||||
|
PrevScreenMode: "_",
|
||||||
|
Undo: "z",
|
||||||
|
Redo: "<c-z>",
|
||||||
|
FilteringMenu: "<c-s>",
|
||||||
|
DiffingMenu: "W",
|
||||||
|
DiffingMenuAlt: "<c-e>",
|
||||||
|
CopyToClipboard: "<c-o>",
|
||||||
|
},
|
||||||
|
Status: KeybindingStatusConfig{
|
||||||
|
CheckForUpdate: "u",
|
||||||
|
RecentRepos: "<enter>",
|
||||||
|
},
|
||||||
|
Files: KeybindingFilesConfig{
|
||||||
|
CommitChanges: "c",
|
||||||
|
CommitChangesWithoutHook: "w",
|
||||||
|
AmendLastCommit: "A",
|
||||||
|
CommitChangesWithEditor: "C",
|
||||||
|
IgnoreFile: "i",
|
||||||
|
RefreshFiles: "r",
|
||||||
|
StashAllChanges: "s",
|
||||||
|
ViewStashOptions: "S",
|
||||||
|
ToggleStagedAll: "a",
|
||||||
|
ViewResetOptions: "D",
|
||||||
|
Fetch: "f",
|
||||||
|
},
|
||||||
|
Branches: KeybindingBranchesConfig{
|
||||||
|
CreatePullRequest: "o",
|
||||||
|
CheckoutBranchByName: "c",
|
||||||
|
ForceCheckoutBranch: "F",
|
||||||
|
RebaseBranch: "r",
|
||||||
|
RenameBranch: "R",
|
||||||
|
MergeIntoCurrentBranch: "M",
|
||||||
|
ViewGitFlowOptions: "i",
|
||||||
|
FastForward: "f",
|
||||||
|
PushTag: "P",
|
||||||
|
SetUpstream: "u",
|
||||||
|
FetchRemote: "f",
|
||||||
|
},
|
||||||
|
Commits: KeybindingCommitsConfig{SquashDown: "s",
|
||||||
|
RenameCommit: "r",
|
||||||
|
RenameCommitWithEditor: "R",
|
||||||
|
ViewResetOptions: "g",
|
||||||
|
MarkCommitAsFixup: "f",
|
||||||
|
CreateFixupCommit: "F",
|
||||||
|
SquashAboveCommits: "S",
|
||||||
|
MoveDownCommit: "<c-j>",
|
||||||
|
MoveUpCommit: "<c-k>",
|
||||||
|
AmendToCommit: "A",
|
||||||
|
PickCommit: "p",
|
||||||
|
RevertCommit: "t",
|
||||||
|
CherryPickCopy: "c",
|
||||||
|
CherryPickCopyRange: "C",
|
||||||
|
PasteCommits: "v",
|
||||||
|
TagCommit: "T",
|
||||||
|
CheckoutCommit: "<space>",
|
||||||
|
ResetCherryPick: "<c-R>",
|
||||||
|
},
|
||||||
|
Stash: KeybindingStashConfig{
|
||||||
|
PopStash: "g",
|
||||||
|
},
|
||||||
|
CommitFiles: KeybindingCommitFilesConfig{
|
||||||
|
CheckoutCommitFile: "c",
|
||||||
|
},
|
||||||
|
Main: KeybindingMainConfig{
|
||||||
|
ToggleDragSelect: "v",
|
||||||
|
ToggleDragSelectAlt: "V",
|
||||||
|
ToggleSelectHunk: "a",
|
||||||
|
PickBothHunks: "b",
|
||||||
|
},
|
||||||
|
Submodules: KeybindingSubmodulesConfig{
|
||||||
|
Init: "i",
|
||||||
|
Update: "u",
|
||||||
|
BulkMenu: "b",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
OS: GetPlatformDefaultConfig(),
|
||||||
|
DisableStartupPopups: false,
|
||||||
|
CustomCommands: []CustomCommand(nil),
|
||||||
|
Services: map[string]string(nil),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user