How do I find out the name of the files in the buffers in vim.Is there any command that returns the name of the file?

  • :ls lists buffers... – jasonwryan Mar 5 '15 at 7:30

The bufname() command returns the filespec of the passed-in buffer number. To get all buffers (like :ls), you can iterate with for bufNr in range(1, bufnr('$')) ... The returned filespec may be relative to the current directory; you can use fnamemodify() to turn it into an absolute filespec.

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.