eraserhd / parinfer-rust

A Rust port of parinfer.
ISC License
545 stars 42 forks source link

parinfer_mode when pasting code #25

Open nirrub opened 6 years ago

nirrub commented 6 years ago

If I copy code from an outside source that is not indented properly, when pasting into a clojure buffer with parinfer active, it'll reformat the code based on indent (smart mode) and not as 'paren' mode. I think that pasting code should, somehow, behave in 'paren' mode in order not to break the intended behaviour

matthias-margush commented 5 years ago

This also happens to me, and seems like a good idea. Any thoughts @eraserhd?

eraserhd commented 5 years ago

I'm not sure we always want paren mode for pasting. Paren mode would fail outright if the pasted code doesn't have balanced parens.

I had an idea for separate plugin that would remove and fix extra indentation in a register when yanking, and also add indentation relative to the paste point when pasting, meaning that relative indentation would be preserved instead of absolute indentation for lines 2+. Since I'm no longer using Vim, I'm not going to write that tho. So... free idea?

kkharji commented 3 years ago

+1. I guess a toggling between ParinferOn and ParinferOff when hitting p/P would be a sufficient solution