sponsor Vim development Vim logo Vim Book Ad

vim-unicode-homoglyphs : Highlight and normalize unicode homoglyphs in Vim.

 script karma  Rating 1/1, Downloaded by 138  Comments, bugs, improvements  Vim wiki

created by
Enno Nagel
script type
Every once in a while one pastes a (markup) code or prose from the internet
into Vim and is at loss why it does not compile or render as meant to; this
plug-in offers a hint and a solution by providing

- highlighting of Unicode Homoglyphs, characters (among them many white
  spaces) that only appear like ASCII characters but are not, and
- the normal mode mapping cu to toggle it,


- an operator mapping gy in normal mode, for example gwip operates on a
- a mapping gyy (and gygy) in normal mode that operates on a single line,
- a mapping gy that operates on the visual selection, and
- a command NormalizeHomoglyphs that operates on given range (equal to the
  whole buffer if unspecified)

that normalize Unicode Homoglyphs.

# Usage

For example, hitting gyip on


turns it into


# Configuration

To disable highlighting of Unicode Homoglyphs by default, add to your vimrc the

    let g:is_homoglyph_on = 0

To change mappings, for example, to use zy instead of gy and zu instead of cu,
add the lines

    nmap zy <plug>(NormalizeHomoglyphs)
    xmap zy <plug>(NormalizeHomoglyphs)

    nmap zu <plug>(HighlightHomoglyphs)

to your vimrc.

# Related

For more convenient version control of prose, see the Vim plug-in
vim-sentence-chopper that puts each sentence onto a single line.

# Issues

vim-unicode-homoglyphs is developed at https://github.com/Konfekt/vim-unicode-homoglyphs where issues can be filed.
install details
Unzip vim-unicode-homoglyphs.zip into  ~/.vim on Linux or %USERPROFILE%\vimfiles on Windows.

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
vim-unicode-homoglyphs.zip 1.2 2019-09-18 6.0 Enno Nagel correct initialisation
vim-unicode-homoglyphs.zip 1.1 2019-09-02 6.0 Enno Nagel add homoglyphs and streamline code
vim-unicode-homoglyphs.zip 1.0 2019-07-10 7.0 Enno Nagel Initial upload
ip used for rating:

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
OSDN.net Logo