Skip to content

About

基于jieba-lua的neovim中文词跳转

Resources

Stars

45 stars

Watchers

1 watching

Forks

Repository files navigation

jieba.nvim

readthedocs 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

screencast

This project provides:

  • a lua binding for cppjieba
  • a neovim plugin for Chinese w/b/e/ge.

Features

  • support count like 3w.
  • flexibility. A library is provided. Even you can realize a w/b/e/gw according to LLM's tokenize algorithm.
  • better performance than pure lua.
  • text object iw and dw, cw, ...

Related Projects

Similar Projects

Install

rocks.nvim

Command style

:Rocks install cppjieba

Declare style

~/.config/nvim/rocks.toml:

[plugins]
"cppjieba" = "scm"

Then

:Rocks sync

or:

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

lazy.nvim

require("lazy").setup {
  spec = {
    { "neo451/jieba.nvim", lazy = false },
  },
}

Binding

local Jieba = require "cppjieba.jieba".Jieba
local jieba = Jieba()
local tokens = jieba:cut "他来到了网易杭研大厦"
print(tokens[#tokens])
-- 大厦

Plugin

Dictionary

By default, it doesn't use any user dictionary. You can:

local Jieba = require "cppjieba.jieba".Jieba
local Motion = require "wordmotion.jieba".Motion
local motion = Motion {
    jieba = Jieba {
        paths = {
            user_dict = "/the/path/of/my/user.dict.utf8"
        }
    }
}
motion:set_keymaps()

HMM

HMM can provide higher precision. You can disable it by:

local motion = Motion {
    jieba = Jieba {
        hmm = false,
    }
}

About

基于jieba-lua的neovim中文词跳转

Resources

Stars

45 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages