4

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 :)

  • 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 at 1:16
9

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')
  • 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. – Luc Hermitte Apr 20 '15 at 13:08

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.