Fanael / edit-indirect

Edit regions in separate buffers
99 stars 23 forks source link

Add edit-indirect-dwim #23

Closed dakra closed 2 years ago

dakra commented 2 years ago

DWIM version of edit-indirect-region. When no region is selected and the cursor is in a string, edit-indirect this string.

Fanael commented 2 years ago

I appreciate the effort, but I feel like this behavior is a bit too subjective to be included in the package, the best place for it is one's personal config: for me personally, trying to call edit-indirect on a string is very rarely what I mean.

Sorry for the late response, I'm not doing very well lately.

dakra commented 2 years ago

No problem. I had it in my personal config for years (https://github.com/dakra/dmacs/blob/master/init.org#edit-indirect-edit-a-region-in-a-separate-buffer ) but thought maybe it's worth it to upstream.

But just out of curiosity. If there where a edit-indirect-region-dwim command and you would call that inside a string, what would you expect it to do? Just asking because for me editing templates (sql,js,html,etc) from inside a string is 100% of the use case for edit-indirect for me.

Thanks for the package and hope you're getting better soon :)

Fanael commented 2 years ago

Just asking because for me editing templates (sql,js,html,etc) from inside a string is 100% of the use case for edit-indirect for me.

I actually mostly use it for editing blocks that are not strings, but may contain strings, like inline CSS or JS, where the proposed edit-indirect-region-dwim would edit the inside of the string, instead of the entire stylesheet or script.