Ubuntu – What do % and ! mean in Vim commands


In Vim,


executes ls command and prints its output to the current editable file.

But what do % and ! mean separately in vim?

Is it possible execute ls and not put its output to document?

Best Answer

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: