Trang thông tin tổng hợp
Trang thông tin tổng hợp
  • Tranh Tô Màu
  • Meme
  • Avatar
  • Hình Nền
  • Ảnh Hoa
  • Ảnh Chibi
  • Ảnh Nail
Tranh Tô Màu Meme Avatar Hình Nền Ảnh Hoa Ảnh Chibi Ảnh Nail
  1. Trang chủ
  2. chính tả
Mục Lục

How do I exit Vim?

avatar
Xuka
13:53 24/11/2025

Mục Lục

Before you enter a command, hit the Esc key. After you enter it, hit the Return to confirm.

Esc finishes the current command and switches Vim to normal mode. Now if you press :, the : will appear at the bottom of the screen. This confirms that you're actually typing a command and not editing the file.

Most commands have abbreviations, with optional part enclosed in brackets: c[ommand].

Commands marked with '*' are Vim-only (not implemented in Vi).

Safe-quit (fails if there are unsaved changes):

  • :q[uit] Quit the current window. Quit Vim if this is the last window. This fails when changes have been made in current buffer.
  • :qa[ll]* Quit all windows and Vim, unless there are some buffers which have been changed.

Prompt-quit (prompts if there are unsaved changes)

  • :conf[irm] q[uit]* Quit, but give prompt when there are some buffers which have been changed.
  • :conf[irm] xa[ll]* Write all changed buffers and exit Vim. Bring up a prompt when some buffers cannot be written.

Write (save) changes and quit:

  • :wq Write the current file (even if it was not changed) and quit. Writing fails when the file is read-only or the buffer does not have a name. :wqa[ll]* for all windows.
  • :wq! The same, but writes even read-only files. :wqa[ll]!* for all windows.
  • :x[it], ZZ(with details). Write the file only if it was changed and quit, :xa[ll]* for all windows.

Discard changes and quit:

  • :q[uit]! ZQ* Quit without writing, also when visible buffers have changes. Does not exit when there are changed hidden buffers.
  • :qa[ll]!*, :quita[ll][!]* Quit Vim, all changes to the buffers (including hidden) are lost.

Press Return to confirm the command.

This answer doesn't reference all Vim write and quit commands and arguments. Indeed, they are referenced in the Vim documentation.

Vim has extensive built-in help, type Esc:helpReturn to open it.

This answer was inspired by the other one, originally authored by @dirvine and edited by other SO users. I've included more information from Vim reference, SO comments and some other sources. Differences for Vi and Vim are reflected too.

0 Thích
Chia sẻ
  • Chia sẻ Facebook
  • Chia sẻ Twitter
  • Chia sẻ Zalo
  • Chia sẻ Pinterest
In
  • Điều khoản sử dụng
  • Chính sách bảo mật
  • Cookies
  • RSS
  • Điều khoản sử dụng
  • Chính sách bảo mật
  • Cookies
  • RSS

Trang thông tin tổng hợp stt

Website stt là blog chia sẻ vui về đời sống ở nhiều chủ đề khác nhau giúp cho mọi người dễ dàng cập nhật kiến thức. Đặc biệt có tiêu điểm quan trọng cho các bạn trẻ hiện nay.

© 2025 - STT

Kết nối với STT

https://xemthoitiet.com.vn/ https://xemlicham.edu.vn
Trang thông tin tổng hợp
  • Trang chủ
  • Tranh Tô Màu
  • Meme
  • Avatar
  • Hình Nền
  • Ảnh Hoa
  • Ảnh Chibi
  • Ảnh Nail
Đăng ký / Đăng nhập
Quên mật khẩu?
Chưa có tài khoản? Đăng ký