5

Using :buffers results

:buffers
  1 %a   "my-jspage.md"                 line 11

Are there any options so :buffers will list full path and filename? E.g.:

:buffers
  1 %a   "d:\projects\self-org\my-jspage.md"                 line 11

I'm on windows Vim 7.4-656. I'm aware of :ls :)

1
  • I find it really annoying that the :buffers list shows the current file without the path, even though all other files in the list are shown with the path. This is like the worst of both worlds. It may be a feature, but it's not a good feature. I display full path in the statusline which helps somewhat: set statusline+=%-.80F " filepath left align max length 80 "
    – NeilG
    Oct 2, 2019 at 1:16

2 Answers 2

10

Vim reduces the filespec of the open buffers to a shorter, relative representation. (That's a feature, not a bug.) You can work around that behavior by switching the current working directory (temporarily) to the file system root / (on Windows:) to a drive not currently used:

:cd C:/ | buffers | cd -
5

Are there any options so :buffers will list full path and filename?

No, but you can use fnamemodify() to find out the full path:

:echo fnamemodify(bufname(1), ':p')
1
  • 3
    And to obtain the complete list, you have this oneliner echo join(map(filter(copy(range(1, bufnr('$'))), 'buflisted(v:val)'), '" ".fnamemodify(bufname(v:val), ":p")'), "\n"). However, if you want to display the other information (displayed by :buffer), prefer a loop to build the indicators string. Apr 20, 2015 at 13:08

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.