FZF VIM: removing leading portion of absolute path

Viewed 162

I am using the following to search my project:

let g:fzf_directories = join(
      \ [
      \ "/some/long/path/to/project/dir",
      \ "more paths here..."
      \ ], ' ')

let $FZF_DEFAULT_COMMAND = "rg --files --hidden --smart-case " . $g:fzf_directories

The results look like this:

/some/long/path/to/project/dir/SomeFile.java
/some/long/path/to/project/dir/subdir/SomeOtherFile.java

I would like the results to look like:

SomeFile.java
subdir/SomeOtherFile.java

I know that there is 'options': '--delimiter : --nth 4..' which I think might do what I want but I can't figure out where to put it.

1 Answers

I know this question was asked over 6 months ago but I have an answer for you based on the post found at the following link: sort_ripgrep_results_based_on_proximity_to

Just add a '.' right after the --files option like so:

rg --files "."
Related