shadyalfred / electric-quotes.nvim

Neovim plugin that works like electric-quotes emacs mode
12 stars 0 forks source link

Suggestion: Electric hyphens? #1

Open andis-sprinkis opened 1 year ago

andis-sprinkis commented 1 year ago

More of a vague momentary idea (just close if nothing comes out of it :smile:) . Various hyphens, dashes and minus signs are also characters that look similar yet different to each other and have different use cases.

https://en.wikipedia.org/wiki/Dash https://en.wikipedia.org/wiki/Hyphen

When trying to get text formatting right, I find myself copypasting these from the browser. I think it would be convenient to be able to insert specific ones with simple keystrokes, similarly how different 'quotes' are inserted with this plugin.

Do you think it would make sense to make a similar mode or plugin for cycling between these?

shadyalfred commented 1 year ago

Do you have certain key combinations in mind? -- for a dash, --- for a hyphen?

andis-sprinkis commented 1 year ago

Something similar, but I didn't have one specific in mind, this was a momentary idea which I should thought through more before posting, sorry about that.

Now I have laid out all the similar looking characters I use or would consider using, so:

Below mentioned characters I'd consider common, at least for my own use in code docs and design work. I'm more or less guided by what Wikipedia says about their usage.

Most often used

For proper-looking text formatting, separating words in sentence structure, I replace the lazy U+002D Hyphen-Minus with either

Also relevant

Composite word separator

Ensuring a composite word won't break

Used occasionally

For stylistic purposes I'd use one of these, in websites for things like large headings or as empasis or separators for navigation elements, or marking quotes.

This below one turns out is supposed to be used for numerical ranges e.g. 100‒200, but so is U+2013 En Dash, so I prefer that instead.


These are the ones I'd like be able to swap between in some convenient way.

But there are so many, that except for 2 or 3 most used ones, autocompletion source or a fuzzy finder for Unicode characters (internal in nvim, like with Telescope or fzf-lua) or external (e.g. with fzf, dmenu) may be a better fit.

I often swap both dash and quote-like characters, so your plugin looked very promising approach for it and for quotes it is.

What also is limiting for dash-like character that on keyboard there is only 1 key that covers these characters, while for quotes there are at least 2.

However, LateX and groff/troff typesetting systems both have short char. sequences for these characters, so maybe it's worth taking some inspiration from them.

shadyalfred commented 1 year ago

I'm gonna need more specific details. All what I can think of is turning -- into some kind of a dash, then adding another - to it turns into another unicode dash. If this is what you want, tell me which specific unicodes you want. Or if you have other ideas about how it should work. I think compose key on Linux does this. <Compose Key>--.<Compose Key>--- — Where - is the minus sign key on the keyboard.