Space Age seD in neovim. A project wide find and replace plugin with sad & fzf
This plug is a wrapper for sad by ms-jqd
You need
git ls_file
delta
https://user-images.githubusercontent.com/1681295/144705615-658ab025-f2a3-4857-b9d3-e5e2142bf316.mp4
Plug 'ray-x/guihua.lua', {'do': 'cd lua/fzy && make' }
Plug 'ray-x/sad.nvim'
require("packer").startup({
function(use)
use({ "wbthomason/packer.nvim" })
use({
"ray-x/sad.nvim",
requires = { "ray-x/guihua.lua", run = "cd lua/fzy && make" },
config = function()
require("sad").setup{}
end,
})
end,
})
require'sad'.setup({
debug = false, -- print debug info
diff = 'delta', -- you can use `less`, `diff-so-fancy`
ls_file = 'fd', -- also git ls-files
exact = false, -- exact match
vsplit = false, -- split sad window the screen vertically, when set to number
-- it is a threadhold when window is larger than the threshold sad will split vertically,
height_ratio = 0.6, -- height ratio of sad window when split horizontally
width_ratio = 0.6, -- height ratio of sad window when split vertically
})
:Sad
You will be prompt to input new word to be replace
oldtext
to newtext
for all project files:Sad oldtext newtext
:Sad oldtext newtext lua
-- replace old with new
lua require'sad'.replace('old', 'new')
-- or replace old with input for 'md' files
lua require'sad'.replace('old', nil, 'md')
-- or replace expand('<word>') or visual select with 'new' for md files
lua require'sad'.replace(nil, 'new', 'md')
-- or replace expand('<word>') or visual select with your input for md files
lua require'sad'.replace(nil, nil, 'md')
"capture group "123" -> 🌈123🌈
:Sad "(\d+)" '🌈$1🌈'
"capture group 123 -> 🌈123🌈
:Sad (\d+) '🌈$1🌈'
" multiple lines:"
Sad (firstKey:firstValue\n\s*secondKey):secondVal $1:newSecondValue
" or use ${1}
Sad (firstKey:firstValue\n\s*secondKey:)secondVal ${1}newSecondValue
vim&neovim: far.vim a vim plugin with python & vimscript
neovim: nvim-spectre Lua plugin, find with rg
and replace with sed
and most importantly, with realtime preview