From 1e4a413cf101d54835e4092f21370c7c528eb9e6 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Fri, 14 Jun 2024 17:26:09 +0200 Subject: [PATCH] Add custom Alt+L, using EXA instead of LS --- .../functions/__fish_list_current_token.fish | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .config/fish/functions/__fish_list_current_token.fish diff --git a/.config/fish/functions/__fish_list_current_token.fish b/.config/fish/functions/__fish_list_current_token.fish new file mode 100644 index 0000000..33659a9 --- /dev/null +++ b/.config/fish/functions/__fish_list_current_token.fish @@ -0,0 +1,21 @@ +# This function is typically bound to Alt-L, it is used to list the contents +# of the directory under the cursor. + +function __fish_list_current_token -d "List contents of token under the cursor if it is a directory, otherwise list the contents of the current directory" + set -l val (commandline -t | string replace -r '^~' "$HOME") + printf "\n" + if test -d $val + eza --icons=auto $val + else + set -l dir (dirname -- $val) + if test $dir != . -a -d $dir + eza --icons=auto $dir + else + eza --icons=auto + end + end + + string repeat -N \n --count=(math (count (fish_prompt)) - 1) + + commandline -f repaint +end