Wikia

Vim Tips Wiki

Using Ispell on a highlighted region

Talk0
1,613pages on
this wiki
Revision as of 08:35, September 28, 2008 by JohnBot (Talk | contribs)

This tip is deprecated for the following reasons:

We have :spell now

Tip 172 Printable Monobook Previous Next

created December 3, 2001 · complexity basic · author Carl Mueller · version 6.0


Suppose you would like to use Ispell to check a word or region that you've visually highlighted. The following macro will do the job. Just type Shift-Insert while in visual mode.

vnoremap <S-Insert> <C-C>`<v`>s<Space><Esc>mq:e ispell.tmp<CR>i<C-R>"<Esc>:w<CR>:! xterm -bg ivory -fn 10x20 -e ispell %<CR><CR>:e %<CR><CR>ggVG<Esc>`<v`>s<Esc>:bwipeout!<CR>:!rm ispell.tmp*<CR>`q"_s<C-R>"<Esc>

This is based on Chip Campbell's macro which uses Ispell on the whole file (in normal mode).

noremap <S-Insert> :w<CR>:! xterm -bg ivory -fn 10x20 -e ispell %<CR><Space>:e %<CR><Space>

Comments

 TO DO 
Vim 7 has built-in spell checking. Some external programs might be worthwhile, but the tips relating to this topic need to be updated and merged, with information on Vim's spelling features. See the "Todo list" in the side panel.


If you replace the xterm/ispell part with:

c:\winnt\system32\command.com /c ispell %"

The tip will work with ispell on windows 2000. Command.com is required as cmd.exe does not support ANSI.sys (see ispell docs for more info).


Around Wikia's network

Random Wiki