sponsor Vim development Vim logo Vim Book Ad

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

 script karma  Rating 0/0, Downloaded by 9  Comments, bugs, improvements  Vim wiki

created by
Enno Nagel
 
script type
utility
 
description
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,

and

- an operator mapping gy in normal mode, for example gwip operates on a
  paragraph,
- 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
line

    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.0 2019-07-10 7.0 Enno Nagel Initial upload
ip used for rating: 35.171.183.163

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