mirror of
https://github.com/nushell/nu_scripts.git
synced 2024-09-11 13:45:56 +03:00
change cwdhist_menu layout to list
(#657)
Co-authored-by: nash <nash@iffy.me>
This commit is contained in:
parent
e4ae994200
commit
df2556b993
@ -4,8 +4,8 @@ def __cwdhist_menu [] {
|
||||
only_buffer_difference: false
|
||||
marker: "| "
|
||||
type: {
|
||||
layout: columnar
|
||||
page_size: 20
|
||||
layout: list
|
||||
page_size: 10
|
||||
}
|
||||
style: {
|
||||
text: green
|
||||
@ -14,30 +14,24 @@ def __cwdhist_menu [] {
|
||||
}
|
||||
source: { |buffer, position|
|
||||
#$"[($position)]($buffer);(char newline)" | save -a ~/.cache/cwdhist.log
|
||||
let cwd = if ($buffer | is-empty) {
|
||||
""
|
||||
} else {
|
||||
$buffer
|
||||
}
|
||||
if 'cwd_history_full' in $env {
|
||||
open $nu.history-path | query db $"
|
||||
select cwd as value, count\(*) as description
|
||||
select cwd as value, count\(*) as cnt
|
||||
from history
|
||||
where cwd like '%($cwd)%'
|
||||
where cwd like '%($buffer)%'
|
||||
group by cwd
|
||||
order by description desc
|
||||
limit 20
|
||||
order by cnt desc
|
||||
limit 50
|
||||
;"
|
||||
} else {
|
||||
open $env.cwd_history_file | query db $"
|
||||
select cwd as value, count as description
|
||||
select cwd as value, count
|
||||
from cwd_history
|
||||
where cwd like '%($cwd)%'
|
||||
where cwd like '%($buffer)%'
|
||||
order by count desc
|
||||
limit 20
|
||||
limit 50
|
||||
;"
|
||||
}
|
||||
| append { value: '~' }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user