Input Method by pure vim script, inspired by VimIM
Outstanding features / why another remake:
more friendly long sentence match and sentence predict
auto create user word during input
auto re-order word priority accorrding to your input history
cloud input, auto pull and push your db file from/to Github
if you like my work, check here for a list of my vim plugins
how to use
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
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`
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:
register and supply your db repo and git info (see ZSaberLv0/ZFVimIM_pinyin for how to implement)
(optional) have ZSaberLv0/ZFVimJob installed and ZFJobAvailable(), for async pull and push
(optional) have has('python') or has('python3') support for better save/load performance
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
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:
delete and re-create the repo
if you have push --force permission, use ZSaberLv0/ZFVimGitUtil's :ZFGitHardRemoveAllHistory to remove all history commits, or use g:ZFVimIM_cloudAsync_autoCleanup for short
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
max number of predict when exact match exists, limit this number would let you choose exact match more easily
let g:ZFVimIM_predictLimit = 10
max number of predict, set to -1 for no limit, set to 0 to disable predict, note: predict feature would cause a bit longer loading time when you first enable input method
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
let g:ZFVimIM_cloudAsync_outputTo={...}
for async cloud input, output log to where (see ZFJobOutput), default:
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)
start or stop, must called during Insert Mode, as <c-r>=ZFVimIME_start()<cr>
:IMAdd word key or ZFVimIM_wordAdd(word, key)
manually add word
:IMRemove word [key] or ZFVimIM_wordRemove(word [, key])
manually remove word
:IMReorder word [key] or ZFVimIM_wordReorder(word [, key])
manually reorder word priority, by reducing it's input history count to a proper value
known issue
when used with complete engines (such as coc.nvim) while switching buffers or toggle ZFVimIM, some weird state may occur, you have to quit vim to reset this issue
it's possibly caused by :lmap, but I have no idea how to solve this
please consider create PR if you know how to solve it
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
requirement:
v:version >= 704
, older version may work, but not testedgit
, for db updatevim8
withjob
orneovim
, andPlug 'ZSaberLv0/ZFVimJob'
, for async db updatehas('python')
orhas('python3')
, for better db load performanceuse Vundle or any other plugin manager you like to install
use
;;
to toggle input methoddefault keymaps:
you may disable default keymap by
let g:ZFVimIM_keymap = 0
during input:
-
or=
<space>
or0~9
your input history would be recorded and automatically push to github, see
cloud input
below for more infocloud input
cloud input (minimal recommend config)
fork ZSaberLv0/ZFVimIM_pinyin and use
Plugin 'YourUserName/ZFVimIM_pinyin'
supply your git info (make sure it has
git push
permission)cloud input (detail config)
once configured properly, your db changes would be pushed to Github automatically
requirement:
ZFJobAvailable()
, for async pull and pushhas('python')
orhas('python3')
support for better save/load performanceif it's hard to support async mode, you may also:
:call ZFVimIM_download()
and:call ZFVimIM_upload()
let g:ZFVimIM_cloudSync_enable=1
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 repoNOTE:
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:push --force
permission, use ZSaberLv0/ZFVimGitUtil's:ZFGitHardRemoveAllHistory
to remove all history commits, or useg:ZFVimIM_cloudAsync_autoCleanup
for shortNOTE:
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 consumeif you prefer huge db, here's one: ZSaberLv0/ZFVimIM_pinyin_huge
configs
let g:ZFVimIM_predictLimitWhenMatch = 5
max number of predict when exact match exists, limit this number would let you choose exact match more easily
let g:ZFVimIM_predictLimit = 10
max number of predict, set to
-1
for no limit, set to0
to disable predict, note: predict feature would cause a bit longer loading time when you first enable input methodlet 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
let g:ZFVimIM_cloudAsync_outputTo={...}
for async cloud input, output log to where (see ZFJobOutput), default:
let g:ZFVimIM_cloudAsync_autoCleanup=30
for async cloud input only, we would try to remove all history commits if:
g:ZFVimIM_cloudAsync_autoCleanup
greater than 0git rev-list --count HEAD
exceedsg:ZFVimIM_cloudAsync_autoCleanup
NOTE:
git push --force
permission, if not, please disable this feature, otherwise your commits may lost occasionally (each time when commits exceedsg:ZFVimIM_cloudAsync_autoCleanup
)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
orZFVimIM_wordAdd(word, key)
manually add word
:IMRemove word [key]
orZFVimIM_wordRemove(word [, key])
manually remove word
:IMReorder word [key]
orZFVimIM_wordReorder(word [, key])
manually reorder word priority, by reducing it's input history count to a proper value
known issue
when used with complete engines (such as
coc.nvim
) while switching buffers or toggle ZFVimIM, some weird state may occur, you have to quit vim to reset this issueit's possibly caused by
:lmap
, but I have no idea how to solve thisplease consider create PR if you know how to solve it