In vim how to map “save” to ctrl-s

前端 未结 4 987
伪装坚强ぢ
伪装坚强ぢ 2020-12-07 15:32

In vim, how can I map \"save\" (:w) to ctrl-s.

I am trying \"map\" the command, but xterm freezes when I press ctrl-

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-07 15:53

    vim

    # ~/.vimrc
    nnoremap  :w # normal mode: save
    inoremap  :wl # insert mode: escape to normal and save
    vnoremap  :w # visual mode: escape to normal and save
    

    zsh (if you use)

    # ~/.zshrc
    # enable control-s and control-q
    stty start undef
    stty stop undef
    setopt noflowcontrol
    

    bash (if you use)

    # ~/.bash_profile or ~/.bashrc
    # enable control-s and control-q
    stty -ixon
    

提交回复
热议问题