Skip to content
Automatic input method switching for vim
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
doc Initial commit Aug 3, 2017
plugin Fix platform detection for macOS Mar 7, 2019
.gitignore Initial commit Aug 3, 2017

⌨️ Barbaric

vim + non-Latin input = pain. Barbaric is the cure.


Normal mode mappings (e.g., h / j / k / l) are all 8-bit ASCII characters. That means that when you want to work on a file in Russian (or Greek or Chinese), you’ve got to switch back to English (or Spanish or German) every time you leave Insert mode.

Barbaric detects which input method is active when you first launch vim, then again any time you leave Input mode, and switches between them for you automatically.

No, I mean why ‘Barbaric’?

From Wikipedia (emphasis mine):

The Greeks used the term barbarian for all non-Greek-speaking peoples, including the Egyptians, Persians, Medes and Phoenicians, emphasizing their otherness, because the language they spoke sounded to Greeks like gibberish represented by the sounds “bar bar bar”....

The Romans adapted the term to refer to anything non-Roman.

Vim doesn’t play nicely with non-Latin scripts; i.e., input languages of non-Roman origin. Ipso facto, this is a plugin for barbarians.

Supported IMEs

  • fcitx

  • ibus

  • macOS (requires xkbswitch-macosx)

    # Install via:
    $ curl -o /usr/local/bin/xkbswitch

If you need support for another IME or input system, consider:

  • built-in support for X11 and MS-Windows IMEs (:help mbyte-XIM / :help mbyte-IME),
  • built-in multi-byte keymaps (:help mbyte-keymap / explained here), or
  • vim-xkbswitch.


There are lots of vim plugin managers out there. I like vim-plug.


Barbaric should work out of the box provided that whenever you launch vim, the active input method is the one you want to use in Normal mode. If that’s not the case, be sure to set the first option in the configuration section below.

Known bugs

On macOS, in certain input methods (notably Chinese and Korean), switching windows away from vim and back can cause xkbswitch to malfunction. The problem is described here.


To change the default behavior of Barbaric, modify the lines below and add them to your .vimrc.

" The input method for Normal mode (as defined by `xkbswitch -g` or `ibus engine`)
let g:barbaric_default = 0

" The scope where alternate input methods persist (buffer, window, tab, global)
let g:barbaric_scope = 'buffer'

" Forget alternate input method after n seconds in Normal mode (disabled by default)
" Useful if you only need IM persistence for short bursts of active work.
let g:barbaric_timeout = -1


The MIT License (MIT)

Copyright © 2017 Ryan Lue

You can’t perform that action at this time.