What do % and ! mean in Vim commands?

Within Vim, run :h :! and :h :% to know what each does.

Now, the :% is used to replace the contents of the file with the output of the shell command run using :!. If you don't want to touch the contents of the file, don't use %. Just do:

:!ls

According to VIM Tutorial:

%

Move cursor to the matching bracket.
Place cursor on {}[]() and type "%".

!

filter through external command 
Any UNIX command can be executed from the vi command line by typing an "!" before the UNIX command.
Autowrite can be intentionally avoided by using "!" to avoid the save when switching files.

for more information see Vim Commands Cheat Sheet, and VIM Tutorial


I had this same question and found this in :h cmdline-special, which was the meaning I was looking for:

%   Is replaced with the current file name.       *:_%* *c_%*