Home

Awesome

rime.nvim

pre-commit.ci status github/workflow

github/downloads github/downloads/latest github/issues github/issues-closed github/issues-pr github/issues-pr-closed github/discussions github/milestones github/forks github/stars github/watchers github/contributors github/commit-activity github/last-commit github/release-date

github/license github/languages github/languages/top github/directory-file-count github/code-size github/repo-size github/v

luarocks

Rime for neovim.

Like coc-rime. However, use lua not javascript.

screencast

Dependence

# Ubuntu
sudo apt-get -y install librime-dev librime1
sudo apt-mark auto librime-dev
# ArchLinux
sudo pacman -S librime
# Android Termux
apt-get -y install librime
# Nix
# use nix-shell to create a virtual environment then build
# homebrew
brew tap tonyfettes/homebrew-rime
brew install librime pkg-config
# Windows msys2
pacboy -S --noconfirm pkg-config librime gcc

Install

rocks.nvim

Command style

:Rocks install rime.nvim

Declare style

~/.config/nvim/rocks.toml:

[plugins]
"rime.nvim" = "scm"

Then

:Rocks sync

or:

$ luarocks --lua-version 5.1 --local --tree ~/.local/share/nvim/rocks install rime.nvim
# ~/.local/share/nvim/rocks is the default rocks tree path
# you can change it according to your vim.g.rocks_nvim.rocks_path

Configure

Refer config.lua:

require('rime.nvim').setup({
    -- ...
})

Set keymap:

vim.keymap.set('i', '<C-^>', require('rime.nvim').toggle)

Once it is enabled, any printable key will be passed to rime in any case while any non-printable key will be passed to rime only if rime window is opened. If you want to pass a key to rime in any case, try:

vim.keymap.set('i', '<C-\\>', require('rime.nvim'):callback('<C-\\>'))

It is useful for some key such as the key for switching input schema.

Once you switch to ascii mode of rime, you cannot switch back unless you have defined any hotkey to pass the key for switching ascii mode of rime to rime. Because only printable key can be passed to rime when rime window is closed.

Integration

nvim-cmp

Like cmp-rime:

require('cmp').setup {
  -- ...
  sources = {
    -- ...
    { name = 'rime' }
  }
}

vim-airline

In insert/replace/select/... mode, it will display current input schema name.

You can customize it. Such as:

Only display input schema name in insert mode:

require('rime.nvim').setup({
  get_new_symbol = function (old, name)
    if old == M.airline_mode_map.i
      return name
    end
    return old
  end
})

See airline's g:airline_mode_map to know i, R, s, ...

Disable this feature:

require('rime.nvim').setup({
  update_status_bar = function () end
})

Tips

For Nix user, run /the/path/of/luarocks/rocks-5.1/rime.nvim/VERSION/scripts/update.sh when dynamic link libraries are broken after nix-collect-garbage -d.

Related Projects