Mapping -Arrows to selecting characters/lines

前端 未结 8 1111
再見小時候
再見小時候 2020-12-29 03:55

I started to use vim recently, but I miss the character/line selection methods from other text editors. By default vim maps ,

8条回答
  •  梦谈多话
    2020-12-29 04:53

    There's an specific option for this: keymodel:

    'keymodel' 'km'     string  (default "")
                global
                {not in Vi}
        List of comma separated words, which enable special things that keys
        can do.  These values can be used:
           startsel Using a shifted special key starts selection (either
                Select mode or Visual mode, depending on "key" being
                present in 'selectmode').
           stopsel  Using a not-shifted special key stops selection.
        Special keys in this context are the cursor keys, , ,
         and .
        The 'keymodel' option is set by the |:behave| command.
    

    TL;DR: To enable the behavior you want, use:

    set keymodel=startsel
    

    If you also want to leave visual mode when using or without pressed, you can use:

    set keymodel=startsel,stopsel
    

提交回复
热议问题