-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfig-menus.nu
57 lines (55 loc) · 1.83 KB
/
config-menus.nu
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# Mostly experimental, to learn inline command line menu configuration and behavior
# The nav_subdir_menu and fuzzy_dir_menu menus are lacking in that they do not replace the marker
# fuzzy_dir_menu is based on nu_scripts/custom-menus/fuzzy/directory.nu
# docs: https://www.nushell.sh/book/line_editor.html#user-defined-menus
$env.config.menus = ($env.config.menus | append [
{
name: nav_subdir_menu
only_buffer_difference: true
marker: "cd "
type: {
layout: list
}
style: {
text: green
selected_text: green_reverse
description_text: yellow
}
source: { |buffer, position|
get-subdirs $env.PWD | each {|x| {value: $x} }
}
}
{
name: fuzzy_dir_menu
only_buffer_difference: true
marker: "# "
type: {
layout: list
}
style: {
text: green
selected_text: green_reverse
description_text: yellow
}
source: { |buffer, position|
ls **/* | where type == dir | get name
| each {|x| {value: $x} }
}
}
])
$env.config.keybindings = ($env.config.keybindings | append [
{
name: nav_subdir_menu
modifier: control
keycode: char_d
mode: [emacs, vi_insert, vi_normal]
event: { send: menu name: nav_subdir_menu }
}
{
name: fuzzy_dir_menu
modifier: control
keycode: char_d
mode: [emacs, vi_insert, vi_normal]
event: { send: menu name: fuzzy_dir_menu }
}
])