Malek KARKI
Malek KARKI

Reputation: 171

What's the difference between :q and :bd command when we have many buffers?

I'm a beginner in vim and I've a simple question.
What is the difference between :q and :bd command when we have many buffers ?

Thank you for your answers.

Upvotes: 13

Views: 5891

Answers (2)

dinobi
dinobi

Reputation: 560

:bd (destroy empty pane)close current buffer without changes. if want you change file must save then bd

:q close file. but changes not save.

I hope it complete

Upvotes: 1

Kent
Kent

Reputation: 195209

:q quit current window.

  • only one window: quit vim.
  • if you have more windows opened (splits): it closes the current window without deleting the buffer. You can see the buffer by :ls

:bd (without argument) delete(unload) current buffer

  • only one window: delete the current buffer, but won't close the window (quit vim).
  • more splits: delete the current buffer, and close the current window split.

you can test it with :ls to monitor the buffer changes.

Upvotes: 29

Related Questions