I was trying to map 'q!' to 'Q!' in .vimrc ? I tried the following but not working. :command Q! q! Please provide any suggestion to mitigate this issue. Thank you.
This worked perfectly for me:
:command-bang Q q<bang>
From vim's help (
Special cases :command-bang :command-bar :command-register :command-buffer There are some special cases as well: -bang The command can take a ! modifier (like :q or :w)
Replacement text The replacement text for a user defined command is scanned for special escape sequences, using <...> notation. Escape sequences are replaced with values from the entered command line, and all other text is copied unchanged. The resulting string is executed as an Ex command. [...] The valid escape sequences are [...] <bang> (See the '-bang' attribute) Expands to a ! if the command was executed with a ! modifier, otherwise expands to nothing. [...]