A command to run on a buffer given its number or titled printed in :ls. This doesn't seem to be possible with :bufdo.

  • You mean an ex-command? Or something like a operating system command? Commented May 6 at 10:55
  • @ChristianBrabandt OP's previous question for context: vi.stackexchange.com/questions/44742/…
    – romainl
    Commented May 6 at 11:51
  • No. There is no such thing.
    – romainl
    Commented May 6 at 14:50
  • @romainl I already figured out that other question. This is separate.
    – Oneechan69
    Commented May 6 at 15:13

1 Answer 1


The closest you can get is probably simulation via (:help text-functions)

Working with text in another buffer:
    getbufline()        get a list of lines from the specified buffer
    getbufoneline()     get a one line from the specified buffer
    setbufline()        replace a line in the specified buffer
    appendbufline()     append a list of lines in the specified buffer
    deletebufline()     delete lines from a specified buffer

Many functions take a {bufnr}, but generally Vim assumes you're editing the current buffer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.