SolvedVim Unable to close windows in normal mode with ctrl-w

  • Click thumbs-up πŸ‘ on this issue if you want it!
  • Click confused πŸ˜• on this issue if not having it makes VSCodeVim unusable.

The VSCodeVim team prioritizes issues based on reaction count.


Is this a BUG REPORT or FEATURE REQUEST? (choose one): Bug report

vscode ticket: microsoft/vscode#35753

Environment:

  • VSCode Version: Code 1.17.0 (be377c0faf7574a59f84940f593a6849f12e4de7, 2017-10-04T23:33:45.303Z)
  • VsCodeVim Version: 0.10.1
  • OS: Ubuntu 16.04

What happened:

  1. Open a file
  2. ctrl-w
  3. File was not closed (note: modified files did not display the "save first?" dialog)

Note: I was in normal mode while testing this. If I were in insert mode this obviously would have a different result.

What did you expect to happen:

The file would be closed (and I'd be prompted to save if the file was modified).

How to reproduce it:

See steps above.

12 Answers

βœ”οΈAccepted Answer

Please add the following to your settings.json to delegate the keystroke BACK to vscode since Ctrl+w is a vim keyboard command that we use.

    "vim.handleKeys": {
        "<C-w>": false
    }

Please reopen if you have any further issues

Other Answers:

C-w is a vim command, you can either choose to use it or delegate it back to vscode. I think if we fracture it further and allow you to disable certain keys in certain modes it is going to start to get pretty complicated. Feel free to open an issue for that though!

The vim way is to use :q or :x

You could also rebind vscode's close window command potentially to another combination, but I understand the appeal of C-w since I add the disable C-w command on windows/linux personally

The vim way is to use :q or :x

Or also C-w q and C-w c.

But that blanket change isn't correct. as useful as it could be, IMO.

Normal-mode C-w should close the window but Insert-mode C-w should delete a word backwards.

Below settings may help. It will close active-editor WITHOUT SAVING. If you want to save and close, then first do 'ctrl-s' and then 'ctrl-w'. If auto-save enabled, saving should not be big issue. In case it is untitled buffer, you may need 'ctrl-s' or you can bind another key with "after": [":", "w", "q", "<enter>"].

    "vim.normalModeKeyBindingsNonRecursive": [
        {
            "before": ["<C-w>",],
            "after" : [":", "q", "!", "<enter>"]
        }
    ],

More Issues: