Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I use Ctrl-G to see the path. But I want to enter the path to the file itself.

How can I achieve this in Vim?

share|improve this question
up vote 6 down vote accepted

The name of the current file is contained in the % register. See

:help quote%

You can insert the contents of that register as you would any other register, e.g.,

:put %

and in insert mode as


where <C-R> means Ctrl-R.

You can also expand the file name to its full path and select various parts of the path or file name using expand() and file name modifiers. See

:help expand()
:help filename-modifiers

As an example, while in insert mode, you could type


followed by Enter, where again <C-R> means Ctrl-R, which would insert the full path name of the current file. See

:help i_CTRL-R_=
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.