ZSaberLv0 / ZFVimIM

vim输入法 / Vim Input Method by pure vim script, support: user word, dynamic word priority, cloud db files
204 stars 14 forks source link
input-method vim-script vimim zfvimim

中文用户请戳我

中文用户请戳我

中文用户请戳我

introduction

Input Method by pure vim script, inspired by VimIM

Outstanding features / why another remake:

Why VimIM? Why not system IME?

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

some tips

detailed

configs

functions

functions (for db repo)

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

known issue