0

I have two vertically splited windows.

enter image description here

I see from Ctrl+W s not splitting windows in Vim that Ctrl-W-| should resize the window. But it does not. Actually, nothing happens.

If I manually resize the window and then press Ctrl-W-=, then it splits window on two equal parts back.

enter image description here

help CTRL-W says:

CTRL-W_bar  CTRL-W |       set window width to N columns

I'm a bit confused because of bar. What does it mean? And the question is, why Ctrl-W-| does not work and is there any other options?

6
  • 2
    @Quasímodo thank you for your feedback! i added extra description. Hope it makes a bit more sense what i mean.
    – Anthony
    Commented Oct 30, 2020 at 20:03
  • 1
    It does, it is a legit question
    – Quasímodo
    Commented Oct 30, 2020 at 20:06
  • 2
    Welcome to Vi and Vim! I'm a bit lost here... Note that CTRL-W | involves separate keystrokes. First press "w" while holding the Control key (that's the CTRL-W part), then release the control key and press | (which typically means holding the Shift key while pressing backslash, at least on an English/American QWERTY keyboard.) Is that the sequence that you're typing? This command CTRL-W | should maximize the width of the current window. That looks like what you have on your screenshot at the bottom. Is that after that keystroke? CTRL-W = should get you back to the one at the top.
    – filbranden
    Commented Oct 30, 2020 at 20:31
  • 2
    And "bar" is how one would describe the | key or | symbol. It's a bar. The Vim help docs refer to it as "bar", mostly since the | character can be considered as a special character in some contexts, so it tries to use a textual description for indexing commands that include it...
    – filbranden
    Commented Oct 30, 2020 at 20:33
  • 1
    @filbranden thank you! exactly, i just figured this out with Qausimodo couple minutes ago:)
    – Anthony
    Commented Oct 30, 2020 at 20:38

1 Answer 1

2

You seem to be pressing Ctrl, W and | all together. That is incorrect. You should do

  • Ctrl-W,
  • release both Ctrl and W,
  • and only then hit |.

I was really surprised to see that pressing Ctrl-W-= all together worked on the other hand.


From comments, the problem was that you missed that the "bar" or "pipe" symbol | is entered by pressing Shift\ in your keyboard layout.

2
  • mvim is vim wrapper for mac. in a meanwhile i solved it. it works a bit differently. Ctrl + W, then Shift + \. Basically pipe - it's shift + \. Thank you for taking part!
    – Anthony
    Commented Oct 30, 2020 at 20:23
  • 1
    CTRL-W-= without releasing the "Control" key will typically work because CTRL-= simply just produces a =. On the other hand, CTRL-| typically produces the same as CTRL-\ . You can see these easily in Vim in Insert mode, by typing them after a CTRL-V (which inserts the next symbol literally.) CTRL-V CTRL-= just inserts a =, while CTRL-V CTRL-| inserts a ^\ (that's how a CTRL-\ is displayed.)
    – filbranden
    Commented Oct 30, 2020 at 20:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.