Skip to content

Commit 24bb553

Browse files
committed
Add navigation with numbers
PR - jesseduffield#540 - Fix jesseduffield#522 - Like lazygit we can navigate with numbers. - jesseduffield/lazydocker@master...peauc:lazydocker:feature/issue-522-add-number-like-lazygit
1 parent c150b1d commit 24bb553

12 files changed

+84
-0
lines changed

docs/keybindings/Keybindings_de.md

+6
Original file line numberDiff line numberDiff line change
@@ -104,4 +104,10 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
104104
<pre>
105105
<kbd>+</kbd>: next screen mode (normal/half/fullscreen)
106106
<kbd>_</kbd>: prev screen mode
107+
<kbd>1</kbd>: focus projects panel
108+
<kbd>2</kbd>: focus services panel
109+
<kbd>3</kbd>: focus containers panel
110+
<kbd>4</kbd>: focus images panel
111+
<kbd>5</kbd>: focus volumes panel
112+
<kbd>6</kbd>: focus networks panel
107113
</pre>

docs/keybindings/Keybindings_en.md

+6
Original file line numberDiff line numberDiff line change
@@ -104,4 +104,10 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
104104
<pre>
105105
<kbd>+</kbd>: next screen mode (normal/half/fullscreen)
106106
<kbd>_</kbd>: prev screen mode
107+
<kbd>1</kbd>: focus projects panel
108+
<kbd>2</kbd>: focus services panel
109+
<kbd>3</kbd>: focus containers panel
110+
<kbd>4</kbd>: focus images panel
111+
<kbd>5</kbd>: focus volumes panel
112+
<kbd>6</kbd>: focus networks panel
107113
</pre>

docs/keybindings/Keybindings_es.md

+6
Original file line numberDiff line numberDiff line change
@@ -104,4 +104,10 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
104104
<pre>
105105
<kbd>+</kbd>: next screen mode (normal/half/fullscreen)
106106
<kbd>_</kbd>: prev screen mode
107+
<kbd>1</kbd>: focus projects panel
108+
<kbd>2</kbd>: focus services panel
109+
<kbd>3</kbd>: focus containers panel
110+
<kbd>4</kbd>: focus images panel
111+
<kbd>5</kbd>: focus volumes panel
112+
<kbd>6</kbd>: focus networks panel
107113
</pre>

docs/keybindings/Keybindings_fr.md

+6
Original file line numberDiff line numberDiff line change
@@ -104,4 +104,10 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
104104
<pre>
105105
<kbd>+</kbd>: next screen mode (normal/half/fullscreen)
106106
<kbd>_</kbd>: prev screen mode
107+
<kbd>1</kbd>: focus projects panel
108+
<kbd>2</kbd>: focus services panel
109+
<kbd>3</kbd>: focus containers panel
110+
<kbd>4</kbd>: focus images panel
111+
<kbd>5</kbd>: focus volumes panel
112+
<kbd>6</kbd>: focus networks panel
107113
</pre>

docs/keybindings/Keybindings_nl.md

+6
Original file line numberDiff line numberDiff line change
@@ -104,4 +104,10 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
104104
<pre>
105105
<kbd>+</kbd>: next screen mode (normal/half/fullscreen)
106106
<kbd>_</kbd>: prev screen mode
107+
<kbd>1</kbd>: focus projects panel
108+
<kbd>2</kbd>: focus services panel
109+
<kbd>3</kbd>: focus containers panel
110+
<kbd>4</kbd>: focus images panel
111+
<kbd>5</kbd>: focus volumes panel
112+
<kbd>6</kbd>: focus networks panel
107113
</pre>

docs/keybindings/Keybindings_pl.md

+6
Original file line numberDiff line numberDiff line change
@@ -104,4 +104,10 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
104104
<pre>
105105
<kbd>+</kbd>: next screen mode (normal/half/fullscreen)
106106
<kbd>_</kbd>: prev screen mode
107+
<kbd>1</kbd>: focus projects panel
108+
<kbd>2</kbd>: focus services panel
109+
<kbd>3</kbd>: focus containers panel
110+
<kbd>4</kbd>: focus images panel
111+
<kbd>5</kbd>: focus volumes panel
112+
<kbd>6</kbd>: focus networks panel
107113
</pre>

docs/keybindings/Keybindings_pt.md

+6
Original file line numberDiff line numberDiff line change
@@ -104,4 +104,10 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
104104
<pre>
105105
<kbd>+</kbd>: modo de tela seguinte (normal/meia/tela cheia)
106106
<kbd>_</kbd>: modo de tela anterior
107+
<kbd>1</kbd>: focus projects panel
108+
<kbd>2</kbd>: focus services panel
109+
<kbd>3</kbd>: focus containers panel
110+
<kbd>4</kbd>: focus images panel
111+
<kbd>5</kbd>: focus volumes panel
112+
<kbd>6</kbd>: focus networks panel
107113
</pre>

docs/keybindings/Keybindings_tr.md

+6
Original file line numberDiff line numberDiff line change
@@ -104,4 +104,10 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
104104
<pre>
105105
<kbd>+</kbd>: next screen mode (normal/half/fullscreen)
106106
<kbd>_</kbd>: prev screen mode
107+
<kbd>1</kbd>: focus projects panel
108+
<kbd>2</kbd>: focus services panel
109+
<kbd>3</kbd>: focus containers panel
110+
<kbd>4</kbd>: focus images panel
111+
<kbd>5</kbd>: focus volumes panel
112+
<kbd>6</kbd>: focus networks panel
107113
</pre>

docs/keybindings/Keybindings_zh.md

+6
Original file line numberDiff line numberDiff line change
@@ -104,4 +104,10 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
104104
<pre>
105105
<kbd>+</kbd>: 下一个屏幕模式(正常/半屏/全屏)
106106
<kbd>_</kbd>: 上一个屏幕模式
107+
<kbd>1</kbd>: focus projects panel
108+
<kbd>2</kbd>: focus services panel
109+
<kbd>3</kbd>: focus containers panel
110+
<kbd>4</kbd>: focus images panel
111+
<kbd>5</kbd>: focus volumes panel
112+
<kbd>6</kbd>: focus networks panel
107113
</pre>

pkg/gui/keybindings.go

+9
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,15 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
541541
}...)
542542
}
543543

544+
bindings = append(bindings, []*Binding{
545+
{Handler: gui.handleGoTo(gui.Panels.Projects.View), Key: '1', Description: gui.Tr.FocusProjects},
546+
{Handler: gui.handleGoTo(gui.Panels.Services.View), Key: '2', Description: gui.Tr.FocusServices},
547+
{Handler: gui.handleGoTo(gui.Panels.Containers.View), Key: '3', Description: gui.Tr.FocusContainers},
548+
{Handler: gui.handleGoTo(gui.Panels.Images.View), Key: '4', Description: gui.Tr.FocusImages},
549+
{Handler: gui.handleGoTo(gui.Panels.Volumes.View), Key: '5', Description: gui.Tr.FocusVolumes},
550+
{Handler: gui.handleGoTo(gui.Panels.Networks.View), Key: '6', Description: gui.Tr.FocusNetwork},
551+
}...)
552+
544553
for _, panel := range gui.allListPanels() {
545554
setUpDownClickBindings(panel.GetView().Name(), panel.HandlePrevLine, panel.HandleNextLine, panel.HandleClick)
546555
}

pkg/gui/view_helpers.go

+7
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@ import (
1212
"github.com/spkg/bom"
1313
)
1414

15+
func (gui *Gui) handleGoTo(view *gocui.View) func(g *gocui.Gui, v *gocui.View) error {
16+
return func(g *gocui.Gui, v *gocui.View) error {
17+
gui.resetMainView()
18+
return gui.switchFocus(view)
19+
}
20+
}
21+
1522
func (gui *Gui) nextView(g *gocui.Gui, v *gocui.View) error {
1623
sideViewNames := gui.sideViewNames()
1724
var focusedViewName string

pkg/i18n/english.go

+14
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,13 @@ type TranslationSet struct {
129129
LcPrevScreenMode string
130130
ClearMain string
131131
FilterPrompt string
132+
133+
FocusProjects string
134+
FocusServices string
135+
FocusContainers string
136+
FocusImages string
137+
FocusVolumes string
138+
FocusNetwork string
132139
}
133140

134141
func englishSet() TranslationSet {
@@ -265,5 +272,12 @@ func englishSet() TranslationSet {
265272
LcPrevScreenMode: "prev screen mode",
266273
ClearMain: "clear main panel",
267274
FilterPrompt: "filter",
275+
276+
FocusProjects: "focus projects panel",
277+
FocusServices: "focus services panel",
278+
FocusContainers: "focus containers panel",
279+
FocusImages: "focus images panel",
280+
FocusVolumes: "focus volumes panel",
281+
FocusNetwork: "focus networks panel",
268282
}
269283
}

0 commit comments

Comments
 (0)