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

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.