diff --git a/README.md b/README.md index 83cd83e13..bcfb7d63f 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Jira? This is the app for you! - [Installation](https://github.com/jesseduffield/lazygit#installation) - [Usage](https://github.com/jesseduffield/lazygit#usage), - [Keybindings](https://github.com/jesseduffield/lazygit/blob/master/docs/Keybindings_en.md) + [Keybindings](/docs/keybindings) - [Cool Features](https://github.com/jesseduffield/lazygit#cool-features) - [Contributing](https://github.com/jesseduffield/lazygit#contributing) - [Video Tutorial](https://youtu.be/VDXvbHZYeKY) @@ -104,7 +104,7 @@ whichever rc file you're using). - Basic video tutorial [here](https://youtu.be/VDXvbHZYeKY). - List of keybindings - [here](/docs/Keybindings_en.md). + [here](/docs/keybindings). ## Cool features diff --git a/docs/Keybindings_en.md b/docs/keybindings/Keybindings_en.md similarity index 100% rename from docs/Keybindings_en.md rename to docs/keybindings/Keybindings_en.md index 108b6ba73..9d9d1471e 100644 --- a/docs/Keybindings_en.md +++ b/docs/keybindings/Keybindings_en.md @@ -91,6 +91,19 @@ o: open file +## Main (Merging) + +
+  esc: return to files panel
+  space: pick hunk
+  b: pick both hunks
+  : select previous conflict
+  : select next conflict
+  : select top hunk
+  : select bottom hunk
+  z: undo
+
+ ## Main (Normal)
@@ -109,16 +122,3 @@
   space: stage line
   a: stage hunk
 
- -## Main (Merging) - -
-  esc: return to files panel
-  space: pick hunk
-  b: pick both hunks
-  : select previous conflict
-  : select next conflict
-  : select top hunk
-  : select bottom hunk
-  z: undo
-
diff --git a/docs/Keybindings_nl.md b/docs/keybindings/Keybindings_nl.md similarity index 100% rename from docs/Keybindings_nl.md rename to docs/keybindings/Keybindings_nl.md diff --git a/docs/Keybindings_pl.md b/docs/keybindings/Keybindings_pl.md similarity index 100% rename from docs/Keybindings_pl.md rename to docs/keybindings/Keybindings_pl.md diff --git a/pkg/gui/status_panel.go b/pkg/gui/status_panel.go index 0ac9bd662..de1823a44 100644 --- a/pkg/gui/status_panel.go +++ b/pkg/gui/status_panel.go @@ -61,7 +61,7 @@ func (gui *Gui) handleStatusSelect(g *gocui.Gui, v *gocui.View) error { []string{ lazygitTitle(), "Copyright (c) 2018 Jesse Duffield", - "Keybindings: https://github.com/jesseduffield/lazygit/blob/master/docs/Keybindings.md", + "Keybindings: https://github.com/jesseduffield/lazygit/blob/master/docs/keybindings", "Config Options: https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md", "Tutorial: https://youtu.be/VDXvbHZYeKY", "Raise an Issue: https://github.com/jesseduffield/lazygit/issues", diff --git a/scripts/generate_cheatsheet.go b/scripts/generate_cheatsheet.go index 529f37da8..7741c783f 100644 --- a/scripts/generate_cheatsheet.go +++ b/scripts/generate_cheatsheet.go @@ -31,7 +31,10 @@ func main() { for _, lang := range langs { os.Setenv("LC_ALL", lang) mApp, _ := app.NewApp(mConfig) - file, _ := os.Create("Keybindings_" + lang + ".md") + file, err := os.Create(getProjectRoot() + "/docs/keybindings/Keybindings_" + lang + ".md") + if err != nil { + panic(err) + } bindingSections := getBindingSections(mApp) content := formatSections(mApp, bindingSections) @@ -126,3 +129,11 @@ func formatSections(mApp *app.App, bindingSections []*bindingSection) string { return content } + +func getProjectRoot() string { + dir, err := os.Getwd() + if err != nil { + panic(err) + } + return strings.Split(dir, "lazygit")[0] + "lazygit" +}