yaohunzhanyue / collcetion

6 stars 0 forks source link

ZSaberLv0/ZFVimIM: Vim Input Method by pure vim script, support: user word, dynamic word priority, cloud db filesgithub.com #23

Open yaohunzhanyue opened 4 years ago

yaohunzhanyue commented 4 years ago

ZFVimIM

introduction

Input Method by pure vim script, inspired by VimIM

Outstanding features / why another remake:

if you like my work, check here for a list of my vim plugins

how to use

  1. requirement:

    • v:version >= 704, older version may work, but not tested
    • (optional) git, for db update
    • (optional) vim8 with job or neovim, and Plug 'ZSaberLv0/ZFVimJob', for async db update
    • (optional) has('python') or has('python3'), for better db load performance
  2. use Vundle or any other plugin manager you like to install

    Plugin 'ZSaberLv0/ZFVimIM'
    Plugin 'ZSaberLv0/ZFVimIM_pinyin' " repo that contain db files, see `cloud input (minimal recommend config)`
    
    Plugin 'ZSaberLv0/ZFVimJob' " optional, for async db update
    Plugin 'ZSaberLv0/ZFVimGitUtil' " optional, see `g:ZFVimIM_cloudAsync_autoCleanup`
    
  3. use ;; to toggle input method

    default keymaps:

    nnoremap <expr><silent> ;; ZFVimIME_keymap_toggle_n()
    inoremap <expr> ;; ZFVimIME_keymap_toggle_i()
    vnoremap <expr> ;; ZFVimIME_keymap_toggle_v()
    
    nnoremap <expr><silent> ;: ZFVimIME_keymap_next_n()
    inoremap <expr> ;: ZFVimIME_keymap_next_i()
    vnoremap <expr> ;: 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()
    

    you may disable default keymap by let g:ZFVimIM_keymap = 0

  4. during input:

    • scroll page by - or =
    • input and choose word by <space> or 0~9
  5. your input history would be recorded and automatically push to github, see cloud input below for more info

cloud input

cloud input (minimal recommend config)

  1. fork ZSaberLv0/ZFVimIM_pinyin and use Plugin 'YourUserName/ZFVimIM_pinyin'

    Plugin 'ZSaberLv0/ZFVimIM'
    Plugin 'YourUserName/ZFVimIM_pinyin'
    Plugin 'ZSaberLv0/ZFVimJob'
    Plugin 'ZSaberLv0/ZFVimGitUtil'
    
  2. supply your git info (make sure it has git push permission)

    let g:ZFVimIM_pinyin_gitUserEmail='YourEmail'
    let g:ZFVimIM_pinyin_gitUserName='YourUserName'
    let g:ZFVimIM_pinyin_gitUserToken='YourGithubAccessToken'
    

cloud input (detail config)

once configured properly, your db changes would be pushed to Github automatically

requirement:

if it's hard to support async mode, you may also:

of course, you must have push permission for db repo, feel free to fork the default repo (ZSaberLv0/ZFVimIM_pinyin), or supply your own db repo

NOTE:

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:

NOTE:

the default db (which I personally used) is not huge and complete, because huge db may cause huge loading time (especially when you have no python support), and huge memory consume

if you prefer huge db, here's one: ZSaberLv0/ZFVimIM_pinyin_huge

configs

functions

known issue