%:r
in vimrc file?:gcc
and :!gcc
?%
in vimrc file?I'm studying vi/vim...but it's hard for me. I want information about vimrc operations. where can I get it??
I really appreciate all answers.
Let's answer your questions in order…
What is difference between :gcc
and :!gcc
?
:something
is an ex command. You can find a complete list of available ex commands under :help ex-cmd-index
and look for help on a specific command with :help :something
.
:gcc
is not an existing ex command.
:!something
calls the external command something
so :!gcc
would call gcc
.
What is %
in vimrc file?
It's not anything specific to your vimrc
. When used as argument to an external command, it represents the current file name. Assuming the current file name is foobar.c
, :!gcc %
is expanded to gcc foobar.c
before being passed to the shell.
See :help c_%
.
What is %:r
in vimrc file?
Again, it's not anything specific to your vimrc
. :r
is a file name modifier applied to the current file name. Assuming the current file name is foobar.c
, %:r
would be expanded to foobar
.
See :help filename-modifiers
.
It looks like you are trying to make sense of a command similar to:
:!gcc % -o %:r
which, again assuming the current file name is foobar.c
, should be expanded to:
gcc foobar.c -o foobar
before being sent to your shell… and result in a foobar
executable right beside your foobar.c
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With