Skip to content

Commit 2554048

Browse files
committed
fix(config): move navigate-closed to core
1 parent 498a801 commit 2554048

6 files changed

Lines changed: 22 additions & 20 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,7 @@ auto-execute = false # run suggestion immediately instead of inserting
302302
atuin-history = 0 # 0 = shell history, 1 = atuin, 2 = both
303303
atuin-db-path = "" # path to atuin's history.db, empty = use default
304304
cobra-probe-enabled = true # fall back to probing cobra binaries for completions
305+
navigate-closed = "history" # menu closed: "history" browses iris history, "shell" hands the key to the shell (atuin)
305306
306307
[ui]
307308
style = "modern" # "modern" or "classic"
@@ -319,7 +320,6 @@ select = "tab" # accept the selected suggestion
319320
navigate-up = "up" # select up, or open history if empty
320321
navigate-down = "down" # select down, or open history if empty
321322
navigate-right = "right" # accept ghost text
322-
navigate-closed = "history" # with the menu closed: "history" browses iris history, "shell" passes the key to the shell (e.g. atuin)
323323
324324
[git]
325325
filter-active-branch = true # exclude current branch from suggestions

internal/config/config.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,15 @@ type CoreConfig struct {
6969
Atuin int `toml:"atuin-history"`
7070
AtuinDBPath string `toml:"atuin-db-path"`
7171
CobraProbeEnabled bool `toml:"cobra-probe-enabled"`
72+
// NavigateClosed decides what the navigate keys do while the suggestion
73+
// menu is closed: "history" browses iris' own merged history (the default),
74+
// "shell" forwards the key to the shell instead.
75+
//
76+
// Forwarding matters when the navigate keys are left on the arrows and
77+
// something else already owns them at the prompt -- atuin binds Up, for
78+
// instance. Without it the only way to keep that binding is to move iris
79+
// onto other keys, which costs arrow-key navigation of the menu entirely.
80+
NavigateClosed string `toml:"navigate-closed"`
7281
}
7382

7483
type UIConfig struct {
@@ -101,15 +110,6 @@ type KeybindingsConfig struct {
101110
NavigateUp string `toml:"navigate-up"`
102111
NavigateDown string `toml:"navigate-down"`
103112
NavigateRight string `toml:"navigate-right"`
104-
// NavigateClosed decides what the navigate keys do while the suggestion
105-
// menu is closed: "history" browses iris' own merged history (the default),
106-
// "shell" forwards the key to the shell instead.
107-
//
108-
// Forwarding matters when the navigate keys are left on the arrows and
109-
// something else already owns them at the prompt -- atuin binds Up, for
110-
// instance. Without it the only way to keep that binding is to move iris
111-
// onto other keys, which costs arrow-key navigation of the menu entirely.
112-
NavigateClosed string `toml:"navigate-closed"`
113113
}
114114

115115
type ZoxideConfig struct {
@@ -279,8 +279,8 @@ func Load() (*Config, error) {
279279
if cfg.Keybindings.SelectSuggestion == "" {
280280
cfg.Keybindings.SelectSuggestion = "tab"
281281
}
282-
if cfg.Keybindings.NavigateClosed == "" {
283-
cfg.Keybindings.NavigateClosed = "history"
282+
if cfg.Core.NavigateClosed == "" {
283+
cfg.Core.NavigateClosed = "history"
284284
}
285285
if cfg.Keybindings.NavigateUp == "" {
286286
cfg.Keybindings.NavigateUp = "up"

internal/config/defaults.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ func DefaultConfig() *Config {
1515
ExpandAlias: true,
1616
AutoExecute: false,
1717
CobraProbeEnabled: true,
18+
NavigateClosed: "history",
1819
},
1920
UI: UIConfig{
2021
Style: "modern",
@@ -56,7 +57,6 @@ func DefaultConfig() *Config {
5657
SelectSuggestion: "tab",
5758
NavigateUp: "up",
5859
NavigateDown: "down",
59-
NavigateClosed: "history",
6060
},
6161
}
6262
}

root/config_cmd.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ atuin-db-path = ""
6868
# probe unknown binaries with ` + "`__complete`" + ` for Cobra-based CLI suggestions.
6969
cobra-probe-enabled = true
7070
71+
# what navigate-up/navigate-down do while the menu is closed:
72+
# "history" = browse iris history, "shell" = leave the key to the shell (e.g. atuin)
73+
navigate-closed = "history"
74+
7175
[ui]
7276
# visual style: "modern" (icons, category pills, shortcut footer) or "classic" (minimalist, centered number, no icons)
7377
style = "modern"
@@ -124,9 +128,6 @@ navigate-up = "up"
124128
navigate-down = "down"
125129
navigate-right = "right"
126130
127-
# what navigate-up/navigate-down do while the menu is closed:
128-
# "history" = browse iris history, "shell" = leave the key to the shell
129-
navigate-closed = "history"
130131
`
131132
err = os.WriteFile(path, []byte(defaultContent), 0644)
132133
if err != nil {

root/init.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,10 @@ expand-alias = true
253253
# automatically execute command after accepting suggestion
254254
auto-execute = false
255255
256+
# what navigate-up/navigate-down do while the menu is closed:
257+
# "history" = browse iris history, "shell" = leave the key to the shell (e.g. atuin)
258+
navigate-closed = "history"
259+
256260
[ui]
257261
# visual style: "modern" (icons, category pills, shortcut footer) or "classic" (minimalist, centered number, no icons)
258262
style = "modern"
@@ -309,9 +313,6 @@ navigate-up = "up"
309313
navigate-down = "down"
310314
navigate-right = "right"
311315
312-
# what navigate-up/navigate-down do while the menu is closed:
313-
# "history" = browse iris history, "shell" = leave the key to the shell
314-
navigate-closed = "history"
315316
`
316317
if errWrite := os.WriteFile(path, []byte(defaultContent), 0644); errWrite == nil {
317318
fmt.Printf("✓ Initialized default config file at %s\n", path)

root/wrapper.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -921,7 +921,7 @@ func runWrapper() {
921921
// navigate-closed = "shell" leaves the key to the shell while the
922922
// menu is closed -- atuin binds Up, and claiming it here is what
923923
// forces the navigate keys off the arrows entirely.
924-
navToShell := !overlay.IsVisible() && config.Get().Keybindings.NavigateClosed == "shell"
924+
navToShell := !overlay.IsVisible() && config.Get().Core.NavigateClosed == "shell"
925925
if (isNavUp || isNavDown) && !navToShell {
926926
arrowDir := "down"
927927
if isNavUp {

0 commit comments

Comments
 (0)