nvim-treesitter-textobjects icon indicating copy to clipboard operation
nvim-treesitter-textobjects copied to clipboard

Regex Patterns

Open bennypowers opened this issue 2 years ago • 0 comments

Is your feature request related to a problem? Please describe. Users want to manipulate the inner and outer regexp patterns

Describe the solution you'd like

Assuming r is bound to the new regexp pattern text object...

// some module.js
const RE = /-(.*)-/mg;
//            ^ cursor here

yir - yanks -(.*)- yar - yanks /-(.*)-/mg

<!-- some document.html -->
<input pattern="[0-9]+-[a-zA-Z]+"/>
<!--             ^ cursor here -->

yir - yanks [0-9]+-[a-zA-Z]+ yar - yanks "[0-9]+-[a-zA-Z]+"

(HTML example depends on https://github.com/nvim-treesitter/nvim-treesitter/pull/2577)

Describe alternatives you've considered one would have to construct their own selection painstakingly, as / could be a legal regexp char

bennypowers avatar Mar 27 '22 18:03 bennypowers