Use sd and ripgrep for some fish functions. Changed fish functions to repaint the command line as well

This commit is contained in:
Sergio Laín 2023-09-17 12:13:02 +02:00
parent 65c7efee0f
commit 24fb458ba8
No known key found for this signature in database
GPG key ID: 14C9B8080681777B
3 changed files with 6 additions and 11 deletions

View file

@ -3,5 +3,7 @@ function cdzi --description 'Open directories from zoxide in a new Kitty tab'
if test -n "$selected_dir"
cd $selected_dir
else
commandline -f repaint
end
end

View file

@ -1,9 +1,7 @@
function fgit --description 'List forgit options with fzf'
set selected_command (functions | grep -o 'forgit::[^ ]*' | cut -d ':' -f 2- | sed 's/^://' | fzf)
set selected_command (functions | rg -o 'forgit::[^ ]*' | cut -d ':' -f 2- | sd '^:' '' | fzf)
if [ -n "$selected_command" ]
eval "forgit::$selected_command"
else
echo "Command selection canceled"
return
end
commandline -f repaint
end

View file

@ -2,18 +2,13 @@ function repos --description 'Open Git directories in ~/Repos with fzf in a new
set selected_category (echo -e "Personal\nClass\nWork\nCommunity" | fzf --prompt "Select category: ")
if test -n "$selected_category"
set selected_dir (fd --type d --base-directory ~/Repos/"$selected_category"/ -H '^\.git$' | sed 's/\/\.git\/$//' | fzf)
set selected_dir (fd --type d --base-directory ~/Repos/"$selected_category"/ -H '^\.git$' -d 3 | sd '\.git/' '' | fzf)
if test -n "$selected_dir"
set tab_title (basename "$selected_dir")
set new_tab_cmd "kitty @ launch --type=tab --tab-title \"$tab_title\" ~/Repos/$selected_category/$selected_dir"
eval $new_tab_cmd
else
echo "No directory selected"
return
end
else
echo "No category selected"
return
end
end
commandline -f repaint
end