Skip to content

Commit

Permalink
add recipe for searching/replacing in oil.nvim
Browse files Browse the repository at this point in the history
  • Loading branch information
mehalter committed Sep 19, 2024
1 parent a1ef905 commit e5af139
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,46 @@ return {
```
</details>

<details>
<summary>Oil explorer lazy plugin setup</summary>

```lua
return {
"stevearc/oil.nvim",
config = function()
local oil = require "oil"
oil.setup {
keymaps = {
-- create a new mapping, gs, to search and replace in the current directory
gs = {
callback = function()
-- get the current directory
local prefills = { paths = oil.get_current_dir() }

local grug_far = require "grug-far"
-- instance check
if not grug_far.has_instance "explorer" then
grug_far.open {
instanceName = "explorer",
prefills = prefills,
staticTitle = "Find and Replace from Explorer",
}
else
grug_far.open_instance "explorer"
-- updating the prefills without clearing the search and other fields
grug_far.update_instance_prefills("explorer", prefills, false)
end
end,
desc = "oil: Search in directory",
},
},
-- rest of your config
}
end,
}
```
</details>

## ❓ Q&A

#### 1. Getting RPC[Error] ... Document for URI could not be found: file:///.../Grug%20FAR%20-%20...
Expand Down

0 comments on commit e5af139

Please sign in to comment.