diffworld
V2EX  ›  问与答

vim 按<Esc>回到 normal 怎么设置成按<Esc>回到 normal 并保存文件

  •  
  •   diffworld · Jan 13, 2017 · 2193 views
    This topic created in 3421 days ago, the information mentioned may be changed or developed.
    如题,之前好像看到过,但是一时间想不起来了,望各位大神指点
    7 replies    2017-01-16 08:50:33 +08:00
    fuxkcsdn
        1
    fuxkcsdn  
       Jan 13, 2017   ❤️ 1
    imap <ESC> <ESC>:w<CR>
    diffworld
        2
    diffworld  
    OP
       Jan 13, 2017
    @fuxkcsdn 谢谢哈 ^_^
    diffworld
        3
    diffworld  
    OP
       Jan 13, 2017
    @fuxkcsdn 你好,这个功能是可以实现的,但是会有一些按键出现乱码,比如按方向键的时候出现 ABCD ,按 Home 键时出现乱码等等,我已经设置了 set nocompatible
    tairan2006
        4
    tairan2006  
       Jan 13, 2017
    这是需要自动保存么? vim 自带了这个功能。。
    diffworld
        5
    diffworld  
    OP
       Jan 14, 2017
    @tairan2006 恩恩。每次退出插入模式时自动保存,这个应该怎么设置呢
    tairan2006
        6
    tairan2006  
       Jan 14, 2017
    @diffworld 自带的是每隔一段时间自动保存。每次修改的话,我也不清楚, github 上有个插件: https://github.com/907th/vim-auto-save

    你可以看一下能否满足需求
    diffworld
        7
    diffworld  
    OP
       Jan 16, 2017
    @tairan2006 谢谢,我已经弄好了, au InsertLeave * write , 我的想法是在推出插入模式时自动保存文件,加上这条配置就弄好了,我就是不想用那么多插件才这么折腾的^_^
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3263 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 49ms · UTC 12:03 · PVG 20:03 · LAX 05:03 · JFK 08:03
    ♥ Do have faith in what you're doing.