vim: Add ZZ and ZQ

The major change here is a refactoring to allow controling the save
behaviour when closing items, which is pre-work needed for vim command
palette.

For zed-industries/community#1868
This commit is contained in:
Conrad Irwin 2023-09-08 13:55:13 -06:00
parent 5d782b6cf0
commit ba1c350dad
9 changed files with 258 additions and 89 deletions

View file

@ -474,8 +474,14 @@ impl<T: Item> ItemHandle for ViewHandle<T> {
for item_event in T::to_item_events(event).into_iter() {
match item_event {
ItemEvent::CloseItem => {
pane.update(cx, |pane, cx| pane.close_item_by_id(item.id(), cx))
.detach_and_log_err(cx);
pane.update(cx, |pane, cx| {
pane.close_item_by_id(
item.id(),
crate::SaveBehavior::PromptOnWrite,
cx,
)
})
.detach_and_log_err(cx);
return;
}