I am using the fzf plugin which has a command called :Windows. Very often I type :W instead of :w when trying to write and it is very annoying. I would like to remove the command, since I do not use it very much, and have tried putting

delcommand Windows

in my vimrc which did not work, E184: No such user-defined command: Windows so I tried put it in the after directory because to my knowledge, vim processes stuff there after plugins have been loaded. But that did not work either. Any thoughts ?

1 Answer 1


While I'm not entirely sure deleting this command is a great idea you can do it using an autocommand like this in your vimrc:

augroup deletePluginCommand
    autocmd VimEnter * delcommand Windows
augroup END

If you are not familiar with autocommands, they are a way to trigger some code on an event (see :h autocmd) and here we use the event VimEnter which is trigger once all the initialization scripts are done (:h VimEnter).

EDIT With a solution which seems less intrusive to me:

Maybe instead of deleting the command you could use another trick:

cnoreabbrev <expr> W (getcmdtype() == ':' && getcmdline() =~ '^W$')? 'w' : 'W'

This command line abbreviation will replace W by w in the command line only if the content of the command line is W this way when you use :W you will not trigger :Windows but :w instead.

  • @FirstUser You already accepted my answer but maybe you should check my edit, I think it is a better solution than deleting the command altogether because maybe one day :Windows will be useful to you.
    – statox
    Mar 17, 2021 at 18:26

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.