Skip to content

Commit e4362ee

Browse files
authored
Focus the main view (#4429)
- **PR Description** This adds a new `0` keybinding to the side panels that focuses whatever main view is currently displayed, with the goal of making it easier to scroll the main view (using the normal navigation keys `,` `.` `<` `>`), and being able to search the main view using `/`. Alternatively to pressing `0` you can also click the main view to focus it. Note that previously it was possible to go directly to the staging panel by clicking in the main view when a file was selected; this now takes a double click, because the first click just focuses the main view, but you can go to staging from there by clicking again. I'm reasonably happy with the overall behavior, but it takes some getting used to, so we'll want to test this for a while to see if it doesn't make the focus handling too confusing. Fixes #3988.
2 parents 548d486 + 4e21a09 commit e4362ee

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+760
-173
lines changed

docs/Config.md

+1
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,7 @@ keybinding:
501501
- "3"
502502
- "4"
503503
- "5"
504+
focusMainView: "0"
504505
nextMatch: "n"
505506
prevMatch: "N"
506507
startSearch: /

docs/keybindings/Keybindings_en.md

+20
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_
6868
| `` ` `` | Toggle file tree view | Toggle file view between flat and tree layout. Flat layout shows all file paths in a single list, tree layout groups files by directory. |
6969
| `` - `` | Collapse all files | Collapse all directories in the files tree |
7070
| `` = `` | Expand all files | Expand all directories in the file tree |
71+
| `` 0 `` | Focus main view | |
7172
| `` / `` | Search the current view by text | |
7273

7374
## Commit summary
@@ -112,6 +113,7 @@ If you would instead like to start an interactive rebase from the selected commi
112113
| `` C `` | Copy (cherry-pick) | Mark commit as copied. Then, within the local commits view, you can press `V` to paste (cherry-pick) the copied commit(s) into your checked out branch. At any time you can press `<esc>` to cancel the selection. |
113114
| `` <c-t> `` | Open external diff tool (git difftool) | |
114115
| `` * `` | Select commits of current branch | |
116+
| `` 0 `` | Focus main view | |
115117
| `` <enter> `` | View files | |
116118
| `` w `` | View worktree options | |
117119
| `` / `` | Search the current view by text | |
@@ -153,6 +155,7 @@ If you would instead like to start an interactive rebase from the selected commi
153155
| `` f `` | Fetch | Fetch changes from remote. |
154156
| `` - `` | Collapse all files | Collapse all directories in the files tree |
155157
| `` = `` | Expand all files | Expand all directories in the file tree |
158+
| `` 0 `` | Focus main view | |
156159
| `` / `` | Search the current view by text | |
157160

158161
## Local branches
@@ -178,6 +181,7 @@ If you would instead like to start an interactive rebase from the selected commi
178181
| `` R `` | Rename branch | |
179182
| `` u `` | View upstream options | View options relating to the branch's upstream e.g. setting/unsetting the upstream and resetting to the upstream. |
180183
| `` <c-t> `` | Open external diff tool (git difftool) | |
184+
| `` 0 `` | Focus main view | |
181185
| `` <enter> `` | View commits | |
182186
| `` w `` | View worktree options | |
183187
| `` / `` | Filter the current view by text | |
@@ -204,6 +208,9 @@ If you would instead like to start an interactive rebase from the selected commi
204208
|-----|--------|-------------|
205209
| `` mouse wheel down (fn+up) `` | Scroll down | |
206210
| `` mouse wheel up (fn+down) `` | Scroll up | |
211+
| `` <tab> `` | Switch view | Switch to other view (staged/unstaged changes). |
212+
| `` <esc> `` | Exit back to side panel | |
213+
| `` / `` | Search the current view by text | |
207214

208215
## Main panel (patch building)
209216

@@ -264,6 +271,7 @@ If you would instead like to start an interactive rebase from the selected commi
264271
| `` <c-r> `` | Reset copied (cherry-picked) commits selection | |
265272
| `` <c-t> `` | Open external diff tool (git difftool) | |
266273
| `` * `` | Select commits of current branch | |
274+
| `` 0 `` | Focus main view | |
267275
| `` <enter> `` | View commits | |
268276
| `` w `` | View worktree options | |
269277
| `` / `` | Filter the current view by text | |
@@ -282,6 +290,7 @@ If you would instead like to start an interactive rebase from the selected commi
282290
| `` s `` | Sort order | |
283291
| `` g `` | Reset | View reset options (soft/mixed/hard) for resetting onto selected item. |
284292
| `` <c-t> `` | Open external diff tool (git difftool) | |
293+
| `` 0 `` | Focus main view | |
285294
| `` <enter> `` | View commits | |
286295
| `` w `` | View worktree options | |
287296
| `` / `` | Filter the current view by text | |
@@ -297,6 +306,14 @@ If you would instead like to start an interactive rebase from the selected commi
297306
| `` f `` | Fetch | Fetch updates from the remote repository. This retrieves new commits and branches without merging them into your local branches. |
298307
| `` / `` | Filter the current view by text | |
299308

309+
## Secondary
310+
311+
| Key | Action | Info |
312+
|-----|--------|-------------|
313+
| `` <tab> `` | Switch view | Switch to other view (staged/unstaged changes). |
314+
| `` <esc> `` | Exit back to side panel | |
315+
| `` / `` | Search the current view by text | |
316+
300317
## Stash
301318

302319
| Key | Action | Info |
@@ -306,6 +323,7 @@ If you would instead like to start an interactive rebase from the selected commi
306323
| `` d `` | Drop | Remove the stash entry from the stash list. |
307324
| `` n `` | New branch | Create a new branch from the selected stash entry. This works by git checking out the commit that the stash entry was created from, creating a new branch from that commit, then applying the stash entry to the new branch as an additional commit. |
308325
| `` r `` | Rename stash | |
326+
| `` 0 `` | Focus main view | |
309327
| `` <enter> `` | View files | |
310328
| `` w `` | View worktree options | |
311329
| `` / `` | Filter the current view by text | |
@@ -334,6 +352,7 @@ If you would instead like to start an interactive rebase from the selected commi
334352
| `` <c-r> `` | Reset copied (cherry-picked) commits selection | |
335353
| `` <c-t> `` | Open external diff tool (git difftool) | |
336354
| `` * `` | Select commits of current branch | |
355+
| `` 0 `` | Focus main view | |
337356
| `` <enter> `` | View files | |
338357
| `` w `` | View worktree options | |
339358
| `` / `` | Search the current view by text | |
@@ -363,6 +382,7 @@ If you would instead like to start an interactive rebase from the selected commi
363382
| `` P `` | Push tag | Push the selected tag to a remote. You'll be prompted to select a remote. |
364383
| `` g `` | Reset | View reset options (soft/mixed/hard) for resetting onto selected item. |
365384
| `` <c-t> `` | Open external diff tool (git difftool) | |
385+
| `` 0 `` | Focus main view | |
366386
| `` <enter> `` | View commits | |
367387
| `` w `` | View worktree options | |
368388
| `` / `` | Filter the current view by text | |

docs/keybindings/Keybindings_ja.md

+20
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,14 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_
5151
| `` ] `` | 次のタブ | |
5252
| `` [ `` | 前のタブ | |
5353

54+
## Secondary
55+
56+
| Key | Action | Info |
57+
|-----|--------|-------------|
58+
| `` <tab> `` | パネルを切り替え | Switch to other view (staged/unstaged changes). |
59+
| `` <esc> `` | Exit back to side panel | |
60+
| `` / `` | 検索を開始 | |
61+
5462
## Stash
5563

5664
| Key | Action | Info |
@@ -60,6 +68,7 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_
6068
| `` d `` | Drop | Remove the stash entry from the stash list. |
6169
| `` n `` | 新しいブランチを作成 | Create a new branch from the selected stash entry. This works by git checking out the commit that the stash entry was created from, creating a new branch from that commit, then applying the stash entry to the new branch as an additional commit. |
6270
| `` r `` | Stashを変更 | |
71+
| `` 0 `` | Focus main view | |
6372
| `` <enter> `` | View files | |
6473
| `` w `` | View worktree options | |
6574
| `` / `` | Filter the current view by text | |
@@ -78,6 +87,7 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_
7887
| `` <c-r> `` | Reset copied (cherry-picked) commits selection | |
7988
| `` <c-t> `` | Open external diff tool (git difftool) | |
8089
| `` * `` | Select commits of current branch | |
90+
| `` 0 `` | Focus main view | |
8191
| `` <enter> `` | View files | |
8292
| `` w `` | View worktree options | |
8393
| `` / `` | 検索を開始 | |
@@ -127,6 +137,7 @@ If you would instead like to start an interactive rebase from the selected commi
127137
| `` C `` | コミットをコピー (cherry-pick) | Mark commit as copied. Then, within the local commits view, you can press `V` to paste (cherry-pick) the copied commit(s) into your checked out branch. At any time you can press `<esc>` to cancel the selection. |
128138
| `` <c-t> `` | Open external diff tool (git difftool) | |
129139
| `` * `` | Select commits of current branch | |
140+
| `` 0 `` | Focus main view | |
130141
| `` <enter> `` | View files | |
131142
| `` w `` | View worktree options | |
132143
| `` / `` | 検索を開始 | |
@@ -148,6 +159,7 @@ If you would instead like to start an interactive rebase from the selected commi
148159
| `` ` `` | ファイルツリーの表示を切り替え | Toggle file view between flat and tree layout. Flat layout shows all file paths in a single list, tree layout groups files by directory. |
149160
| `` - `` | Collapse all files | Collapse all directories in the files tree |
150161
| `` = `` | Expand all files | Expand all directories in the file tree |
162+
| `` 0 `` | Focus main view | |
151163
| `` / `` | 検索を開始 | |
152164

153165
## コミットメッセージ
@@ -192,6 +204,7 @@ If you would instead like to start an interactive rebase from the selected commi
192204
| `` P `` | タグをpush | Push the selected tag to a remote. You'll be prompted to select a remote. |
193205
| `` g `` | Reset | View reset options (soft/mixed/hard) for resetting onto selected item. |
194206
| `` <c-t> `` | Open external diff tool (git difftool) | |
207+
| `` 0 `` | Focus main view | |
195208
| `` <enter> `` | コミットを閲覧 | |
196209
| `` w `` | View worktree options | |
197210
| `` / `` | Filter the current view by text | |
@@ -226,6 +239,7 @@ If you would instead like to start an interactive rebase from the selected commi
226239
| `` f `` | Fetch | Fetch changes from remote. |
227240
| `` - `` | Collapse all files | Collapse all directories in the files tree |
228241
| `` = `` | Expand all files | Expand all directories in the file tree |
242+
| `` 0 `` | Focus main view | |
229243
| `` / `` | 検索を開始 | |
230244

231245
## ブランチ
@@ -251,6 +265,7 @@ If you would instead like to start an interactive rebase from the selected commi
251265
| `` R `` | ブランチ名を変更 | |
252266
| `` u `` | View upstream options | View options relating to the branch's upstream e.g. setting/unsetting the upstream and resetting to the upstream. |
253267
| `` <c-t> `` | Open external diff tool (git difftool) | |
268+
| `` 0 `` | Focus main view | |
254269
| `` <enter> `` | コミットを閲覧 | |
255270
| `` w `` | View worktree options | |
256271
| `` / `` | Filter the current view by text | |
@@ -277,6 +292,9 @@ If you would instead like to start an interactive rebase from the selected commi
277292
|-----|--------|-------------|
278293
| `` mouse wheel down (fn+up) `` | 下にスクロール | |
279294
| `` mouse wheel up (fn+down) `` | 上にスクロール | |
295+
| `` <tab> `` | パネルを切り替え | Switch to other view (staged/unstaged changes). |
296+
| `` <esc> `` | Exit back to side panel | |
297+
| `` / `` | 検索を開始 | |
280298

281299
## メインパネル (Patch Building)
282300

@@ -348,6 +366,7 @@ If you would instead like to start an interactive rebase from the selected commi
348366
| `` s `` | 並び替え | |
349367
| `` g `` | Reset | View reset options (soft/mixed/hard) for resetting onto selected item. |
350368
| `` <c-t> `` | Open external diff tool (git difftool) | |
369+
| `` 0 `` | Focus main view | |
351370
| `` <enter> `` | コミットを閲覧 | |
352371
| `` w `` | View worktree options | |
353372
| `` / `` | Filter the current view by text | |
@@ -366,6 +385,7 @@ If you would instead like to start an interactive rebase from the selected commi
366385
| `` <c-r> `` | Reset copied (cherry-picked) commits selection | |
367386
| `` <c-t> `` | Open external diff tool (git difftool) | |
368387
| `` * `` | Select commits of current branch | |
388+
| `` 0 `` | Focus main view | |
369389
| `` <enter> `` | コミットを閲覧 | |
370390
| `` w `` | View worktree options | |
371391
| `` / `` | Filter the current view by text | |

docs/keybindings/Keybindings_ko.md

+20
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,19 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_
6565
| `` <c-r> `` | Reset cherry-picked (copied) commits selection | |
6666
| `` <c-t> `` | Open external diff tool (git difftool) | |
6767
| `` * `` | Select commits of current branch | |
68+
| `` 0 `` | Focus main view | |
6869
| `` <enter> `` | 커밋 보기 | |
6970
| `` w `` | View worktree options | |
7071
| `` / `` | Filter the current view by text | |
7172

73+
## Secondary
74+
75+
| Key | Action | Info |
76+
|-----|--------|-------------|
77+
| `` <tab> `` | 패널 전환 | Switch to other view (staged/unstaged changes). |
78+
| `` <esc> `` | Exit back to side panel | |
79+
| `` / `` | 검색 시작 | |
80+
7281
## Stash
7382

7483
| Key | Action | Info |
@@ -78,6 +87,7 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_
7887
| `` d `` | Drop | Remove the stash entry from the stash list. |
7988
| `` n `` | 새 브랜치 생성 | Create a new branch from the selected stash entry. This works by git checking out the commit that the stash entry was created from, creating a new branch from that commit, then applying the stash entry to the new branch as an additional commit. |
8089
| `` r `` | Rename stash | |
90+
| `` 0 `` | Focus main view | |
8191
| `` <enter> `` | View selected item's files | |
8292
| `` w `` | View worktree options | |
8393
| `` / `` | Filter the current view by text | |
@@ -96,6 +106,7 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_
96106
| `` <c-r> `` | Reset cherry-picked (copied) commits selection | |
97107
| `` <c-t> `` | Open external diff tool (git difftool) | |
98108
| `` * `` | Select commits of current branch | |
109+
| `` 0 `` | Focus main view | |
99110
| `` <enter> `` | View selected item's files | |
100111
| `` w `` | View worktree options | |
101112
| `` / `` | 검색 시작 | |
@@ -140,6 +151,9 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_
140151
|-----|--------|-------------|
141152
| `` mouse wheel down (fn+up) `` | 아래로 스크롤 | |
142153
| `` mouse wheel up (fn+down) `` | 위로 스크롤 | |
154+
| `` <tab> `` | 패널 전환 | Switch to other view (staged/unstaged changes). |
155+
| `` <esc> `` | Exit back to side panel | |
156+
| `` / `` | 검색 시작 | |
143157

144158
## 메인 패널 (Patch Building)
145159

@@ -201,6 +215,7 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_
201215
| `` R `` | 브랜치 이름 변경 | |
202216
| `` u `` | View upstream options | View options relating to the branch's upstream e.g. setting/unsetting the upstream and resetting to the upstream. |
203217
| `` <c-t> `` | Open external diff tool (git difftool) | |
218+
| `` 0 `` | Focus main view | |
204219
| `` <enter> `` | 커밋 보기 | |
205220
| `` w `` | View worktree options | |
206221
| `` / `` | Filter the current view by text | |
@@ -254,6 +269,7 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_
254269
| `` s `` | Sort order | |
255270
| `` g `` | View reset options | View reset options (soft/mixed/hard) for resetting onto selected item. |
256271
| `` <c-t> `` | Open external diff tool (git difftool) | |
272+
| `` 0 `` | Focus main view | |
257273
| `` <enter> `` | 커밋 보기 | |
258274
| `` w `` | View worktree options | |
259275
| `` / `` | Filter the current view by text | |
@@ -293,6 +309,7 @@ If you would instead like to start an interactive rebase from the selected commi
293309
| `` C `` | 커밋을 복사 (cherry-pick) | Mark commit as copied. Then, within the local commits view, you can press `V` to paste (cherry-pick) the copied commit(s) into your checked out branch. At any time you can press `<esc>` to cancel the selection. |
294310
| `` <c-t> `` | Open external diff tool (git difftool) | |
295311
| `` * `` | Select commits of current branch | |
312+
| `` 0 `` | Focus main view | |
296313
| `` <enter> `` | View selected item's files | |
297314
| `` w `` | View worktree options | |
298315
| `` / `` | 검색 시작 | |
@@ -314,6 +331,7 @@ If you would instead like to start an interactive rebase from the selected commi
314331
| `` ` `` | 파일 트리뷰로 전환 | Toggle file view between flat and tree layout. Flat layout shows all file paths in a single list, tree layout groups files by directory. |
315332
| `` - `` | Collapse all files | Collapse all directories in the files tree |
316333
| `` = `` | Expand all files | Expand all directories in the file tree |
334+
| `` 0 `` | Focus main view | |
317335
| `` / `` | 검색 시작 | |
318336

319337
## 커밋메시지
@@ -334,6 +352,7 @@ If you would instead like to start an interactive rebase from the selected commi
334352
| `` P `` | 태그를 push | Push the selected tag to a remote. You'll be prompted to select a remote. |
335353
| `` g `` | 초기화 | View reset options (soft/mixed/hard) for resetting onto selected item. |
336354
| `` <c-t> `` | Open external diff tool (git difftool) | |
355+
| `` 0 `` | Focus main view | |
337356
| `` <enter> `` | 커밋 보기 | |
338357
| `` w `` | View worktree options | |
339358
| `` / `` | Filter the current view by text | |
@@ -368,6 +387,7 @@ If you would instead like to start an interactive rebase from the selected commi
368387
| `` f `` | Fetch | Fetch changes from remote. |
369388
| `` - `` | Collapse all files | Collapse all directories in the files tree |
370389
| `` = `` | Expand all files | Expand all directories in the file tree |
390+
| `` 0 `` | Focus main view | |
371391
| `` / `` | 검색 시작 | |
372392

373393
## 확인 패널

0 commit comments

Comments
 (0)