zoxide icon indicating copy to clipboard operation
zoxide copied to clipboard

Is it possible to replace or remove `/home/username/` in the output when using `zoxide query -i`?

Open kohane27 opened this issue 1 year ago • 3 comments

Hello there. Hope you're doing well. Thank you for creating zoxide. It has been an indispensable tool in my day-to-day workflow.

However, I'm wondering if it's possible to remove /home/username/ in the output when using zoxide query -i?

$zoxide query -i:

   134.9  /home/username/.oh-my-zsh/custom
   135.7  /home/username/.local/share/nvim/lazy/friendly-snippet
   139.1  /home/username/Documents/books/clipboard
   152.1  /home/username/.config/sway/scripts
   159.8  /home/username/.local
   195.7  /home/username/Documents
   212.5  /home/username/repo
   220.4  /home/username/.config/tmuxp
   227.1  /home/username/Nextcloud/videos
   258.6  /home/username/Nextcloud
   260.7  /home/username/.config/nvim
   301.1  /home/username/.config
   307.7  /home/username/.config/sway/config.d
   504.9  /home/username/.config/sway
   878.6  /home/username/Downloads/test
  1071.5  /home/username/.config/ranger
  1374.3  /home/username/Videos
> 2827.7  /home/username/Downloads

As you can see, the $HOME prefix is cluttering the output and making it hard to distinguish the output (at least for me).

What I hope to achieve

All of the time, I'm searching inside $HOME. What I'd hope to achieve is the following when using $zoxide query -i:

   134.9  .oh-my-zsh/custom
   135.7  .local/share/nvim/lazy/friendly-snippet
   139.1  Documents/books/clipboard
   152.1  .config/sway/scripts
   159.8  .local
   195.7  Documents
   212.5  repo
   220.4  .config/tmuxp
   227.1  Nextcloud/videos
   258.6  Nextcloud
   260.7  .config/nvim
   301.1  .config
   307.7  .config/sway/config.d
   504.9  .config/sway
   878.6  Downloads/test
  1071.5  .config/ranger
  1374.3  Videos
> 2827.7  Downloads

That is, hide /home/username/ from the output. I understand that zoxide also includes directories other than $HOME (i.e., /var/lib/flatpak/exports/share/applications as long as I've cd into it before).

If the above (hiding /home/username/ from the output) is not possible, at least replace /home/username/ with ~:

   134.9  ~/.oh-my-zsh/custom
   135.7  ~/.local/share/nvim/lazy/friendly-snippet
   139.1  ~/Documents/books/clipboard
   152.1  ~/.config/sway/scripts
   159.8  ~/.local
   195.7  ~/Documents
   212.5  ~/repo
   220.4  ~/.config/tmuxp
   227.1  ~/Nextcloud/videos
   258.6  ~/Nextcloud
   260.7  ~/.config/nvim
   301.1  ~/.config
   307.7  ~/.config/sway/config.d
   504.9  ~/.config/sway
   878.6  ~/Downloads/test
  1071.5  ~/.config/ranger
  1374.3  ~/Videos
> 2827.7  ~/Downloads

This avoids the problem of not being able to distinguish between directories other than $HOME.

What I've tried

  1. I've looked into _ZO_EXCLUDE_DIRS. But it "Excludes the specified directories from the database." I'd like to excludes the specified directories from the output, not the database.
  2. man fzf but there's no relevant flags.

Any input is much appreciated. Thank you.

kohane27 avatar Apr 20 '23 09:04 kohane27