Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FR: support search/replace for line breaks #28

Open
2 tasks done
tim-hilde opened this issue Nov 27, 2024 · 2 comments
Open
2 tasks done

FR: support search/replace for line breaks #28

tim-hilde opened this issue Nov 27, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@tim-hilde
Copy link

Make sure you have done the following

  • I have updated to the latest version of the plugin.
  • I have read the README.

Bug Description

New lines (\n), carriage returns (\r) or * are not recognized. Possibly more

Relevant Screenshot

image

To Reproduce

Search for/replace with \n, \r or *

Sample Text

this is a test with carraige return and
new lines

neovim version

NVIM v0.10.2

ripgrep version

ripgrep 14.1.1

Minimal reproducible config

local spec = {
	{
		"chrisgrieser/nvim-rip-substitute",
		opts = {}, -- insert config here
		keys = {
      { "gs", function() require("rip-substitute").sub() end, mode = { "n", "x" } },
		},
	},
}
--------------------------------------------------------------------------------
vim.env.LAZY_STDPATH = "./nvim-repro"
load(vim.fn.system("curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"))()
require("lazy.minit").repro { spec = spec }
@tim-hilde tim-hilde added the bug Something isn't working label Nov 27, 2024
@chrisgrieser
Copy link
Owner

Ah, that's technically not a bug, but simply a feature not supported yet.

Search/replace for line breaks entails quite the need for quite a bit of extra logic (file-format specific line breaks, nvim's editor model working with an array of lines, accounting for match at the border of line ranges, etc.)

Also, the incremental preview of replacements affecting \n require the ability to hide complete lines in the buffer, something to my knowledge neovim core does not support yet. Thus, such a feature cannot even be implemented at the moment.

@chrisgrieser chrisgrieser changed the title Bug: Some regex is not recognized FR: support search/replace for line breaks Nov 27, 2024
@chrisgrieser
Copy link
Owner

(Btw, search/replace for * should be supported, if you escape it via \*. )

@chrisgrieser chrisgrieser added enhancement New feature or request and removed bug Something isn't working labels Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants