vim + neocomplete, how to define shortcut to change default dictionary

588 Views Asked by At

I started to use vim a month back and know I am trying to customize it by installing packages and modifying vimrc.

I am writing texts in more languages I and would like to have autocomplete in all of them. In neocomplete plugin I can define path to my dict as below. I would like to map a key to a procedure that changes the dictionary used by neocomplete (toggling throug several is optimal, but more key shortcuts are fine as well). It would probably need to change path to the dictionary somehow. I.e text:mydict.txt => text:mydict2.txt

I found how to change standard dictionary (map something to "set dictionary") but I have no clue how to this in this case. Any help greatly appreciated.

let g:neocomplete#sources#dictionary#dictionaries = {
    \'default' : '',
    \'text' :'mydict.txt',
    ........

\}
1

There are 1 best solutions below

0
jimmy On

as example,in your .vimrc write down the follow lines

map <F8> :call ChangeMyDic()<cr>
function! ChangeMyDic()
let g:neocomplete#sources#dictionary#dictionaries = {
    \'default' : '',
    \'text' :'mydict.txt',"your target dictionary"
    ........

\}
endfunc