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

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

Closed cauphenuny closed 3 years ago

cauphenuny commented 3 years ago

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

$ 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
ZSaberLv0 commented 3 years ago

"光标移动键" 是指什么? 上下左右? 并没有动到这玩意儿, 照理应该没有影响, 能否截个图?

cauphenuny commented 3 years ago

https://i.loli.net/2021/05/16/T63OBph4bLMxfed.png 这是之前的 https://i.loli.net/2021/05/16/mrtjzpZO3oB8PTI.png 按了键盘的“左”键之后

似乎是按了非打印字符就会出问题

ZSaberLv0 commented 3 years ago

图打不开

方向键出现奇怪字符, 感觉像 terminal 或 encoding 的问题, 比如曾经见过 putty 某些情况下左方向键会变成 ^[[D 有试过换个 terminal, 或者用 gvim 么? 以及 set encoding=utf-8

cauphenuny commented 3 years ago

这是图
https://i.loli.net/2021/05/16/T63OBph4bLMxfed.png
https://i.loli.net/2021/05/16/mrtjzpZO3oB8PTI.png

设置了 encoding=utf-8
gvim下正常,但是用gnome-terminal 和 xfce4-terminal 以及 xterm 就会出现问题.

ZSaberLv0 commented 3 years ago

https://vim.fandom.com/wiki/Fix_arrow_keys_that_display_A_B_C_D_on_remote_shell

试试这个? 我用这个有效果:

inoremap <ESC>oA <up>
inoremap <ESC>oB <down>
inoremap <ESC>oC <right>
inoremap <ESC>oD <left>
inoremap <ESC>OA <up>
inoremap <ESC>OB <down>
inoremap <ESC>OC <right>
inoremap <ESC>OD <left>

这种应该是 vim 和 terminal 之间的特殊字符的问题

话说 inoremap <c-k> <up> 不香么? 为什么要用方向键

cauphenuny commented 3 years ago

谢谢!问题解决了
我配了 inoremap <c-l> <Del> ,而且 <c-j> <c-h> 被占用了,配方向键不太舒服