All Projects → romgrk → searchReplace.vim

romgrk / searchReplace.vim

Licence: other
Search & Replace, simply & efficiently [neovim only]

Programming Languages

Vim Script
2826 projects

Projects that are alternatives of or similar to searchReplace.vim

Vim Color Spring Night
Low-contrast calm color scheme for Vim
Stars: ✭ 227 (+773.08%)
Mutual labels:  vim-plugin
Vim Ledger
Vim plugin for Ledger
Stars: ✭ 253 (+873.08%)
Mutual labels:  vim-plugin
qf helper.nvim
A collection of improvements for the quickfix buffer
Stars: ✭ 70 (+169.23%)
Mutual labels:  vim-plugin
Indent Blankline.nvim
Indent guides for Neovim
Stars: ✭ 203 (+680.77%)
Mutual labels:  vim-plugin
Vim Ghost
Vim/Nvim client for GhostText - Edit browser text areas in Vim/Neovim
Stars: ✭ 245 (+842.31%)
Mutual labels:  vim-plugin
Nerdtree
A tree explorer plugin for vim.
Stars: ✭ 16,380 (+62900%)
Mutual labels:  vim-plugin
Neomake
Asynchronous linting and make framework for Neovim/Vim
Stars: ✭ 2,512 (+9561.54%)
Mutual labels:  vim-plugin
nvim-contabs
contextual tabs for vim/neovim
Stars: ✭ 20 (-23.08%)
Mutual labels:  vim-plugin
Lusty
LustyExplorer / LustyJuggler for Vim
Stars: ✭ 246 (+846.15%)
Mutual labels:  vim-plugin
vim-snipp-snapp-snut-and-the-legend-continues
💇 (Experimental) Vim snippet plugin
Stars: ✭ 24 (-7.69%)
Mutual labels:  vim-plugin
Vim Lsp Cxx Highlight
Vim plugin for C/C++/ObjC semantic highlighting using cquery, ccls, or clangd
Stars: ✭ 231 (+788.46%)
Mutual labels:  vim-plugin
Vim Fibo Indent
Fibonacci Indentation for Vim.
Stars: ✭ 244 (+838.46%)
Mutual labels:  vim-plugin
Coc.nvim
Nodejs extension host for vim & neovim, load extensions like VSCode and host language servers.
Stars: ✭ 18,268 (+70161.54%)
Mutual labels:  vim-plugin
Pathfinder.vim
Vim plugin to suggest better movements
Stars: ✭ 228 (+776.92%)
Mutual labels:  vim-plugin
vim-mysticaltutor
Low-contrast flat colorscheme for Vim and terminals
Stars: ✭ 22 (-15.38%)
Mutual labels:  vim-plugin
Vim Lexical
Build on Vim’s spell/thes/dict completion
Stars: ✭ 223 (+757.69%)
Mutual labels:  vim-plugin
Vim Airline
lean & mean status/tabline for vim that's light as air
Stars: ✭ 15,873 (+60950%)
Mutual labels:  vim-plugin
vim-textobj-anyblock
A text object for any of '', "", (), {}, [] and <>.
Stars: ✭ 76 (+192.31%)
Mutual labels:  vim-plugin
vim-shellcheck
Vim wrapper for ShellCheck, a static analysis tool for shell scripts.
Stars: ✭ 63 (+142.31%)
Mutual labels:  vim-plugin
vim-textobj-quote
Use ‘curly’ quote characters in Vim
Stars: ✭ 112 (+330.77%)
Mutual labels:  vim-plugin

SearchReplace.vim

This plugin does one thing well:

  • search for a pattern across multiple files,
  • displays the matches & lets you delete matches you don't want to replace,
  • replace those matches with a new pattern

Dependencies

  • neovim (with floating windows)
  • ripgrep (with --json support)
  • sed

WARNING: The supported regex syntax is the intersection of what both ripgrep and sed support. Figuring that out is left as an exercice for the reader.

Neovim only for the moment (accepting PRs)

Demo

Usage

Run :Search to open the prompt window, or :Search pattern [directories] to search directly.

Add this to your vimrc to open the search prompt quickly.

" Open search prompt
nnoremap <silent><C-f><C-f> :Search<CR>
" Search directly for word under cursor
nnoremap <silent><C-f><C-w> :Search <C-R><C-W><CR>
nnoremap <silent><C-f>w     :Search <C-R><C-W><CR>

:Search

From here, press d on match lines to remove that match, and press d on filename lines to remove the whole file from the operation. When you're satisfied, run :Replace replacement to have the remaining matches replaced. Done. (you'll get a X replacements in Y files confirmation)

Pattern: a search pattern in a sed/ripgrep compatible format Directories: a comma separated list of patterns in the gitignore format (! makes it an exclude)

See the docs for more keybindings and options.

Details

The regex patterns supported are the subset of what is supported by both ripgrep and sed. Nothing fancy, no look(behind|ahead).

Configuration

" Create configuration object if it doesn't exist
let g:searchReplace = get(g:, 'searchReplace', {})

" Closes window on BufLeave event
let g:searchReplace.close_on_exit = v:true

" The edit comment to use to open files
let g:searchReplace.edit_command = 'EditPreviousWindow'

" for example, this can be used to unfocus the search window
" before opening the match
command! -nargs=1 EditPreviousWindow :execute 'wincmd p | edit ' . <f-args>

" Open the search window yourself
let g:searchReplace.open_window = {->execute('aboveleft split')}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].