mirror of
https://github.com/RGBCube/nu_scripts
synced 2025-07-30 13:47:46 +00:00
add a current session history menu (#378)
* add a current session history menu * Update current_session_history_menu.nu * Delete non_default_vars_menu.nu
This commit is contained in:
parent
fad32924fa
commit
ac2f4b94ac
2 changed files with 45 additions and 0 deletions
9
custom-menus/README.md
Normal file
9
custom-menus/README.md
Normal file
|
@ -0,0 +1,9 @@
|
|||
# Custom menus folder
|
||||
|
||||
In this folder you can find custom menus for nushell.
|
||||
|
||||
To make them work:
|
||||
1. insert the code of chosen menu into the `menus` section of the `config.nu` file.
|
||||
2. Check, that the name of the menu is uniqe
|
||||
3. Add a shortcut to call for the needed menu in the `keybindings` section of the `config.nu` file
|
||||
|
36
custom-menus/current_session_history_menu.nu
Normal file
36
custom-menus/current_session_history_menu.nu
Normal file
|
@ -0,0 +1,36 @@
|
|||
# The part below should be pasted inside the 'menus' list of the 'config.nu' file
|
||||
|
||||
{
|
||||
# session menu
|
||||
name: current_session_history_menu
|
||||
only_buffer_difference: false
|
||||
marker: "# "
|
||||
type: {
|
||||
layout: list
|
||||
page_size: 10
|
||||
}
|
||||
style: {
|
||||
text: green
|
||||
selected_text: green_reverse
|
||||
description_text: yellow
|
||||
}
|
||||
source: { |buffer, position|
|
||||
|
||||
history -l
|
||||
| where session_id == (history session)
|
||||
| select command
|
||||
| where command =~ $buffer
|
||||
| each { |it| {value: $it.command } }
|
||||
| reverse
|
||||
| uniq
|
||||
}
|
||||
|
||||
# The part below should be pasted into the 'keybindgs' list of the 'config.nu' file
|
||||
|
||||
{
|
||||
name: "current_session_history_menu"
|
||||
modifier: alt
|
||||
keycode: char_r
|
||||
mode: emacs
|
||||
event: { send: menu name: current_session_history_menu }
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue