GitXplorerGitXplorer
r

vim-barbaric

public
208 stars
15 forks
4 issues

Commits

List of commits on branch master.
Verified
bb4bef87417fc3ad92319f556f02d6658b401288

bfx: Fix "No such variable" error in config setup (#18)

rrlue committed 4 years ago
Unverified
2cd3626e16183ca6bc308f5966a7aaf6059d7ea1

avoid read an undefined variable

ggo0d1uck committed 4 years ago
Unverified
0cbae06a57cfa882e56a62d600389bbd6931cf22

avoid read an undefined variable

ggo0d1uck committed 4 years ago
Unverified
6654e518b13ab62c71b9506c76760cc938705c61

Remove unused autocmd events (closes #11)

rrlue committed 5 years ago
Unverified
eb559109085a3541fabb80294cd531b00b8610b4

doc: Add IM-switch latency troubleshooting

rrlue committed 5 years ago
Unverified
5584b76733a6dde82243a63de77aedf965e6e72d

ftr: Support fcitx5

rrlue committed 5 years ago

README

The README file for this repository.

⌨️ Barbaric

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

Why?

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

  • macOS (requires xkbswitch-macosx)

    # Install via:
    $ curl -o /usr/local/bin/xkbswitch https://raw.githubusercontent.com/myshov/xkbswitch-macosx/master/bin/xkbswitch
  • fcitx

  • ibus

  • xkb-switch

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.

Installation

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

Usage

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.

Configuration

Barbaric does its best to work out of the box with zero configuration. To change its default behavior, modify the lines below and add them to your .vimrc.

" The IME to invoke for managing input languages (macos, fcitx, ibus, xkb-switch)
let g:barbaric_ime = 'fcitx'

" The input method for Normal mode (as defined by `xkbswitch -g`, `ibus engine`, or `xkb-switch -p`)
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 fcitx-remote binary (to distinguish between fcitx and fcitx5)
let g:barbaric_fcitx_cmd = 'fcitx5-remote'

" The xkb-switch library path (for Linux xkb-switch users ONLY)
let g:barbaric_libxkbswitch = $HOME . '/.local/lib/libxkbswitch.so'

Troubleshooting

  • Some users have reported latency between leaving insert mode and the automatic switching of input methods (#9, #15, and this comment). If you experience this problem, try this:

    " .vimrc
    
    set ttimeoutlen=0

License

The MIT License (MIT)

Copyright © 2017 Ryan Lue