Thursday, May 12, 2016

Re: Python Regex in a Vim Search


Den 11 maj 2016 18:20 skrev "rameo" <raiwil@gmail.com>:
>
> I would like to ask whether it is possible to add python regex to the VIM search in a future VIM release?
>
> p.e.
> We could use a `P` or something like that in a vim search to indicate that it concerns a Python regex p.e. `/P'pythonregex'`
>
> If we have this we can use the same regex in the other python code if not we have to switch from Vim code to python code. A wonderful thing in VIM is that it accepts other languages as Ruby and Python. Both have more features so that we can achieve things faster and easier. It's also easier to find online help. There are more users programming in these languages then Vimscript

A while back I posted some code for doing a substitute with perl regex. I couldn't get it fully interactive the way a built-in substitute with /c is, but it does show some context and asks for confirmation for each substitute. It could probably be rewritten using python and/or to build a hitlist.

You can find the code here:

https://gist.github.com/bpj/e9ba4914dd269b30c620bf7cb030b292

Mind the reply to!

>
> Slickedit has a similar function:
> https://www.slickedit.com/products/slickedit/cool-features
> (please see 'Regex Evaluator' at the bottom of this document)
>
> --
> --
> You received this message from the "vim_use" maillist.
> Do not top-post! Type your reply below the text you are replying to.
> For more information, visit http://www.vim.org/maillist.php
>
> ---
> You received this message because you are subscribed to the Google Groups "vim_use" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: