Distributions
› Ubuntu
› Fedora
› CentOS
中文资源站
› 网易开源镜像站
scola
V2EX  ›  Linux

怎么在vim在normal 模式下自动禁用 中文

  •  
  •   scola · Oct 12, 2013 · 6567 views
    This topic created in 4780 days ago, the information mentioned may be changed or developed.
    当我在vim 插入模式下 输入中文,
    切换到 normal模式下操作,此时还是中文,命令都运行不了,
    还要手动切换,特别麻烦
    怎么在vim在normal 模式下自动禁用 中文啊
    我使用的ibus google pinyin ,可以使用shift 切换 中英文
    大侠们支支招。
    16 replies  •  1970-01-01 08:00:00 +08:00
    aufula
    aufula
    Oct 12, 2013
    2
    你输完中文怎么换回normal模式,难道不是先切到英文么?
    Aben
    Aben
    Oct 12, 2013 via iPhone❤️1
    3
    yetone
    yetone
    Oct 12, 2013
    4
    @aufula ESC
    scola
    scola
    OP
    Oct 12, 2013
    5
    @jiazhoulvke 我使用的ibus 输入法 不知道能不能用那个

    @Aben 刚才试过了,好像不行,
    painter
    painter
    Oct 12, 2013
    6
    vim怎么在normal 模式下自动禁用 中文
    scola
    scola
    OP
    Oct 12, 2013
    7
    @painter 老兄跟我有同样的需求?
    ybian
    ybian
    Oct 12, 2013
    8
    参考 /t/45772
    不过我那个小程序只在 Mac 下有用,但是改成 Linux 的应该不难。
    Micky
    Micky
    Oct 12, 2013
    9
    用gvim吧
    normal下自动禁用中文。。我忘记是要专门设置还是怎样 反正我现在gvim就是这样的
    aufula
    aufula
    Oct 12, 2013❤️1
    10
    有个挫一点的办法
    au insertLeave :!pkill ibus-daemon<cr>
    au insertEnter :!ibus-daemon &<cr>
    lilydjwg
    lilydjwg
    Oct 12, 2013
    11
    @jiazhoulvke 哇哇,你在这里一贴链接,我那文章就 20 多个访问呢~
    lilydjwg
    lilydjwg
    Oct 12, 2013❤️1
    12
    @aufula 你这…………ibus 可以通过 dbus 关闭和开启的,vim_dev 邮件列表曾经有人给过一个示例。
    scola
    scola
    OP
    Oct 12, 2013
    13
    @aufula 这个我加入到 .vimrc 好像还是不行呢
    aufula
    aufula
    Oct 13, 2013❤️2
    14
    @scola
    @lilydjwg

    function! OnInsertLeave()
    python << EOT
    import ibus
    ff = ibus.bus.Bus()
    ibus.inputcontext.InputContext(ff,ff.current_input_contxt()).disable()
    EOT
    endfunction
    au InsertLeave * :call OnInsertLeave()
    scola
    scola
    OP
    Oct 13, 2013
    15
    @aufula 这次真的可以了,太感谢了。
    这个退出到normal 是直接关闭ibus。不知有没有方法 把 disable 换成 switchtoenglish 就完美了
    congeec
    congeec
    Dec 18, 2013
    16
    se imd
    au InsertEnter * se noimd
    au InsertLeave * se imd
    au FocusGained * se imd

    note: only available when compiled with +xim
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   4064 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 52ms · UTC 09:33 · PVG 17:33 · LAX 01:33 · JFK 04:33
    ♥ Do have faith in what you're doing.