This might be a silly question, but what is the actual difference between %f and %F in status line?

From :h statusline:

  • f Path to the file in the buffer, as typed or relative to current directory.
  • F Full path to the file in the buffer.

However, as long as I don't use the menu and use :e ... instead, I don't see any difference.

set laststatus=2
set statusline=%f\ \ %F
  • :e c:\users\john\desktop\test1.txt~\Desktop\test1.txt
  • :e c:\foo\bar\test2.txtc:\foo\bar\test2.txt

The key is "as typed". Let's do a test using your supplied status line config: set statusline=%f\ \ %F


  1. mkdir -p /tmp/foo : create a directory in a scratch area
  2. cd /tmp/foo : navigate to this new directory
  3. touch a b : create two empty files, "a" and "b"
  4. vim : start Vim with no arguments
  5. (in Vim) :e /tmp/foo/a then :e ./b


When viewing file "a" the status line shows

/tmp/foo/a  /tmp/foo/a

When viewing file "b" it shows

./b  /tmp/foo/b

In both cases the first item, for %f, is the exact file path we passed to the :e command and the second item, for %F, is the file's full path regardless of what we typed.

* Though you appear to be on Windows, I know almost nothing about cmd.exe or Powershell commands so I'm using shell commands. If you want to recreate this yourself I imagine it'll be relatively easy to translate to Win equivalents.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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