aboutsummaryrefslogtreecommitdiffstats
path: root/bundle/spellcycle/autoload
diff options
context:
space:
mode:
Diffstat (limited to 'bundle/spellcycle/autoload')
-rw-r--r--bundle/spellcycle/autoload/spellcycle.vim16
1 files changed, 16 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