Skip to content
This repository has been archived by the owner on Jan 2, 2020. It is now read-only.

Feature request: automatically replace texas ops with unicode equivalents #8

Closed
AlexDaniel opened this issue Aug 29, 2017 · 6 comments

Comments

@AlexDaniel
Copy link

AlexDaniel commented Aug 29, 2017

This ticket is inspired by reddit comments.

Example: you type <=, it should automatically replaces it with . Obviously, make it possible to turn that feature off, but perhaps consider having it enabled by default.

List of non-texas ops: https://docs.perl6.org/language/unicode_texas

Sister tickets:

@hoelzro
Copy link
Member

hoelzro commented Aug 31, 2017

I think this is a good idea, and would accept a PR implementing this; you could accomplish this like so:

if get(g:, 'perl6_mess_with_texas', 1)
  inoremap <= 
endif

@other-mickk
Copy link

other-mickk commented Mar 28, 2018

iabbrev <buffer> / ÷

I believe this interacts poorly with a couple of things, e.g.:

  • with a /-delimited regex: $haystack ~~ / pattern /;$haystack ~~ ÷ pattern ÷;, affects substitutions/transliterations as well
  • with infix //: say $this // $that;say $this ÷/ $that;

edit: as I just found out, the abbreviation for e also trips up on "e.g." in comments

@AlexDaniel
Copy link
Author

@mickk-on-cpp does it perform the replacement automatically on the whole document? I thought you'd have to explicitly tell it to do the substitution at cursor. And if so, it's not a problem if it replaces wrong stuff?

@other-mickk
Copy link

other-mickk commented Mar 29, 2018

does it perform the replacement automatically on the whole document? I thought you'd have to explicitly tell it to do the substitution at cursor.

The abbreviation system does take place on input and is not a global substitution, but it is implicit and not explicit. The examples I gave illustrate what happens when writing e.g. a /-delimited regex: the delimiters get turned into division signs (the first one when inputting the following space, the second one when inputting the semicolon).

And if so, it's not a problem if it replaces wrong stuff?

The crux of the issue is that if the user is more likely to use / for non-division purposes, then the abbreviation runs counter to its purpose: it's neither convenient nor time-saving. Of course the user can choose to remove it on their installation (what I’m doing right now), but I believe there’s a precedent where e.g. plus and minus abbreviations were removed for being disruptive as well.

Right now I’m disabling /, *, and e.

@AlexDaniel
Copy link
Author

I see.

@Tyil
Copy link
Contributor

Tyil commented May 2, 2018

@mickk-on-cpp That is correct, I did disable the + and - earlier on for being more often wrong than not. I have been considering to do the same for / and * as these are commonly going wrong for me too. I do like the × variant as well, so maybe I'll look to see if I can get * to only transform into × if it's directly followed by a space.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants