junegunn / junegunn/fzf.vim

Can't replace word in multiple files with Rg when using vim's popup window with fzf#vim#with_preview()

Open
#1,260 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

Hello,
I am on **Manjaro Linux**,
**vim 8.2**
**fzf** and **fzf.vim** --> **latest** --> installed through vim-plug with
```Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }```
```Plug 'junegunn/fzf.vim'```
I update the plugins every Monday.

- [ 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

I've just noticed this, because I needed to replace a word throughout a project. So this is the code in question:
```vim
" FZF with Ripgrep
" allow passing optional args to rg command
" e.x. :Rg myterm -g '*.md'
command! -bang -nargs=* Rg call fzf#vim#grep(
\ 'rg
\ --column
\ --line-number
\ --no-heading
\ --smart-case
\ --hidden
\ --glob=!.git
\ --color=always '. , 1,
\ fzf#vim#with_preview({'window': { 'width': 0.9, 'height': 0.9 },'options': ['--layout=default']}), 0
\)

nnoremap R
\ :let @s='\<'.expand('').'\>'
\ :let @w=expand('')
\ :Rg w
\ :cfdo %s/s//g \| update
\

```
The work flow is ```R```, the word under the cursor is captured and you go straight to the *Rg* window where you can select the files you would like to change the word in, press enter, than ```:cfdo %s/s/ write new word here/g \| update```, press enter an that's it.

So when I try to replace a word the code stops in the popup window and this is shown ```:cfdo %s/s//g \| update```.
It completely disregards the Rg process.

But when I remove the ```'window': { 'width': 0.9, 'height': 0.9 },``` from ```fzf#vim#with_preview()``` it works as expected.
I don't know what am I missing here ??

I would like to know how can I make this using the popup window, 'cause is much better to see.

Thanks.

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.