Changed . token to _dot

This change allows the dotfiles to work with chezmoi (e.g: on windows)
and improves grepability with neovim/telescope
This commit is contained in:
2024-11-07 13:52:17 +00:00
parent 83b02bd753
commit 896af887ca
2351 changed files with 0 additions and 0 deletions
@@ -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 unique
3. Add a shortcut to call for the needed menu in the `keybindings` section of the `config.nu` 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 }
}
@@ -0,0 +1,30 @@
# can be used in the REPL by adding something like the following block to `$env.config.keybindings` in your `config.nu`
# {
# name: commands_menu
# modifier: control
# keycode: char_t
# mode: [emacs, vi_normal, vi_insert]
# event: { send: menu name: commands_menu }
# }
{
name: commands_menu
only_buffer_difference: false
marker: "# "
type: {
layout: columnar
columns: 4
col_width: 20
col_padding: 2
}
style: {
text: green
selected_text: green_reverse
description_text: yellow
}
source: { |buffer, position|
scope commands
| where name =~ $buffer
| each { |it| {value: $it.name description: $it.usage} }
}
}
@@ -0,0 +1,32 @@
# can be used in the REPL by adding something like the following block to `$env.config.keybindings` in your `config.nu`
# {
# name: commands_with_description_menu
# modifier: control
# keycode: char_s
# mode: [emacs, vi_normal, vi_insert]
# event: { send: menu name: commands_with_description }
# }
{
name: commands_with_description_menu
only_buffer_difference: true
marker: "# "
type: {
layout: description
columns: 4
col_width: 20
col_padding: 2
selection_rows: 4
description_rows: 10
}
style: {
text: green
selected_text: green_reverse
description_text: yellow
}
source: { |buffer, position|
scope commands
| where name =~ $buffer
| each { |it| {value: $it.name description: $it.usage} }
}
}
@@ -0,0 +1,29 @@
# can be used in the REPL by adding something like the following block to `$env.config.keybindings` in your `config.nu`
# {
# name: vars_menu
# modifier: alt
# keycode: char_o
# mode: [emacs, vi_normal, vi_insert]
# event: { send: menu name: vars_menu }
# }
{
name: vars_menu
only_buffer_difference: true
marker: "# "
type: {
layout: list
page_size: 10
}
style: {
text: green
selected_text: green_reverse
description_text: yellow
}
source: { |buffer, position|
scope variables
| where name =~ $buffer
| sort-by name
| each { |it| {value: $it.name description: $it.type} }
}
}
@@ -0,0 +1,4 @@
a few keybindings using the new `input list --fuzzy` command to interactively select what to do:
- `history.nu`: select a command from history
- `directories.nu`: select a directory, recursively from the current `PWD`
- `modules.nu`: recursively select and insert a `.nu` module from `NU_LIB_DIRS` inside a `use ...` command, ready to be run by pressing enter
@@ -0,0 +1,16 @@
{
name: fuzzy_dir
modifier: control
keycode: char_s
mode: [emacs, vi_normal, vi_insert]
event: {
send: executehostcommand
cmd: "commandline edit --append (
ls **/*
| where type == dir
| get name
| input list --fuzzy
$'Please choose a (ansi magenta)directory(ansi reset) to (ansi cyan_underline)insert(ansi reset):'
)"
}
}
@@ -0,0 +1,17 @@
{
name: fuzzy_history
modifier: control
keycode: char_h
mode: [emacs, vi_normal, vi_insert]
event: {
send: executehostcommand
cmd: "commandline (
history
| each { |it| $it.command }
| uniq
| reverse
| input list --fuzzy
$'Please choose a (ansi magenta)command from history(ansi reset):'
)"
}
}
@@ -0,0 +1,24 @@
{
name: fuzzy_module
modifier: control
keycode: char_u
mode: [emacs, vi_normal, vi_insert]
event: {
send: executehostcommand
cmd: '
commandline edit --replace "use "
commandline edit --insert (
$env.NU_LIB_DIRS
| each {|dir|
ls ($dir | path join "**" "*.nu")
| get name
| str replace $dir ""
| str trim -c "/"
}
| flatten
| input list --fuzzy
$"Please choose a (ansi magenta)module(ansi reset) to (ansi cyan_underline)load(ansi reset):"
)
'
}
}
@@ -0,0 +1,51 @@
def __zoxide_menu [] {
{
name: zoxide_menu
only_buffer_difference: true
marker: "| "
type: {
layout: columnar
page_size: 20
}
style: {
text: green
selected_text: green_reverse
description_text: yellow
}
source: { |buffer, position|
zoxide query -ls $buffer
| parse -r '(?P<description>[0-9]+) (?P<value>.+)'
}
}
}
def __zoxide_keybinding [] {
{
name: zoxide_menu
modifier: control
keycode: char_o
mode: [emacs, vi_normal, vi_insert]
event: [
{ send: menu name: zoxide_menu }
]
}
}
def __edit_keybinding [] {
{
name: edit
modifier: alt
keycode: char_e
mode: [emacs, vi_normal, vi_insert]
event: [
{ send: OpenEditor }
]
}
}
export-env {
$env.config = ($env.config
| upsert menus ($env.config.menus | append (__zoxide_menu))
| upsert keybindings ($env.config.keybindings | append [(__zoxide_keybinding) (__edit_keybinding)])
)
}