Git Product home page Git Product logo

zfvimim's Introduction

中文用户请戳我

中文用户请戳我

中文用户请戳我

introduction

Input Method by pure vim script, inspired by VimIM

Outstanding features / why another remake:

  • more friendly long sentence match and better predict logic
  • predict from multiple db without switching dbs
  • auto create user word and re-order word priority according to your input history
  • cloud input, auto pull and push your db file from/to Github
  • fetch words from 3rd openapi, asynchronously
  • solve many VimIM's issues:
    • better txt db load performance if executable('python')
    • auto disable and re-enable complete engines when using input method
    • sync input method state acrossing buffers

Why VimIM? Why not system IME?

  • it's a pain to input CJK in ssh env
  • I love inoremap jk <esc> :)

if you like my work, check here for a list of my vim plugins, or buy me a coffee

how to use

minimal config (local db)

  1. recommend env:

    • (optional) vim8 with job or neovim, for better db load performance
    • (optional) executable('python') or executable('python3'), for better db load performance
  2. use Vundle or any other plugin manager you like to install

    Plugin 'ZSaberLv0/ZFVimIM'
    Plugin 'ZSaberLv0/ZFVimJob' " optional, for better db load performance
    
  3. prepare your db files, you may copy the txt db files from db samples to any location

  4. config

    function! s:myLocalDb()
        let db = ZFVimIM_dbInit({
                    \   'name' : 'YourDb',
                    \ })
        call ZFVimIM_cloudRegister({
                    \   'mode' : 'local',
                    \   'dbId' : db['dbId'],
                    \   'repoPath' : '/path/to/repo', " path to the db
                    \   'dbFile' : '/YourDbFile', " db file, relative to repoPath
                    \   'dbCountFile' : '/YourDbCountFile', " optional, db count file, relative to repoPath
                    \ })
    endfunction
    if exists('*ZFVimIME_initFlag') && ZFVimIME_initFlag()
        call s:myLocalDb()
    else
        autocmd User ZFVimIM_event_OnDbInit call s:myLocalDb()
    endif
    

recommend config (cloud db)

  1. recommend env:

    • (optional) git, for db update
    • (optional) vim8 with job or neovim, for better db load performance
    • (optional) executable('python') or executable('python3'), for better db load performance
  2. prepare your db repo according to db samples, or simply fork one of the db samples

  3. go to access tokens to generate your Github access token, and make sure it has push permission to your db repo (check repo in Select scopes)

  4. config your access token according to your db repo, for example, for the db samples:

    let g:zf_git_user_email='YourEmail'
    let g:zf_git_user_name='YourUserName'
    let g:zf_git_user_token='YourGithubAccessToken'
    

    please check the README of each db repo for detail

  5. use Vundle or any other plugin manager you like to install

    Plugin 'ZSaberLv0/ZFVimIM'
    Plugin 'ZSaberLv0/ZFVimJob' " optional, for better db load performance
    Plugin 'ZSaberLv0/ZFVimGitUtil' " optional, cleanup your db commit history when necessary
    Plugin 'YourUserName/ZFVimIM_pinyin_base' " your db repo
    Plugin 'ZSaberLv0/ZFVimIM_openapi' " optional, 3rd IME using Baidu
    

how to use

  • use ;; to toggle input method, and ;: to switch db
  • scroll page by - or =
  • input and choose word by <space> or 0~9
  • choose head or tail word by [ or ]
  • your input history would be recorded locally or push to github automatically, you may use ;, or :IMAdd to add user word, ;. or :IMRemove to remove user word

some tips

  • you may want to add a IME status tip to your :h 'statusline'

    let &statusline='%{ZFVimIME_IMEStatusline()}'.&statusline
    
  • if it's hard to support async mode, you may also:

    • pull and push manually by :call ZFVimIM_download() and :call ZFVimIM_upload()
    • automatically ask you to input git info to push before exit vim, by let g:ZFVimIM_cloudSync_enable=1
  • since db files are pretty personal, the default db only contains single word, words would be created during your usage, if you prefer other choices, see db samples

  • your db repo may contain many commits after long time usage, which may cause a huge .git dir, it's recommended to clean up it occasionally, by:

    • delete and re-create the repo
    • if you have push --force permission, search and see the g:ZFVimIM_cloudAsync_autoCleanup detail config below

detailed

configs

  • let g:ZFVimIM_autoAddWordLen=3*4

    when you choose word and the word's byte length less than this value, we would add the word to db file automatically (ignored when g:ZFVimIM_autoAddWordChecker is set)

  • let g:ZFVimIM_autoAddWordChecker=[]

    list of function to check whether need to add user word

    function! MyChecker(userWord)
        let needAdd = ...
        return needAdd
    endfunction
    let g:ZFVimIM_autoAddWordChecker=[function('MyChecker')]
    

    when any of checker returned 0, we won't add user word

  • let g:ZFVimIM_symbolMap = {}

    used to transform unicode symbols during input

    it's empty by default, typical config for Chinese:

    let g:ZFVimIM_symbolMap = {
                \   ' ' : [''],
                \   '`' : ['·'],
                \   '!' : ['!'],
                \   '$' : ['¥'],
                \   '^' : ['……'],
                \   '-' : [''],
                \   '_' : ['——'],
                \   '(' : ['('],
                \   ')' : [')'],
                \   '[' : ['【'],
                \   ']' : ['】'],
                \   '<' : ['《'],
                \   '>' : ['》'],
                \   '\' : ['、'],
                \   '/' : ['、'],
                \   ';' : [';'],
                \   ':' : [':'],
                \   ',' : [','],
                \   '.' : ['。'],
                \   '?' : ['?'],
                \   "'" : ['‘', '’'],
                \   '"' : ['“', '”'],
                \   '0' : [''],
                \   '1' : [''],
                \   '2' : [''],
                \   '3' : [''],
                \   '4' : [''],
                \   '5' : [''],
                \   '6' : [''],
                \   '7' : [''],
                \   '8' : [''],
                \   '9' : [''],
                \ }
    
    • if you want to change this setting at runtime, you should use call ZFVimIME_stop() | call ZFVimIME_start() to restart to take effect, or, add autocmd to ZFVimIM_event_OnEnable to setup this value

    • it's recommended to add these configs to make vim recognize chinese chars

      set encoding=utf-8
      set fileencoding=utf-8
      set fileencodings=utf-8,ucs-bom,chinese
      
  • keymaps:

    • let g:ZFVimIM_key_pageUp = ['-']
    • let g:ZFVimIM_key_pageDown = ['=']
    • let g:ZFVimIM_key_chooseL = ['[']
    • let g:ZFVimIM_key_chooseR = [']']
  • let g:ZFVimIM_showKeyHint = 16

    whether show key hint after word

    • 0 : do not show
    • 1 : show without length limit
    • >1 : show with specified length limit
  • let g:ZFVimIM_cachePath=$HOME.'/.vim_cache/ZFVimIM'

    cache path for temp files

  • let g:ZFVimIM_cloudAsync_outputTo={...}

    for async cloud input, output log to where (see ZFJobOutput), default:

    let g:ZFVimIM_cloudAsync_outputTo = {
                \   'outputType' : 'statusline',
                \   'outputId' : 'ZFVimIM_cloud_async',
                \ }
    
  • let g:ZFVimIM_cloudAsync_autoCleanup=30

    your db repo may contain many commits after long time usage, we would try to remove all history commits if:

    • have these optional plugins installed:

      Plugin 'ZSaberLv0/ZFVimJob'
      Plugin 'ZSaberLv0/ZFVimGitUtil'
      
    • ZFJobAvailable() returned 1 (i.e. async mode available)

      • we have bundled a default fallback for job, which may cause some unexpected lag, you may enable it by let g:ZFVimIM_cloudAsync_jobFallback = 1
    • g:ZFVimIM_cloudAsync_autoCleanup greater than 0

    • your git rev-list --count HEAD exceeds g:ZFVimIM_cloudAsync_autoCleanup

    NOTE:

    • this require you have git push --force permission, if not, please disable this feature, otherwise your commits may lost occasionally (each time when commits exceeds g:ZFVimIM_cloudAsync_autoCleanup)
  • let g:ZFVimIM_cloudAsync_autoInit=1

    for async cloud input only, when on, we would load db when VimEnter, to reduce the time you first ZFVimIME_start()

functions

  • ZFVimIME_start() ZFVimIME_stop() ZFVimIME_toggle() ZFVimIME_next()

    start or stop, must called during Insert Mode, as <c-r>=ZFVimIME_start()<cr>

  • :IMAdd word key or ZFVimIM_wordAdd(db, word, key)

    manually add word

  • :IMRemove word [key] or ZFVimIM_wordRemove(db, word [, key])

    manually remove word

  • :IMReorder word [key] or ZFVimIM_wordReorder(db, word [, key])

    manually reorder word priority, by reducing it's input history count to a proper value

  • ZFVimIM_complete(key [, option])

    • option

      {
        'sentence' : '0/1, default to g:ZFVimIM_sentence',
        'crossDb' : 'maxNum, default to g:ZFVimIM_crossDbLimit',
        'predict' : 'maxNum, default to g:ZFVimIM_predictLimit',
        'match' : '', // > 0 : limit to this num, allow sub match
                      // = 0 : disable match
                      // < 0 : limit to (0-match) num, disallow sub match
                      // default to g:ZFVimIM_matchLimit
        'db' : {...}, // which db to use, empty for current
      }
      
    • return

      [
        {
          'dbId' : 'match from which db',
          'len' : 'match count in key',
          'key' : 'matched full key',
          'word' : 'matched word',
          'type' : 'type of completion: sentence/match/predict/subMatchLongest/subMatch',
          'sentenceList' : [ // (optional) for sentence type only, list of word that complete as sentence
            {
              'key' : '',
              'word' : '',
            },
          ],
        },
        ...
      ]
      

    note, you may supply your own function named ZFVimIM_complete to override the default one, and use ZFVimIM_completeDefault(key, option) to achieve custom IME complete

functions (for db repo)

  • ZFVimIM_dbInit(option)

    to register a db, option:

    {
      'name' : '(required) name of your db',
      'priority' : '(optional) priority of the db, smaller value has higher priority, 100 by default',
      'switchable' : '(optional) 1 by default, when off, won't be enabled by ZFVimIME_keymap_next_n() series',
      'editable' : '(optional) 1 by default, when off, no dbEdit would applied',
      'crossable' : '(optional) g:ZFVimIM_crossable by default, whether to show result when inputing in other db',
                    // 0 : disable
                    // 1 : show only when full match
                    // 2 : show and allow predict
                    // 3 : show and allow predict and sub match
      'crossDbLimit' : '(optional) g:ZFVimIM_crossDbLimit by default, when crossable, limit max result to this num',
      'dbCallback' : '(optional) func(key, option), see ZFVimIM_complete',
                     // when dbCallback supplied, words would be fetched from this callback instead
      'menuLabel' : '(optional) string or function(item), when not empty, show label after key hint',
                    // when not set, or set to number `0`, we would show db name if it's completed from crossDb
      'implData' : { // extra data for impl
      },
    }
    

    return db object which would stored in g:ZFVimIM_db

  • ZFVimIM_cloudRegister(cloudOption)

    register cloud info, when registered, we would try to pull/push from/to remote repo

    cloudOption:

    {
      'mode' : '(optional) git/local',
      'cloudInitMode' : '(optional) forceAsync/forceSync/preferAsync/preferSync',
      'dbId' : '(required) dbId generated by ZFVimIM_dbInit()'
      'repoPath' : '(required) git/local repo path',
      'dbFile' : '(required) db file path relative to repoPath, must start with /',
      'dbCountFile' : '(optional) db count file path relative to repoPath, must start with /',
      'gitUserEmail' : '(optional) git user email',
      'gitUserName' : '(optional) git user name',
      'gitUserToken' : '(optional) git access token or password',
    }
    

make your own db

  1. supply your db file with this format:

    a 啊 阿
    a 锕
    ai 爱 唉
    ohayou お早う おはようございます
    tang _(:з」∠)_
    haha ^\ ^
    

    key can be a-z, word can be any string (if word contain space, you may escape it by \ )

    save it as utf-8 encoding

  2. format the db file to ensure it's valid

    call ZFVimIM_dbNormalize('/path/to/dbFile')
    

    this may take a long time, but for only once

  3. put the db file to your git repo, according to the db samples below

db samples

FAQ

  • Q: strange complete popup?

    A: we use omnifunc to achieve IM popup, which would conflict with most of complete engines, by default, we would automatically disable complete engines when IM started, if your other plugins conflict with IM, you may disable it manually (see this)

    also, if any strange behaviors occurred, :verbose set omnifunc? to check whether it's changed by other plugins

  • Q: meet some weird problem, how to check log?

    A: use :IMCloudLog to check first, if not enough:

    1. put this in your vimrc: let g:ZFJobVerboseLogEnable = 1
    2. restart vim and reproduce your problem
    3. write log file by: :call writefile(g:ZFJobVerboseLog, 'log.txt')

    WARNING : the verbose log may contain your git access token or password, please verify before posting the log file to public

  • Q: How to use in Command-line (search or command) ?

    A: ZFVimIM can be used inside command-line-window, you may:

    • (in normal mode) use q: or q/ to enter command-line-window

    • (inside command line) use these keymaps to edit in command-line-window:

      function! ZF_Setting_cmdEdit()
          let cmdtype = getcmdtype()
          if cmdtype != ':' && cmdtype != '/'
              return ''
          endif
          call feedkeys("\<c-c>q" . cmdtype . 'k0' . (getcmdpos() - 1) . 'li', 'nt')
          return ''
      endfunction
      cnoremap <silent><expr> ;; ZF_Setting_cmdEdit()
      

      to use it: press ;; while editing in Command-line

  • Q: How to use in :terminal?

    A: since terminal does not support omnifunc, there's no direct way to support in it

    a workaround by command-line-window:

    if has('terminal') || has('nvim')
        function! PassToTerm(text)
            let @t = a:text
            if has('nvim')
                call feedkeys('"tpa', 'nt')
            else
                call feedkeys("a\<c-w>\"t", 'nt')
            endif
            redraw!
        endfunction
        command! -nargs=* PassToTerm :call PassToTerm(<q-args>)
        tnoremap ;; <c-\><c-n>q:a:PassToTerm<space>
    endif
    

    to use it: press ;; while inside :terminal window's Insert-mode

  • Q: external db source?

    A: the ZSaberLv0/ZFVimIM_openapi is a good example, which achieves:

    • using external source to supply db contents
    • async mode
  • Q: lazy db load?

    A: you may manually use these methods to achieve lazy load:

    • register:
      • ZFVimIM_dbInit(...) : register a empty db that can be toggle by ZFVimIME_keymap_toggle_n() or ZFVimIME_keymap_next_n()
    • db load:
      • ZFVimIM_cloudRegister(...) : (recommended) register cloud setting, and would load db content when called
      • ZFVimIM_dbLoad(...) : to load actual db content, can be called separately for split db, new data would be merged to old data
      • g:ZFVimIM_db : (not recommended) manually modify internal db data
  • Q: arrow keys not work?

    A: see this

known issue

  • too slow

    check first: executable('python') or executable('python3') and ZFVimJob is installed and available (you may check them by call ZFVimIM_DEBUG_checkHealth()), without them, the pure vim script fallback is always very slow (about 2 seconds for 200KB db file)

    if your db file is very large, it's slow to save and load db even if executable('python'), because reading and processing large files also takes a long time

    this plugin is designed lightweight that can fallback to pure vimscript, so, there's no plan to completely move db data to python side (further more, async complete popup would break :lmap logic, and require features like LSP plugins, no plan to achieve this too)

    PS: you may want to check ZSaberLv0/ZFVimIM_openapi for how to use external tool to supply db contents

    if you want to benchmark:

    1. let g:ZFVimIM_DEBUG_profile = 1
    2. input freely
    3. call ZFVimIM_DEBUG_profileInfo() to check which step consumed most time

    if issue still occurs, please supply log file before opening issue:

    1. call ZFVimIM_DEBUG_start('/path/to/log')
    2. input freely
    3. call ZFVimIM_DEBUG_stop()
    4. open issue and supply the log file
  • use with LSP plugins

    it's possible, but it's a better design to make a external executable for LSP plugins, not some vimscript like this plugin, so, no plan on this

    if you really want to hack, there's two idea:

    • use ZFVimIM_complete() to get word completion, and supply things like omnifunc for LSP plugins
    • use python or other tools to parse db files and supply LSP plugins
  • can not use in input()

    unfortunately, I've no idea how to make lmap work in input(), and there's no plan to make complex cmap to achieve this

    of course, if you have better solution, PR is always welcomed

zfvimim's People

Contributors

hiberabyss avatar jnpngshiii avatar zsaberlv0 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

zfvimim's Issues

一个奇怪的bug

我的vim是配置了YCM的,写C时使用的补全函数是 ccomplete,切成输入法就是ZFVimIME_omnifunc,一般不会出问题,但是还是会偶尔遇到问题,这问题由来已久,我一直没报就是想找找复现步骤,但是我失败了,只能描述一下现象。

问题发生时状态栏显示当前的模式为-- INSERT (lang) --,当我按下键进行输入时,状态栏显示=ZFVimIME_callOmni(),然后C语言函数补全列表就弹出来了,此时查看omnifunc的值是ccomplete。如果我手动将omnifunc改回去,那就可以继续用。不晓得这是个什么问题。

输入法似乎会干扰vim的搜索操作

首先插入模式下;;开启输入法,然后回到普通模式,然后按/搜搜字符串时,我按下的字母都不显示,除非我在此时再按;;把输入法关掉。请问,这是期望的行为吗?

[BUG] 在从插入模式退出到普通模式时出现意外输入的情况

在使用拼音输入法时,在从插入模式退出到普通模式时,如果按键按的太快,就会出现按键被输入法识别为输入的情况:

演示如下:

我在输入“你好”以后使用esc回到普通模式,随后快速按下dd按键。可以看到的是,我按下的dd没有删除这一行,被识别成了输入。

CleanShot 2023-03-29 at 10 56 41

然而如果在按下esc后,间隔一小会再按下dd键,则不会出现这个问题:

CleanShot 2023-03-29 at 11 01 00

是输入法反应慢了嘛?

不知怎么触发了 Omni 补全后就乱套了

Untitled

如图所示,我也不知道是怎么触发的,这样之后每输入一个字母其实都是在进行补全操作,我的输入不会传递到输入法中。此时如果关闭输入法,再输入就不会有问题。再打开输入法还是有问题。

随着时间推移,插件的反应速度逐渐变慢

vim刚打开时,打字飞快,大概使用10分钟左右,甚至不到,就明显感觉卡顿,下拉列表弹出变慢,空格上屏也卡,不知道为什么。重启vim就又可以了,然后又是一个轮回。

可以再加入对韦大的[apc](https://github.com/skywind3000/vim-auto-popmenu)的切换支持

可以再加入对韦大的apc的切换支持,没测试但是我应该没有写错

function! s:apc_enable()
    if get(g:, 'ZFVimIM_autoDisable_apc', 1) && get(g:, 'apc_enable', 0) == 0
        ApcEnable
    endif
endfunction
function! s:apc_disable()
    if get(g:, 'ZFVimIM_autoDisable_apc', 1) && get(b:, 'apc_enable', 0) == 1
        ApcDisable
    endif
endfunction
call add(s:callback, ['s:apc_enable', 's:apc_disable'])

关闭词频修改和长语句输入

先感谢大佬的插件, 很好用

  1. 我想关闭词频修改, 最好能根据字典里的顺序固定顺序
  2. 我想关闭长句输入, 因为我的字典这样输入可能不太方便, 会有冲突
  3. 次选键能自定义吗

ZFVIM在vim里不能用的问题

和这个有点像,而且我也设置了 autogroup #18
我的环境都是在wsl里
neovim 0.4.4没有问题,正常输入
在vim8.2里,会看到选择框闪一下,马上消失。
然后zfvim就不能正常输入中文文字了。奇怪的是,同样是vim8.2, 有些机器上又是没事的。

当世利器,无出其右,但是感觉可以给项目改个名字

我在知乎看到的,第一反应是这个名字很奇怪,但是还是抱着试一试的心态测试了一把,心里只有一个字“叼”。完美的vimim继承者,比它还强,终于不用一个词一个词的敲了,此外,自动记忆词库实在是太方便了。

使用vim输入法的基本都听过vimim的名字,但这个项目加了个ZF前缀,使用者一眼看上去不知道是做什么的,我觉得vimim2或者vimim-plus之类的名字可能更有意义一些。:smirk:

插入模式下的方向键出现问题

无法正常移动,出现奇怪的字母

$ cat ~/.vimrc
set nocompatible

filetype plugin on

call plug#begin('~/.vim/plugged')
Plug 'ZSaberLv0/ZFVimJob'
Plug 'ZSaberLv0/ZFVimGitUtil'
Plug 'ZSaberLv0/ZFVimIM'
"Plug 'ZSaberLv0/ZFVimIM_openapi' " 百度云输入法
call plug#end()
function! s:myLocalDb()
    let db = ZFVimIM_dbInit({
                \   'name' : 'latex',
                \ })
    call ZFVimIM_cloudRegister({
                \   'mode' : 'local',
                \   'dbId' : db['dbId'],
                \   'repoPath' : '/home/yuanchenpu/Workspace/Tools/latex-words/', 
                \   'dbFile' : '/latex.txt', 
                \   'dbCountFile' : '/latex_count.txt',
                \ })
endfunction
autocmd User ZFVimIM_event_OnDbInit call s:myLocalDb()
let g:ZFVimIM_symbolMap = {
            \   ',' : [''],
            \   '.' : [''],
            \ }
ZFJobAvailable: 1
    vim version: 801
    vim job: 1
    nvim job: 0
python: 1
    python: 1 /usr/bin/python
        Python 2.7.18
    python3: 1 /usr/bin/python3
        Python 3.8.5

希望在vim和nvim的内置terminal模式下,也能用此插件输入中文

这个插件对于解决中文输入的问题是一个非常好的解决方案,vim和nvim的�内置terminal极大地扩大了vim的价值,这是不用多言的.
如果ZFVimIM能在terminal模式下输入中文,将会是很方便的.比如在fbterm下就不必再装中文输入法了,vim+terminal+ZFVimIM的配套能解决并避免很多问题与麻烦.
如果您感觉可以的话,请百忙之中实现一下这个功能,谢谢

隐藏命令行的函数显示

您好,很感谢您做了这个插件,这个解决了很多地方不支持输入法的问题。但是我还是遇到了一点使用层面的问题。
我想在neovide中使用这个插件,因为neovide使用中文输入法似乎有些问题,因此我想借助于这个插件。 但是在使用这个插件时会出现下面这种问题

CleanShot.2023-03-21.at.22.19.44.mp4

neovide有一个比较好看的点是可以让光标在前后所在的位置跳动,但是因为使用这个插件时总会在命令行显示那个函数名称,导致光标一直长距离来回跳动,请问是否可以彻底隐藏中途使用时命令行的信息呢?

输入法和插入模式的切换会导致报错

我有时候在输入法模式下想临时输入几个单词,又不想切回英文模式,于是会在输入单词后后直接敲回车让英文上屏,不知道这种操作在不在设计范围内...这种行为当时没问题,但是后期再切英文模式就会触发一个 bug,复现步骤如下:

  1. vim 打开,进入 insert mode,然后 ;; 切到输入法
  2. 输入几个字母比如 yingwen,直接敲回车让英文上屏
  3. ;; 切回 insert mode
  4. 再输入任意字母键比如 c,报错就出现了
=ZFVimIME_input()
E764: Option 'omnifunc' is not set
Press ENTER or type command to continue

要想让这个问题不出现的话,第三步要再加一次 ;; 才行,也就是说当我连续使用两次 ;;,vim 状态栏显示的模式虽然都是 -- INSERT --,但第一次是假的,第二次才是真的。如果只使用一次 ;; 在假的 -- INSERT -- 下输入就会报错。

这个问题出现之后如果不重启 vim,之后输入法切 insertinsert 切输入法都要使出两次 ;;

不想显示后面的拼音和状态栏信息

image
能不能把上面标出的地方去掉?我之前用的老版本是去掉了后面的拼音的 但是忘记改的是哪里
然后建议每次提交一个版本的时候加上TAG便于追溯

Async `upload` when using `local mode`

Entering Vim and ZFVimIM is fast,
but not when quit Vim.
It seems only when :q ZFVimIM update the pinyin_count.txt which is time consuming.

I installed ZFVimJob, and ZFJobAvailable() is 1.
This is my config file:

https://github.com/suliveevil/ZFVimIM_pinyin/blob/master/plugin/ZFVimIM_pinyin.vim

" config
let g:ZFVimIM_cloudSync_enable=1
let g:ZFVimIM_cloudAsync_autoInit=1
let g:ZFVimIM_cloudAsync_enable=5000
let g:ZFVimIM_cloudAsync_timeout=30000


" path(git/local)
let s:repoPath=expand('<sfile>:p:h:h')
function! s:dbInit()
    let repoPath = s:repoPath
    let dbFile = '/misc/pinyin.txt'
    let dbCountFile = '/misc/pinyin_count.txt'

    let db = ZFVimIM_dbInit({
                \   'name' : 'zh_CN',
                \ })


    call ZFVimIM_cloudRegister({
                \   'mode' : 'local',
                \   'repoPath' : repoPath,
                \   'dbFile' : dbFile,
                \   'dbCountFile' : dbCountFile,
                \   'dbId' : db['dbId'],
                \ })
            
endfunction



augroup ZFVimIM_pinyin_augroup
    autocmd!
    autocmd User ZFVimIM_event_OnDbInit call s:dbInit()
augroup END

repoPath 和 dbFile 拼接成路径的方式不符合直觉

目前的配置,repoPath 最后的 / 不能少,少了 /, 如果 dbFile 的路径前面没有 /,那么拼接成完整路径的时候就出错,这太反直觉了。例如如下的配置是错的:

    call ZFVimIM_cloudRegister({
                \   'mode': 'local',
                \   'dbId' : db['dbId'],
                \   'repoPath' : expand('~/Projects/trial_error'),
                \   'dbFile' : 'pinyin_huge.txt',
                \   'dbCountFile': 'pinyin_huge_count.txt'
                \ })

就是因为 trial_error 后面 或者 pinyin_huge.txt 前面少了反斜杠。

理想的方式,repoPath 指定的路径,加不加反斜杠均可,dbFile 的路径最好前面不加反斜杠,加了反斜杠很违和,好像代表的是 Linux 根目录下的某个目录一样。

这种字符串拼接的活,应该用 os.path.join() 类似的方法去完成,手工来搞,太容易出问题了。

依赖ZFVimJob

最新版本只安装ZFVimIM报丢失ZFJobFuncCallable的错误,之前版本没有问题,可以独立运行。

有没办法输入中文全角符号?

好像输入的符号都是英文的?目前我是直接把全角符号存到字典里来输入,能用是能用就是别扭了点。
不管怎么说,应该是目前vim上最好的输入法,性能完爆vimim,即便arm设备也没延迟。
再见iPad pro。matepad pro + termux + texlive + vimtex,起飞就完事了。

neovim 加载大词库速度太慢了

试了一下你提供的 pinyin_huge.txt 作为 db 文件,我掐表计时,从输入 nvim 命令,到显示 buffer 内容,需要大约 30 秒。

您好,我想要实现一个功能(请指导下)

我想能够每打四个英文字母,就能够自动上屏,而不用自己打回车,如果有多个答案,就不让他自动选择,此时可以用数字来选择,我看了你的代码,也不是很清楚。请指教!

请问如何修改快捷键;;

由于本人经常用f然后按;进行快速搜索下一个。所以想把快捷键修改成别的。是否可以自行配置快捷键?

关于词典库同步的问题

如果我同时在多个机器上使用同一个GitHub仓库做词库,这多个本地仓库能保证互相之间的同步吗,会不会遇到merge冲突,插件会如何自动处理。

保存退出时合并词库太慢

使用本地词库,wq退出时会说merging然后卡住很久,用大规模的词库时尤其明显一点。能否改进一下算法性能呢

第一次加载插件,提示 unknown function: ZFVimIM_dbInit

如题,使用下面的配置文件:

set runtimepath+=/data/haojiedong/.local/share/nvim/plugged/ZFVimIM
set runtimepath+=/data/haojiedong/.local/share/nvim/plugged/ZFVimJob
                                                                     
let db = ZFVimIM_dbInit({
            \   'name' : 'jd_db',
            \ })
call ZFVimIM_cloudRegister({
            \   'mode' : 'local',
            \   'dbId' : db['dbId'],
            \   'repoPath' : expand('~/scratch_dir/'),
            \   'dbFile' : 'pinyin.txt',
            \ })

runtimepath 设置的是两个插件安装的位置,然后使用 nvim -u init.vim 启动,提示: unknown function: ZFVimIM_dbInit。

但是在 nvim 里面,重新 source 这个配置 :so init.vim,就不会报错了。后续可以正常使用 ZFVimIM

Input History didn't work

Is this bind together with cloudinput instead of separated function?
Or I miss some necessary config?

" profile
let g:ZFVimIM_DEBUG_profile = 1


" keymap
let g:ZFVimIM_keymap = 0
nnoremap <expr><silent><Leader>ikm ZFVimIME_keymap_toggle_n()
inoremap <expr><Leader>ikm         ZFVimIME_keymap_toggle_i()
vnoremap <expr><Leader>ikm         ZFVimIME_keymap_toggle_v()
nnoremap <expr><silent><Leader>ijm ZFVimIME_keymap_next_n()
inoremap <expr><Leader>ijm         ZFVimIME_keymap_next_i()
vnoremap <expr><Leader>ijm         ZFVimIME_keymap_next_v()
" nnoremap <expr><silent> ;, ZFVimIME_keymap_add_n()
" inoremap <expr> ;, ZFVimIME_keymap_add_i()
" xnoremap <expr> ;, ZFVimIME_keymap_add_v()

" nnoremap <expr><silent> ;. ZFVimIME_keymap_remove_n()
" inoremap <expr> ;. ZFVimIME_keymap_remove_i()
" xnoremap <expr> ;. ZFVimIME_keymap_remove_v()


" config
let g:ZFVimIM_autoAddWordLen=3*4
let g:ZFVimIM_cachePath=$HOME.'/_vim/.cache' 

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.