Reputation: 34443
How can I enable spell checking to be automatically enabled in the .vimrc file? Perhaps there's a way to define a quick shortcut that would toggle it instead.
Better yet, is possible to enable it for certain file extensions only?
Upvotes: 19
Views: 9976
Reputation: 1677
This is similar to Xavier T.'s answer but will spell-check the local buffer only, specify the language or region, and set the toggle to F5. Put the following in ~/.vimrc
:map <F5> :setlocal spell! spelllang=en_us<CR>
You can also use en_au
, en_ca
, en_gb
, etc.
Upvotes: 2
Reputation: 419
For only certain file extensions, you can use the autocommands in Vim:
au BufRead *.txt setlocal spell
Upvotes: 22
Reputation: 42218
To quickly toggle spelling on and off, you can use the following mapping:
nmap <silent> <leader>s :set spell!<CR>
Spell check tends to slow down the loading of big files.
Upvotes: 6
Reputation: 392931
:e $MYVIMRC
append a line:
setglobal spell spelllang=en_us
(or similar)
:w|source %
Profit
Upvotes: 2