Skip to content
New issue

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

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

Already on GitHub? # to your account

The interface doesn't show any replacement? #81

Closed
Integralist opened this issue Jul 5, 2022 · 6 comments
Closed

The interface doesn't show any replacement? #81

Integralist opened this issue Jul 5, 2022 · 6 comments

Comments

@Integralist
Copy link

Not sure if I'm not triggering things correctly, but when I type my replacement and then press Esc nothing happens.

Here is the configuration I'm using:

lua <<EOF
  require('spectre').setup({
    replace_engine={
      ['sed']={
          cmd = "gsed", -- I brew install gsed but I still have the macOS BSD system `sed` installed/exposed.
      },
    },
  })
EOF
nnoremap <leader>S <cmd>lua require('spectre').open()<CR>

The below screenshot demonstrates that the replacement isn't applied in the preview.

For example, I expected all instances of func Pr to be replaced with func Pxxxx.
So if we look at the first result func PrintDictionaryItem that should become func PxxxintDictionaryItem.

Screenshot 2022-07-05 at 10 26 25

@windwp
Copy link
Collaborator

windwp commented Jul 5, 2022

you can't use '\b' it is vim regex you can check by ':help \s'.
I say it on README the search function use rg regex but the highlight on UI use vim regex :(

@Integralist
Copy link
Author

Eurgh. Apologies. I did see mention of it but I clearly misunderstood what was actually being explained.

So yeah switching away from using 'word boundary' \b allowed the replacement to work 👍🏻

@gaborvecsei
Copy link

Eurgh. Apologies. I did see mention of it but I clearly misunderstood what was actually being explained.

So yeah switching away from using 'word boundary' \b allowed the replacement to work 👍🏻

What was your solution to "switching away"?

@Integralist
Copy link
Author

@gaborvecsei iirc I used \< and \> as that's the standard vim syntax for word boundaries.

@gaborvecsei
Copy link

@Integralist Yeah I tried it with the vim syntax, but then I got a regex parse error
image

@windwp
Copy link
Collaborator

windwp commented Nov 7, 2022

hi on new version you can try to switch replace engine to oxi
it use a rust regex to highlight and replace.
just check readme and run file build.sh

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants