Find-N-Replace in Vim with live preview (experimental)
Use your favorite plugin manager. vim-fnr requires vim-pseudocl.
With vim-plug:
Plug 'junegunn/vim-pseudocl'
Plug 'junegunn/vim-fnr'
- Normal mode
<Leader>r<Movement>
- Substitution in the range<Leader>R
- Substitution of the word under the cursor in the entire document
- Visual mode
<Leader>r
- Substitution in the selected range<Leader>R
- Substitution of the selected string in the entire document
- Command line
:<Range>FNR
The command is repeatable with .
key if you have installed
repeat.vim.
Tab
i
- case-insensitive matchw
- word-boundary match (\<STRING\>
)g
- substitute all occurrencesc
- confirm each substitutionTab
orEnter
to return
CTRL-N
orCTRL-P
- Auto-completion
" Defaults
let g:fnr_flags = 'gc'
let g:fnr_hl_from = 'Todo'
let g:fnr_hl_to = 'IncSearch'
nmap <Leader>r <Plug>(FNR)
xmap <Leader>r <Plug>(FNR)
nmap <Leader>R <Plug>(FNR%)
xmap <Leader>R <Plug>(FNR%)
MIT