junegunn / junegunn/fzf.vim

Removing leading (insignificant for reading) whitespace from the preview window

Open
#1,253 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Vim Script
Stars
10.3k
Forks
608
Avg merge
5d 8h
Merged PRs (30d)
2

Description

- [x] I have fzf 0.23.0 or above
- [x] I have read through https://github.com/junegunn/fzf.vim/blob/master/README.md
- [x] I have read through https://github.com/junegunn/fzf/blob/master/README-VIM.md
- [x] I have read through the manual page of fzf (`man fzf`)
- [x] I have searched through the existing issues

I don't know if this is a fzf-vim/fzf issue, but when I search with `:Rg` in vim, I will get the preview window centered with files on the left, and preview on the right. If the source code has a big indentation, it will show it as is (meaning I get lots of white space before the text - being in Java and in an if within a function within a class).

Is there a way to trim-left the source code? Example (searching for `here`):

Current output:
```
if(cond) {
System.out.println("Hello, World!");

// here
System.out.println("Hello, World!");

System.out.println("Hello, World!");
}
```

Wanting (current, without the indentation since its the same):
```
if(cond) {
System.out.println("Hello, World!");

// here
System.out.println("Hello, World!");

System.out.println("Hello, World!");
}
```

(Of course if before the `if` there was a visible `while` all text will get the +2 indentation of the while)

There is a `--keep-right` option, but I don't think it's for preview (it was to see the right side of the file on overflow). Also, there are options for `--preview-window`, but I didn't see an automatic way of trimming the left side so I can see more text in the preview window (I wouldn't want to wrap the text - only to delete leading insignificant tabs/spaces).

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.