VIM :set list! as a toggle in .vimrc

后端 未结 3 521
误落风尘
误落风尘 2021-02-08 05:57

Is there any way in my .vimrc file to use the command set list! with a keybind like F3 so it functions like this paste toggle set pastetoggle=

3条回答
  •  轮回少年
    2021-02-08 06:59

    This is the mapping for normal mode, visual+select mode, and operator-pending mode (e.g. after typing d):

    noremap  :set list!
    

    The nice thing about the function keys (vs. ) is that they can also be mapped in insert mode:

    inoremap  :set list!
    

    To be complete, you could also create a map for command-line mode:

    cnoremap  :set list!
    

    Read more about the various mapping modes at :help map-modes

提交回复
热议问题