I have fzf.vim installed, and therefore I have a :W command. I prefer working with buffers, so I save a lot with :w. However, accidentally using a capital W invokes :W which annoys me.

I tried cnoremap W <nop>, but now I can't write :W at all, the W just isn't showing. This isn't what I want.

How to disable the :W command?

  • 1
    You could try to :delcommand W, but it has to be done after the command is defined (maybe try ~/.vim/after/plugin/fzf-vim-fix.vim with contents if exists(':W') is# 2 | delcommand W | endif--replace bars with newlines--I'm assuming the full command name is W, so if the real command is longer use that);
    – D. Ben Knoble
    Oct 24, 2020 at 16:00
  • 2
    The full command for :W is :Windows, does :delcommand Windows work? Oct 25, 2020 at 19:50
  • 1
    Did you put @D.BenKnoble's suggestion in ~/.vim/after/plugin/fzf-vim-fix.vim? You can’t just put it in your vimrc, because the command is registered after your vimrc is sourced. It needs to go in your ~/.vim/after/plugin directory. Note that exists(':W') needs to be exists(':Windows'). Oct 25, 2020 at 22:56
  • 1
    @BLayer arp242.net/effective-vimscript.html
    – D. Ben Knoble
    Oct 26, 2020 at 2:31
  • 1
    @D.BenKnoble Sure. I understand that. But I doubt the intent there is to apply that to cases where there's no chance of coercion occurring (e.g. comparing a numeric return value to a number). Speaking as someone who's written and reviewed 100Ks of LoC my opinion, were someone to ask for it ;) is that that is sacrificing readability at the altar of unnecessary cautiousness. You are, of course, free to act upon or disregard said opinion as you please. :)
    – B Layer
    Oct 26, 2020 at 2:47

1 Answer 1


The official response from Junegunn is to put the following in your vimrc:

command! -nargs=* W w

This will make :W behave like :w, while still allowing you to use :Wi (or any other shortening of :Windows) if you want to.

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.