MyGit

vim-utils/vim-troll-stopper

Fork: 4 Star: 177 (更新于 2024-11-03 10:00:58)

license: MIT

Language: Vim Script .

Stop Unicode trolls from messing with your code.

GitHub网址

vim-troll-stopper

Beware, there are (Unicode) trolls out there! Here, take this plugin for protection.

Problem

There are many Unicode characters that are identical or look very similar to one another. Best known example: semicolon (;) and a greek question mark (;).

Trollers (e.g. your coworkers) can exploit this by replacing semicolons with greek question marks in your code (original idea: Peter Ritchie, @peterritchie). There are even tools that help you with this and take it to the next level.

Also, any random code snippet from the internet/stackoverlow can be corrupt.

Demo, a cannonical "hello troll" program:

ⅰnt ⅿain() { рrintf ("Ηello troll!\n"); }

Copy-paste the above code to hello.c file and run $ make hello. Part of the output:

hello.c:1:1: error: unknown type name 'ⅰnt'
ⅰnt ⅿain() { рrintf ("Ηello troll!\n"); }
^

Maybe you'd even start crying if you didn't know the above code is deceitful.

Solution

Vim users should know better than falling for these petty tricks. This plugin highlights troll characters with a red background so you are alerted something is not right.

hello troll program

After you install this plugin, things should just work for any and all filetypes.

Installation

Just use your favorite vim plugin manager.

Features

  • change highlight to custom color (in .vimrc)

      highlight TrollStopper ctermbg = red guibg = #FF0000
    
  • use the :TrollStop command to convert invalid characters to regular ones

License

MIT

最近版本更新:(数据更新于 1970-01-01 00:00:00)

vim-utils/vim-troll-stopper同语言 Vim Script最近更新仓库

2024-10-18 13:12:28 neovim/neovim

2020-06-23 01:05:38 jorinvo/dotfiles

1970-01-01 00:00:00 hit9/dotfiles

1970-01-01 00:00:00 vim/vim

1970-01-01 00:00:00 kaarmu/typst.vim

1970-01-01 00:00:00 jbranchaud/til