“Minimizing” vertical VIM window splits

前端 未结 3 1311
孤街浪徒
孤街浪徒 2021-02-15 14:34

I use horizontal and vertical window splits in religiously in VIM and up until recently, I enjoyed the comfort of two commands to effectively hide (or minimize) my horizontal sp

3条回答
  •  渐次进展
    2021-02-15 15:19

    First up, you won't be able to use and like you want to. Like this:

    set winminwidth=0
    nmap  h500>             
    nmap  l500>               
    

    The common leader keys in vim are comma and back-slash:

    :let mapleader = ","
    

    But you'll find that this gets annoying to require 3 keystrokes for this, so you might as well just drop the control key stroke. This way (if your leader is comma) you can just press ",h" and ",l" to go to the splits to your left and right:

    set winminwidth=0
    nmap h h500>             
    nmap l l500>       
    
    " (FTW) :D
    

    ...

    A guy named Tony Chapman answers why you can't use control + shift:

    Vim maps its Ctrl+printable_key combinations according to ASCII. This means that "Ctrl+lowercase letter" is the same as the corresponding "Ctrl+uppercase letter" and that Ctrl+ (where is a printable key) is only defined when is in the range 0x40-0x5F, a lowercase letter, or a question mark. It also means that Ctrl-[ is the same as Esc, Ctrl-M is the same as Enter, Ctrl-I is the same as Tab.

    So yes, Ctrl-s and Ctrl-S (i.e. Ctrl-s and Ctrl-Shift-s) are the same to Vim. This is by design and is not going to change.

提交回复
热议问题