Vim logo vim online Vim Book Ad

basic Tip #172: Using Ispell on a highlighted region

 tip karma   Rating 4/3, Viewed by 760 

created:   December 3, 2001 8:25      complexity:   basic
author:   Carl Mueller      as of Vim:   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>

Carl Mueller

 rate this tip  Life Changing Helpful Unfulfilling 

<<Do you know the "g/" and "g?" commands? | Switch between splits very fast (for multi-file editing) >>

Additional Notes

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 [email protected] after searching the archive. Help Bram help Uganda.
SourceForge Logo