History
Article Edit this page Discussion

Spell check of word below cursor

From Vim Tips Wiki

(Redirected from VimTip633)
Jump to: navigation, search

Tip 633 Previous Next Created: January 8, 2004 Complexity: intermediate Author: Anon Version: 6.0


Poor man's grep of spell checking for Unix based systems.

Requires aspell/ispell to be available in path or use full path in map command.

map <A-e> :!echo <cword> \| ispell -d british -a -- <CR>
map <A-d> :!echo <cword> \| ispell -d danish -a -- <CR>

Spell check words in either English or Danish.

[edit] Comments

<A-e> is Alt-e. I've mapped it to ,s:

map ,s :!echo <cword> \| ispell -a -- <CR>

You can append ;read after the pipe to be able to see the actual output from ispell.


My little twist on this:

  • to search the word under the cursor in normal mode:
:nmap sp :!echo <C-r><C-w> \| aspell -a<CR>
  • to search the current visual selection:
:vmap sp y:!echo <C-r>" \| aspell -a<CR>

Now, if you want to check the word under the cursor in Insert mode, you can do:

<Ctrl+O>sp

I'm not sure I like the keystroke "sp" for normal mode, since I use vim's default mapping of "s" (:he s) a lot. this would only conflict if I wanted to "s" and insert something that started with a "p". I'll change it if it becomes a problem for me. You can do the same.


Rate this article:

Share this article:

Hubs Highlights International Sites Wikia messages
Entertainment
Gaming
Cartoons & Comics
Science Fiction
Hobbies
Sports
See all...
Grand Theft Auto Wiki
Doctor Who
Legend of Zelda Wiki
Terminator Wiki
Everquest II Wiki
Mystery Science Theater 3000
German
Spanish
Chinese
Japanese
More...
Wikia is hiring for several open positions
Send this article to a friend
"Spell check of word below cursor"
 
 
Hi!

I thought you'd like this page from Wikia!

http://vim.wikia.com

Come check it out!
Send confirmation