s1n7ax
nvim-search-and-replace
Lua

Really simple plugin to search and replace multiple files

Last updated Apr 14, 2026
70
Stars
4
Forks
1
Issues
0
Stars/day
Attention Score
12
Language breakdown
Lua 100.0%
โ–ธ Files click to expand
README

nvim-search-and-replace

Absolutly minimal plugin to search and replace multiple files in current working directory. This only uses vim built-in features to search and replace

Install

use {
    's1n7ax/nvim-search-and-replace',
    config = function() require'nvim-search-and-replace'.setup() end,
}

Keymaps

leader + g + r = Search and replace (Respects ignored files)

leader + g + R = Search and replace everything (Don't give a shit about the ignored files)

leader + g + u = Search, replace and save (Respects ignored files)

leader + g + U = Search, replace and save everything (Don't give a shit about the ignored files)

Commands

:SReplace               - Search and replace
:SReplaceAll            - Search and replace all including ignored files
:SReplaceAndSave        - Search, replace and save
:SReplaceAllAndSave     - Search, replace and save including ignored files

Syntax

Search Query Syntax

:h su for more information

/<substitute-pattern>/<substitute-flags> <files>
/<substitute-pattern>/<substitute-flags>
<substitute-pattern>/<substitute-flags>
/<substitute-pattern>/
<substitute-pattern>

Ex:-

-- search the word "test" in ".js" files and replace them glabally in every file
/test/g */.js

-- search the word "test" in all files and replace them glabally in every file test/g

-- search the word "test" in all files and replace one time for single line test

-- seach any word starts with "te" and ends with "st" and replace one time for single line te.*st

-- seach "print(something)" and add something to match group print(\(.*\))

Replace Query Syntax

<replace-query>

Ex:-

-- replace the matched queries with "test"
test

-- replace the matched queries with "console.log" and replace \1 with the first match value console.log(\1)

Configurations

require('nvim-search-and-replace').setup{
    -- file patters to ignore
    ignore = {'/node_modules/', '/.git/',  '/.gitignore', '/.gitmodules','build/**'},

-- save the changes after replace update_changes = false,

-- keymap for search and replace replace_keymap = '<leader>gr',

-- keymap for search and replace ( this does not care about ignored files ) replaceallkeymap = '<leader>gR',

-- keymap for search and replace replaceandsave_keymap = '<leader>gu',

-- keymap for search and replace ( this does not care about ignored files ) replaceallandsavekeymap = '<leader>gU', }

Available functions

require('nvim-global-replace').setup(config)

-- require('nvim-global-replace').searchandreplace({ -- ignore = { 'tests/**'} , update_changes = true -- }) require('nvim-global-replace').replace(opts)

-- require('nvim-global-replace').searchandreplace({ -- update_changes = true -- }) require('nvim-global-replace').replace_all(opts)

๐Ÿ”— More in this category

ยฉ 2026 GitRepoTrend ยท s1n7ax/nvim-search-and-replace ยท Updated daily from GitHub