3

I am trying to use Ctrl+w s to split a window in Vim. However it is not working in my case. I opened a file using vim filename. Then I pressed Ctrl+w s. But as soon as I press just Ctrl+w it clears the viewport and I could see my shell display before vim opened the file. I mean the view port is replaced by the content just before the file was opened. However, I am still editing the file with Vim.

Suggestions?

2
  • 5
    What shell and what terminal are you using?
    – Anson
    Oct 1, 2011 at 18:50
  • I am using gnome-terminal and bash shell. About the Ctrl+w thing triggering thing, I found out that I had a shortcut with Ctrl+w in my terminal's keyboard preferences. I have disabled it though. However, Ctrl+ws is still not splitting the window horizontally. Oct 2, 2011 at 6:40

3 Answers 3

4

Control-W must be being eaten by your terminal. Check settings and remove. If it still doesn't fix, then try this in Vim (in insert mode) or at your shell: hit Control-V and then Control-W. does it insert a ^W ?

If it doesn't work in your shell either, something about the terminal is still eating it. If it works in the shell but not Vim, then report back.

In the meanwhile, you can split by doing :split in Vim.

1
  • I ran into this problem using :term. I'd forgotten I was in a vim context, and opened vim from within the vim-hosted terminal. Eventually (after 1 or more nestings over the day), I was no longer able to CTRL-W through the windows.
    – Chris
    Mar 16, 2021 at 22:02
1

I kept trying to press them all at once, and it didn't work, after playing with it for half an hour I released the control-w and then pressed S, it worked that way (though, your problem might be something completely different)

1
  • The asker's problem is almost certainly something different, because he is actually having a problem when pressing the key combo.
    – Kazark
    Nov 9, 2012 at 2:34
0

I just had this problem on Ubuntu as well, all the shortcuts using Ctrl + something worked except for Ctrl+ws and Ctrl+wq. It turns out that the shell is swallowing the second part of the command, which is Ctrl+s / Ctrl+q.

I've found that this solution fixed my problem: https://stackoverflow.com/a/13648667/1199685

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .