diffworld
V2EX  ›  问与答

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

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

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