merge: combine zoxide and Atuin context navigation
# Conflicts: # README.md # internal/config/config.go # internal/config/config_test.go # root/config_cmd.go # root/config_cmd_test.go # root/init.go
This commit is contained in:
@@ -101,6 +101,10 @@ deduplicate-branches = true
|
||||
# include zoxide directories in cd suggestions
|
||||
extend-cd = false
|
||||
|
||||
[history]
|
||||
# atuin scope for typed queries: "global", "directory", "workspace", or "hybrid"
|
||||
scope = "global"
|
||||
|
||||
[updater]
|
||||
# check for updates on startup
|
||||
check-on-startup = true
|
||||
|
||||
@@ -40,6 +40,9 @@ func TestConfigCommands(t *testing.T) {
|
||||
if !strings.Contains(string(content), "extend-cd = false") {
|
||||
t.Error("expected initialized config to include extend-cd = false")
|
||||
}
|
||||
if !strings.Contains(string(content), "scope = \"global\"") {
|
||||
t.Error("expected initialized config to include global history scope")
|
||||
}
|
||||
|
||||
buf := new(bytes.Buffer)
|
||||
ConfigShowCmd.SetOut(buf)
|
||||
|
||||
@@ -247,6 +247,12 @@ expand-alias = true
|
||||
# automatically execute command after accepting suggestion
|
||||
auto-execute = false
|
||||
|
||||
# 0 = off, 1 = atuin history only, 2 = atuin history + default history
|
||||
atuin-history = 0
|
||||
|
||||
# custom atuin database path (leave empty for default)
|
||||
atuin-db-path = ""
|
||||
|
||||
[ui]
|
||||
# visual style: "modern" (icons, category pills, shortcut footer) or "classic" (minimalist, centered number, no icons)
|
||||
style = "modern"
|
||||
@@ -280,6 +286,10 @@ deduplicate-branches = true
|
||||
# include zoxide directories in cd suggestions
|
||||
extend-cd = false
|
||||
|
||||
[history]
|
||||
# atuin scope for typed queries: "global", "directory", "workspace", or "hybrid"
|
||||
scope = "global"
|
||||
|
||||
[updater]
|
||||
# check for updates on startup
|
||||
check-on-startup = true
|
||||
|
||||
+4
-4
@@ -49,18 +49,18 @@ func MergeResults(query string, mode string) []spec.Suggestion {
|
||||
|
||||
if mode == "history" {
|
||||
aliases := spec.GetAliasesCopy()
|
||||
histResults, _ := integration.SearchHistory(query, aliases)
|
||||
histResults, _ := integration.SearchHistoryIn(query, aliases, spec.GetCWD())
|
||||
|
||||
// scale confidence based on recency (index in histResults) so the most recent commands stay on top
|
||||
baseConf := 75
|
||||
for i, h := range histResults {
|
||||
conf := max(baseConf-(i*2), 60)
|
||||
|
||||
|
||||
icon := "history"
|
||||
if h.Source == "atuin" {
|
||||
icon = "atuin"
|
||||
}
|
||||
|
||||
|
||||
addSuggestion(spec.Suggestion{
|
||||
Cmd: h.Cmd,
|
||||
Desc: h.Source,
|
||||
@@ -97,7 +97,7 @@ func MergeResults(query string, mode string) []spec.Suggestion {
|
||||
if len(tokens) > 0 {
|
||||
rootCmd = tokens[0]
|
||||
}
|
||||
|
||||
|
||||
ctxTimeout, cancel := context.WithTimeout(context.Background(), 500*time.Millisecond)
|
||||
defer cancel()
|
||||
store, _ := scoring.GetFrecencyStore()
|
||||
|
||||
Reference in New Issue
Block a user