Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Rg] Is there a way to open the file and navigate to a line without having paths and line numbers in the output? #1537

Closed
5 tasks done
mqrris opened this issue Apr 19, 2024 · 1 comment
Labels

Comments

@mqrris
Copy link

mqrris commented Apr 19, 2024


rg

rg-error

To reproduce screenshots:

command! -bang -nargs=* Rg call fzf#vim#grep("rg -I -N --trim --color=always --smart-case ".shellescape(<q-args>), 1, <bang>0)
let $FZF_DEFAULT_OPTS="--color='gutter:#000000,bg+:#000000,prompt:#000000' --prompt='' --pointer=' ' --no-info --no-scrollbar --no-separator --reverse"

I'd also liked to know how to remove "Rg>" prompt from Rg and "~/" from FZF.

As well as this padding:

fzf-rg-space

The only reason I'm doing this is to save my screen estate.
I know it's probably unfeasible, but I'm gonna ask anyway.

@mqrris mqrris changed the title [Rg] Is there a way to open file and navigate to a line without having the path and line number in the output? [Rg] Is there a way to open the file and navigate to a line without having the path and line number in the output? Apr 19, 2024
@mqrris mqrris changed the title [Rg] Is there a way to open the file and navigate to a line without having the path and line number in the output? [Rg] Is there a way to open the file and navigate to a line without having paths and line numbers in the output? Apr 19, 2024
@junegunn
Copy link
Owner

junegunn commented Apr 20, 2024

fzf needs to know the file path and the line number to go to the position, so you can't use an rg command that doesn't print them. However, you can hide the parts using --with-nth option like so.

" command (string), [spec (dict)], [fullscreen (bool)]
command! -bang -nargs=* Rg call fzf#vim#grep("rg --column --line-number --no-heading --color=always --smart-case -- ".fzf#shellescape(<q-args>), { 'options': '--with-nth 4..' }, <bang>0)

You should note that --with-nth makes fzf slower.

As well as this padding:

Nope, not possible. One column is for "pointer" and another is for "marker" (for --multi selection).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants