Use C/C++ to realize Chinese w/b/e/ge for neovim.
- coc-ci: based on segmentit. Written in nodejs.
- jieba.vim: based on jieba. Written in python. Now they plan to use jieba-rs to speed up by rust.
- jieba.nvim: based on jieba-lua. Written in lua.
- jieba_nvim: based on cppjieba. Written in C++. Stop maintenance. This project is a rewrite of it.
- deno-bridge-jieba: based on deno-jieba. Written in denojs use and wasm.
- vscode-jieba: based on jieba-rs. Written in rust and use wasm. Support Vim mode and Emacs mode.
:Rocks install jieba.nvim
~/.config/nvim/rocks.toml
:
[plugins]
"jieba.nvim" = "scm"
Then
:Rocks sync
or:
$ luarocks --lua-version 5.1 --local --tree ~/.local/share/nvim/rocks install jieba.nvim
# ~/.local/share/nvim/rocks is the default rocks tree path
# you can change it according to your vim.g.rocks_nvim.rocks_path
Be default, add keymaps for b/B/w/W/e/E/ge/gE. you can enable more:
vim.keymap.set("n", "ce", function()
require("jieba.nvim").wordmotion_change_w()
end, { noremap = false, silent = true })
vim.keymap.set("n", "de", function()
require("jieba.nvim").wordmotion_delete_w()
end, { noremap = false, silent = true })
vim.keymap.set("n", "viw", function()
require("jieba.nvim").wordmotion_select_w()
end, { noremap = false, silent = true })
By default, it don't use any user dictionary. You can:
local jieba = require"jieba.nvim.utils"
local jieba_path = jieba.jieba_path
jieba_path.user_dict_path = "/the/path/of/my/user.dict.utf8"
jieba.init(jieba_path)
-- skip default init
jieba.is_init = true
By default, HMM is enabled to provide higher precision. you can disable it to speed up.
local jieba = require"jieba.nvim.utils"
jieba.hmm = false