The line("."), command gets the line in the current buffer. Whats the command to get line in an arbitrary buffer, using buffer numbers?


The getbufinfo() returns a list of dictionaries. One of the dictionary key is lnum - line number. One other key is bufn - buffer number.

| improve this answer | |
  • Note this function is a rather recent addition to vim's libraries (post 7.4.2204, Aug 2016) – user1138184 Mar 26 '17 at 14:32

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.