mirror of
https://github.com/RGBCube/nu_scripts
synced 2025-08-02 07:07:46 +00:00
change cwdhist_menu layout to list
(#657)
Co-authored-by: nash <nash@iffy.me>
This commit is contained in:
parent
e4ae994200
commit
df2556b993
1 changed files with 16 additions and 22 deletions
|
@ -4,8 +4,8 @@ def __cwdhist_menu [] {
|
||||||
only_buffer_difference: false
|
only_buffer_difference: false
|
||||||
marker: "| "
|
marker: "| "
|
||||||
type: {
|
type: {
|
||||||
layout: columnar
|
layout: list
|
||||||
page_size: 20
|
page_size: 10
|
||||||
}
|
}
|
||||||
style: {
|
style: {
|
||||||
text: green
|
text: green
|
||||||
|
@ -14,30 +14,24 @@ def __cwdhist_menu [] {
|
||||||
}
|
}
|
||||||
source: { |buffer, position|
|
source: { |buffer, position|
|
||||||
#$"[($position)]($buffer);(char newline)" | save -a ~/.cache/cwdhist.log
|
#$"[($position)]($buffer);(char newline)" | save -a ~/.cache/cwdhist.log
|
||||||
let cwd = if ($buffer | is-empty) {
|
|
||||||
""
|
|
||||||
} else {
|
|
||||||
$buffer
|
|
||||||
}
|
|
||||||
if 'cwd_history_full' in $env {
|
if 'cwd_history_full' in $env {
|
||||||
open $nu.history-path | query db $"
|
open $nu.history-path | query db $"
|
||||||
select cwd as value, count\(*) as description
|
select cwd as value, count\(*) as cnt
|
||||||
from history
|
from history
|
||||||
where cwd like '%($cwd)%'
|
where cwd like '%($buffer)%'
|
||||||
group by cwd
|
group by cwd
|
||||||
order by description desc
|
order by cnt desc
|
||||||
limit 20
|
limit 50
|
||||||
;"
|
;"
|
||||||
} else {
|
} else {
|
||||||
open $env.cwd_history_file | query db $"
|
open $env.cwd_history_file | query db $"
|
||||||
select cwd as value, count as description
|
select cwd as value, count
|
||||||
from cwd_history
|
from cwd_history
|
||||||
where cwd like '%($cwd)%'
|
where cwd like '%($buffer)%'
|
||||||
order by count desc
|
order by count desc
|
||||||
limit 20
|
limit 50
|
||||||
;"
|
;"
|
||||||
}
|
}
|
||||||
| append { value: '~' }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue