Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vim-utils/vim-troll-stopper
Stop Unicode trolls from messing with your code.
https://github.com/vim-utils/vim-troll-stopper
Last synced: 3 months ago
JSON representation
Stop Unicode trolls from messing with your code.
- Host: GitHub
- URL: https://github.com/vim-utils/vim-troll-stopper
- Owner: vim-utils
- License: mit
- Created: 2015-10-23T15:58:31.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2022-10-26T20:46:26.000Z (about 2 years ago)
- Last Synced: 2024-05-06T14:35:37.898Z (6 months ago)
- Language: Vim Script
- Homepage:
- Size: 31.3 KB
- Stars: 177
- Watchers: 6
- Forks: 4
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
- Awesome-Unicode - vim-troll-stopper - Stop Unicode trolls from messing with your code. (:collision: Lowercase Transformation Collisions / One-To-Many Case Mappings)
README
# 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](https://github.com/reinderien/mimic) 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](https://github.com/bruno-/hello-trolled):
ⅰ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](hello_troll.png)
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](LICENSE.md)