aboutsummaryrefslogtreecommitdiffstats
path: root/bundle/spellcycle/autoload/spellcycle.vim
blob: 6f4b703758d19dabfee5774b7ad5fca5bb75ecbe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
" Cycle
" Cycle the 'spelllang' option through a set of languages. The `direction`
" argument specifies whether to move left or right (and how much to move) in
" the list.
"
" Derived from `CycleLang` as written by kev here:
" http://stackoverflow.com/questions/12006508/vim-how-to-cycle-through-a-list-of-options-using-the-same-key/12006781#12006781
function! spellcycle#Cycle(direction)
	let languages = ['en', 'fr']

	let i = index(languages, &spelllang)
	let cycled_index = (i + a:direction) % len(languages)
	let &spelllang = languages[cycled_index]

	set spelllang?
endfunction