/vim-unicoder

(fork of) unicoder.vim: easy unicode characters in insert mode with abbreviations

Primary LanguageVim scriptMIT LicenseMIT

(fork of) unicoder.vim

Insert cool unicode characters while in insert mode just by typing LaTeX and Agda Mode inspired abbreviations.

Screencast

Slower version (asciicast)

Table of contents

  1. Installation
  2. Usage
  3. List of abbreviations
  4. Completion

Installation

vim-unicoder may be installed by any of your favourite plugin managers. Be it Pathogen, Vundle or Plug, use whichever you prefer.

For example, when using with Plug:

Plug 'arthurxavierx/vim-unicoder'

Usage

vim-unicoder makes it easy to insert unicode characters in Vim buffers. By using Vim's native abbreviations, it's possible, for instance, to just type \int x\^n (and press space, any other separator or <C-]> after the n) and the text becomes ∫ xⁿ as you write it.

Limitations

Because this plugin uses Vim's native abbreviations, it has some limitations, though. Please, be aware of them before submitting issues to this project.

The abbreviations here defined do tightly depend on the value of the iskeyword setting, which varies according to the file type. Some abbreviations here defined will not work with file types that define conflicting keywords.

Also, regarding the insertion and replacement of the abbreviations, some abbreviations will not work if there are special characters right before them. This section of Vim's help file on :h abbreviations explains this limitation:

The characters before the cursor must match the abbreviation.  Each type has
an additional rule:

full-id	  In front of the match is a non-keyword character, or this is where
the line or insertion starts.  Exception: When the abbreviation is
only one character, it is not recognized if there is a non-keyword
character in front of it, other than a space or a tab.

end-id	  In front of the match is a keyword character, or a space or a tab,
or this is where the line or insertion starts.

non-id	  In front of the match is a space, tab or the start of the line or
the insertion.

Global options

Name Default Description
g:unicoder_command_abbreviations 1 Have these abbreviations work in the command and search lines.
g:unicoder_exclude_filetypes ['tex', 'latex', 'plaintex'] File types in which these abbreviations will not work.

List of abbreviations

Greek letters

Uppercase greek

Abbreviations Character
\GA \Alpha Α
\GB \Beta Β
\GG \Gamma Γ
\GD \Delta Δ
\GE \Epsilon Ε
\GZ \Zeta Ζ
\GH \Eta Η
\GTH \Theta Θ
\GI \Iota Ι
\GK \Kappa Κ
\GL \Lambda Λ
\GM \Mu Μ
\GN \Nu Ν
\GX \Xi Ξ
\GO \Omicron Ο
\GP \Pi Π
\GR \Rho Ρ
\GS \Sigma Σ
\GT \Tau Τ
\GU \Upsilon Υ
\GF \Phi Φ
\GC \Chi Χ
\GPS \Psi Ψ
\GW \Omega Ω

Lowercase greek

Abbreviations Character
\ga \alpha α
\gb \beta β
\gg \gamma γ
\gd \delta δ
\ge \epsilon ε
\gz \zeta ζ
\gh \eta η
\gth \theta θ
\gi \iota ι
\gk \kappa κ
\gl \lambda λ
\gm \mu μ
\gn \nu ν
\gx \xi ξ
\go \omicron ο
\gp \pi π
\gr \rho ρ
\gs \sigma σ
\gt \tau τ
\gu \upsilon υ
\gf \phi φ
\gc \chi χ
\gps \psi ψ
\gw \omega ω

Shapes

Abbreviations Character
\box
\bbox
\sbox
\sbbox
\square
\bsquare
\ssquare
\sbsquare
\diamond
\bdiamond
\lozenge
\circle
\bcircle
\dcircle
\triangle
\btriangle
\skull
\danger
\radiation
\biohazard
\yinyang
\frownie
\smiley
\blacksmiley
\sun
\rightmoon
\leftmoon
\female
\male

Miscellaneous

Abbreviations Character
\dagger
\ddager
\prime
\second
\third
\fourth
\euro

Math symbols

Abbreviations Character
\pm ±
\mp
\sum
\prod
\coprod
\qed
\ast
times ×
\div ÷
\bullet
\o \comp \circ
\. \cdot
\:
\::
\sqrt
\sqrt3
\sqrt4
\inf
\propto
\pitchfork
\all \forall
\ex \exists
\nex \nexists

Brackets

Abbreviations Character
\lceil
\rceil
\lfloor
\rfloor
\langle
\rangle
\llens
\rlens
\[[
\]]

Set theory

Abbreviations Character
\empty \emptyset
\in
\notin
\cap \inters
\cup \union
\subset
\supset
\nsubset
\nsupset
\subseteq
\supseteq
\nsubseteq
\nsupseteq

Lattices

Abbreviations Character
\sqsubset
\sqsupset
\sqsubseteq
\sqsupseteq
\sqcap
\sqcup

Logic

Abbreviations Character
\land \and
\lor \or
\lnot \not \neg ¬
\top
\bot
\multimap \-o
\multimapinv \invmultimap
\parr \invamp
\therefore
\because

Calculus

Abbreviations Character
\grad \nabla
\partial 𝜕
\inc \increment
\int
\iint
\iiint
\oint
\oiint
\oiiint

Equalities

Abbreviations Character
\sim \~
\nsim \~n
\simeq \=~
\nsimeq \=~n
\cong \iso \==~
\ncong \niso \==~n
\approx \~2
\napprox \~2n
\neq \=n \!= \/=
\equiv \===
\nequiv \===n
\Equiv

Inequalities

Abbreviations Character
\leq \<=
\nleq \<=n
\geq \>=
\ngeq \>=n
\ll \<< «
\lll
\gg \>> »
\ggg

Entailment (turnstiles)

Abbreviations Character
\ent \entails \vdash \|-
\nent \nentails \nvdash \|-n
\dashv \-|
\models \vDashh \|=
\nvDash \|=n
\Vdash \||-
\nVdash \||-n
\VDash \||=
\nVDash \||=n
\Vvdash \|||-

Circled operators

Abbreviations Character
\oplus \o+
\ominus \o-
\otimes \ox
\oslash \o/
\odot \o.
\ocirc \oo
\oast \o*
\oequal \o=

Boxed operators

Abbreviations Character
\boxplus \bplus \b+
\boxminus \bminus \b-
\boxtimes \btimes \bx
\boxdot \bdot \b.

Dots

Abbreviations Character
\ldots \...
\cdots
\vdots
\iddots
\ddots

Arrows

Simple arrows

Abbreviations Character
\mapsto
\to \arrow \rarrow \rightarrow \->
\larrow \leftarrow \<-
\uarrow \uparrow \-^ \-!
\darrow \downarrow \-v
\lrarrow \leftrightarrow
\udarrow \updownarrow \^-v \!-v
\nwarrow
\nearrow
\searrow
\swarrow

Double arrows

Abbreviations Character
\To \Arrow \Rarrow \Rightarrow \=>
\Larrow \Leftarrow \=<
\Uarrow \Uparrow \=^ \=!
\Darrow \Downarrow \=v
\Lrarrow \Leftrightarrow
\Udarrow \Updownarrow \^=v \!=v
\Nwarrow
\Nearrow
\Searrow
\Swarrow

Sets

Abbreviations Character
\Bool \Bools \Boolean \Booleans \bb 𝔹
\Ints \Integers \bz
\Rats \Rationals \bq
\Reals \br
\Comps \Complex \Complexes \bc
\Quats \Quaternions \bh
\Primes \bp

Fractions

Abbreviations Character
\frac14 ¼
\frac12 ½
\frac34 ¾
\frac13
\frac23
\frac15
\frac25
\frac35
\frac45
\frac16
\frac56
\frac18
\frac38
\frac58
\frac78

Subscripts

Abbreviations Character
\_a
\_e
\_h
\_i
\_j
\_k
\_l
\_m
\_n
\_o
\_p
\_r
\_s
\_t
\_u
\_v
\_x
\_0
\_1
\_2
\_3
\_4
\_5
\_6
\_7
\_8
\_9
\_+
\_-
\_=
\_(
\_)

Superscripts

Abbreviations Character
\^a
\^b
\^c
\^d
\^e
\^f
\^g
\^h ʰ
\^i
\^j ʲ
\^k
\^l ˡ
\^m
\^n
\^o
\^p
\^r ʳ
\^s ˢ
\^t
\^u
\^v
\^w ʷ
\^x ˣ
\^y ʸ
\^z
\^A
\^B
\^D
\^E
\^G
\^H
\^I
\^J
\^K
\^L
\^M
\^N
\^O
\^P
\^R ᴿ
\^T
\^U
\^V
\^W
\^0
\^1 ¹
\^2 ²
\^3 ³
\^4
\^5
\^6
\^7
\^8
\^9
\^+
\^-
\^=
\^(
\^)

Circled

Circled numbers

Abbreviations Character
\(0)
\(1)
\(2)
\(3)
\(4)
\(5)
\(6)
\(7)
\(8)
\(9)
\(10)
\(11)
\(12)
\(13)
\(14)
\(15)
\(16)
\(17)
\(18)
\(19)
\(20)

Uppercase circled

Abbreviations Character
\(A)
\(B)
\(C)
\(D)
\(E)
\(F)
\(G)
\(H)
\(I)
\(J)
\(K)
\(L)
\(M)
\(N)
\(O)
\(P)
\(Q)
\(R)
\(S)
\(T)
\(U)
\(V)
\(W)
\(X)
\(Y)
\(Z)

Lowercase circled

Abbreviations Character
\(a)
\(b)
\(c)
\(d)
\(e)
\(f)
\(g)
\(h)
\(i)
\(j)
\(k)
\(l)
\(m)
\(n)
\(o)
\(p)
\(q)
\(r)
\(s)
\(t)
\(u)
\(v)
\(w)
\(x)
\(y)
\(z)

Font Awesome

For a full list see Font Awesome. Those abbreviations start with a backtick. Completion uses fuzzy matching.

Unicode emojis

For a full list see Unicode emojis. Those abbreviations start with a backtick. Completion uses fuzzy matching.

Completion

A user completion function (^X^U) has been defined that shows the available abbreviations. Note that for the Font Awesome and Unicode Emojis, fuzzy matching on the character name is used.