I have modified the 'runtimepath' in my .vimrc file. As I am having problems of not found files, I would like to display the runtimepath value in an :echo or :echomsg

I already know about he existence of :scriptnames and the possibility of checking the value with :set runtimepath, but I specifically need to display it with :echo or :echomsg commands.

I have already tried, without success, the following:

  • :echo runtimepath
  • :echo expand(runtimepath)
  • :echo expand('runtimepath')
  • Nothing that can't be found with a simple :help :echo.
    – romainl
    Apr 30 at 9:02

2 Answers 2


Everyting that is set using :set is an option in vim. Options are described in the help between single quotes, like in :h 'runtimepath'

If you check the documentation page :h after-directory, it is said:

More entries are added when using |packages|. If it gets very long then :set rtp will be truncated, use :echo &rtp to see the full string.

Therefore, the answer to the question is:

:echo &runtimepath

As suggested by @d-ben-knoble in the comments, this approach creates a new buffer and reports in a much more legible way as each path is in a different line

:new | put =split(&runtimepath, ',')

Output is like

C:\Program Files (x86)\Vim/vimfiles
C:\Program Files (x86)\Vim\vim90
C:\Program Files (x86)\Vim\vim90\pack\dist\opt\matchit
C:\Program Files (x86)\Vim/vimfiles/after

There is another way that may be easier depending on the situation.

Sometimes I do things like this with the expression register (:h @=) knowing that settings can be accessed from expressions using a leading & (from :h expression-syntax in the expr10 section in my version)

While in insert mode:


You could make it "clean" by combining with the split in @aturegano's answer:

<c-r>=split(&runtimepath, ',')<cr>
  • 1
    This is useful in Insert mode! The other answer has the benefit of being readily accessible in Normal mode, which is the mode I'm in normally :)
    – D. Ben Knoble
    Apr 30 at 18:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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