-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add optional search and replace integration (grug-far.nvim) (#250)
* feat: add optional search and replace integration (grug-far.nvim) This commit adds an integration with grug-far.nvim, a plugin that provides a way to search and replace in the current working directory. It was recently added in LazyVim as the default, and it's really easy to use. When you press the keybinding (default: `<c-g>`), yazi will close and grug-far.nvim will open with the current directory prefilled in the search field. This makes it easy to search and replace in that directory only. Note that this only seems to work when the target directory is under cwd, so it's not possible to search in a parent directory. The integration is added as a keymap in the config. The keymap is set to `<c-g>` by default, but it can be changed in the config. To configure it, set one of these in your yazi.nvim config: ```lua -- to disable using the keymap entirely { keymaps = { replace_in_directory = false } } -- to change the keybinding to something else { keymaps = { replace_in_directory = "<c-o>" } } -- advanced: to create a custom integration for yourself { integrations = { replace_in_directory = function (directory) -- your custom implementation end }, } ``` <https://github.com/MagicDuck/grug-far.nvim> * fixup! feat: add optional search and replace integration (grug-far.nvim) * fixup! feat: add optional search and replace integration (grug-far.nvim) * fixup! feat: add optional search and replace integration (grug-far.nvim)
- Loading branch information
1 parent
4329a2c
commit b512d38
Showing
10 changed files
with
97 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
integration-tests/cypress/e2e/using-ya-to-read-events/integrations.cy.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import path = require("path") | ||
import { startNeovimWithYa } from "./startNeovimWithYa" | ||
|
||
describe("integrations to other tools", () => { | ||
beforeEach(() => { | ||
cy.visit("http://localhost:5173") | ||
}) | ||
|
||
it("can use grug-far.nvim to search and replace in the cwd", () => { | ||
startNeovimWithYa().then((dir) => { | ||
// wait until text on the start screen is visible | ||
cy.contains("If you see this text, Neovim is ready!") | ||
cy.typeIntoTerminal("{upArrow}") | ||
cy.typeIntoTerminal("/routes{enter}") | ||
cy.typeIntoTerminal("{rightArrow}") | ||
|
||
// contents in the directory should be visible in yazi | ||
cy.contains(dir.contents["routes/posts.$postId/adjacent-file.txt"].name) | ||
|
||
// close yazi and start grug-far.nvim | ||
cy.typeIntoTerminal("{control+g}") | ||
cy.contains("Grug FAR") | ||
|
||
// the directory we were in should be prefilled in grug-far.nvim's view | ||
cy.contains("testdirs") | ||
const p = path.join( | ||
dir.rootPathRelativeToTestEnvironmentDir, | ||
"routes", | ||
"**", | ||
) | ||
cy.contains(p) | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.