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

replace doesn't allow regex #1704

Open
dprr opened this issue Jun 3, 2020 · 3 comments
Open

replace doesn't allow regex #1704

dprr opened this issue Jun 3, 2020 · 3 comments

Comments

@dprr
Copy link

dprr commented Jun 3, 2020

Description of the problem or steps to reproduce

Say I want to replace 4 spaces with a tab:

  1. Type CtrlE to get the command window
  2. Type replace ' ' '\t'

That would replace 4 spaces with the \t literal rather than a tab character

Specifications

Version: 2.0.4
Commit hash: c5b0c2d
OS: Linux 5.6.13-arch1-1
Terminal: Fish

@zyedidia
Copy link
Owner

zyedidia commented Jun 3, 2020

I’ll look into fixing this. In the meantime I recommend using the > retab command (along with the appropriate tabstospaces value you want) to achieve what you want.

@dprr
Copy link
Author

dprr commented Jun 4, 2020

thanks

@AndrewDDavis
Copy link

Note this issue isn't really about regex, but ANSI C Escape Sequences, of which \t, \n, and \\ are really common. These can be expanded e.g. in a Bash shell with e.g. printf $'here are 2 tabs "\t\t" and a newline\n'.

It looks like it might be enough to pass the replacement string through fmt.Sprintf to interpret the codes, but maybe this would complicate the selection boundaries after replacement.

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

No branches or pull requests

3 participants