0

I am using vim and latex to produce documents and I have realized that I am making a number of spelling mistakes and in order to correct that I installed vim-lexical plugin. However, nothing seems to happen. I have the following in my .vimrc.

let g:spellfile_URL = 'http://ftp.vim.org/vim/runtime/spell'                                                                                                                         
let g:lexical#spelllang = ['en_us','en_gb','ro_RO']                                                                                                                                  
                                                                                                                                                                                      
augroup lexical                                                                                                                                                                      
  autocmd!                                                                                                                                                                           
  autocmd FileType markdown,mkd call lexical#init()                                                                                                                                  
  autocmd FileType latex call lexical#init()                                                                                                                                         
augroup END 

To make matters a bit more interesting, I have to produce documents in Romanian and English (not at the same time) and I would like a way to highlight spelling mistakes in both languages.

What do I have to do to make this work? I have looked at spelllang documentation but I don't understand it.

Why don't I get any highlights in either English or Romanian with my current setup?

Cheers

1

Not sure about Romanian language. But for English spellchecking you need not install anything. Just make sure that your .vimrc contains the following lines:

" Toggle spell checking on and off with `,s`
let mapleader = ","
nmap <silent> <leader>s :set spell!<CR>

So when you press ,s all mistakes will be highlighted. Place the cursor on the highlighted word and press z= and select the correct word. To get out of spellchecker press ,s again.

Good luck!

3
  • thank you! it works for Romanian too! if you don't mind, do you also know if this can be integrated with something like coc and get spelling suggestions on the fly? am I asking too much?
    – lucian
    Nov 21 '21 at 11:44
  • @lucian try :help spell. The command z= gives suggestions
    – D. Ben Knoble
    Nov 21 '21 at 13:06
  • thank you! i got it now!
    – lucian
    Nov 21 '21 at 13:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.