Blob


1 UNIX is all about files and programs that do one thing and to it well,
2 right? `vi(1)` is one of my favorite text editors. However it lacks
3 some feature: but here's where the *composition* shines.
5 It's stupid and dead-simple actually, but I haven't thought
6 about it until some weeks ago. With a simple
8 ```vi
9 map « :w^M:!aspell -c %^M:e!^M^M
10 ```
12 in your `~/.nexrc` it's simple to do spell checking in `vi`.
14 **Friendly remainder**: the `^M` is literally the *enter* key inserted
15 with `C-v ENTER` or `C-v C-m`.
17 I've also the following binding in my `~/.nexrc` to spell check
18 Italian text:
20 ```vi
21 map » :w^M:!aspell --lang=it -c %^M:e!^M^M
22 ```
24 ### What's that gibberish?
26 OK, it may be non-obvious what that that mapping does, so let's split
27 it into pieces:
29 - `map «` starts a mapping on the `«` key
30 - `:w^M` writes the current file (the return is necessary to *enter* the command)
31 - `:!aspell -c %^M` run aspell over the file (`%` is replaced with the current file name)
32 - `:e!^M` force vi to re-read the file
33 - `^M` Tell vi to render the editor. After a command execution vi doesn't render its interface. Rather, it wait (a bit like `ex`) for a command.
35 ### Why the `«` and `»` characters?
37 Those keys aren't bind to anything and are simple to type with my keyboard layout.