aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bundle/spellcycle/autoload/spellcycle.vim16
-rw-r--r--bundle/spellcycle/plugin/spellcycle.vim11
2 files changed, 27 insertions, 0 deletions
diff --git a/bundle/spellcycle/autoload/spellcycle.vim b/bundle/spellcycle/autoload/spellcycle.vim
new file mode 100644
index 0000000..6f4b703
--- /dev/null
+++ b/bundle/spellcycle/autoload/spellcycle.vim
@@ -0,0 +1,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
diff --git a/bundle/spellcycle/plugin/spellcycle.vim b/bundle/spellcycle/plugin/spellcycle.vim
new file mode 100644
index 0000000..9ae3bfe
--- /dev/null
+++ b/bundle/spellcycle/plugin/spellcycle.vim
@@ -0,0 +1,11 @@
+if exists('g:loaded_spellcycle')
+ finish
+endif
+let g:loaded_spellcycle = 1
+
+
+nnoremap <silent> <Plug>spellcycle_Left :<c-u>call spellcycle#Cycle(-1)<cr>
+nnoremap <silent> <Plug>spellcycle_Right :<c-u>call spellcycle#Cycle(1)<cr>
+
+nmap [l <Plug>spellcycle_Left
+nmap ]l <Plug>spellcycle_Right