diff --git a/home/features/cli/nushell.nix b/home/features/cli/nushell.nix index f25b870..b5775d0 100644 --- a/home/features/cli/nushell.nix +++ b/home/features/cli/nushell.nix @@ -43,12 +43,12 @@ in { } alias .. = cd .. - alias ... = cd ../.. + alias ... = cd ... + alias h = cd $env.HOME alias b = yazi alias lt = eza --tree --level=2 --long --icons --git alias grep = rg alias just = just --unstable - alias fs = du -d 1 | sort-by apparent -r alias n = nix alias nd = nix develop -c $nu.current-shell @@ -85,6 +85,13 @@ in { null } } + def --env dir_fuzzy [] { + let selected = ( + fd --type directory + | ^sk --preview 'eza --tree --no-permissions --no-filesize --no-user --no-time --only-dirs {}' --height 40% --layout=reverse --color=fg:#f8f8f2,bg:#282a36,current_bg:#ff79c6,current_fg:#bd93f9,info:#ffb86c,marker:#6272a4,pointer:#50fa7b,spinner:#50fa7b + ) + cd $selected + } def find_fuzzy [] { # Find non-hidden text files with matches for any content and select one via fuzzy search let selected = ( @@ -96,8 +103,6 @@ in { --preview { open $in | bat --color=always --line-range :50 } --color=fg:#f8f8f2,bg:#282a36,current_bg:#ff79c6,current_fg:#bd93f9,info:#ffb86c,marker:#6272a4,pointer:#50fa7b,spinner:##50fa7b ) - - # Open the selected file in the default editor if a selection was made if ($selected | is-not-empty) { ^$env.EDITOR $selected } @@ -117,6 +122,18 @@ in { } ] } + { + name: dir_fuzzy + modifier: alt + keycode: char_c + mode: [emacs, vi_insert, vi_normal] + event: [ + { + send: executehostcommand + cmd: "dir_fuzzy" + } + ] + } { name: history_fuzzy modifier: control