Add :tabonly and :only vim commands (#8337)

Release Notes:

- Added
[`:tabo[nly][!]`](https://neovim.io/doc/user/tabpage.html#%3Atabonly),
closes all the tabs except the active one but in the current pane only,
every other split pane remains unaffected.
The version with the `!` force closes the tabs while the one without
asks you to save or discard the changes.
- Added [`:on[ly][!]`](https://neovim.io/doc/user/windows.html#%3Aonly),
closes all the tabs *and* panes except the active one.
The version with the `!` force closes the tabs while the one without
asks you to save or discard the changes.
Since Zed does not have different splits per tab like in Neovim `:only`
works the same as it does in VscodeVim.

---------

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
This commit is contained in:
riccardofano 2024-02-27 06:15:50 +01:00 committed by GitHub
parent c31626717f
commit a42b987929
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 53 additions and 11 deletions

View file

@ -201,6 +201,34 @@ pub fn command_interceptor(mut query: &str, cx: &AppContext) -> Option<CommandIn
}
.boxed_clone(),
),
"tabo" | "tabon" | "tabonl" | "tabonly" => (
"tabonly",
workspace::CloseInactiveItems {
save_intent: Some(SaveIntent::Close),
}
.boxed_clone(),
),
"tabo!" | "tabon!" | "tabonl!" | "tabonly!" => (
"tabonly!",
workspace::CloseInactiveItems {
save_intent: Some(SaveIntent::Skip),
}
.boxed_clone(),
),
"on" | "onl" | "only" => (
"only",
workspace::CloseInactiveTabsAndPanes {
save_intent: Some(SaveIntent::Close),
}
.boxed_clone(),
),
"on!" | "onl!" | "only!" => (
"only!",
workspace::CloseInactiveTabsAndPanes {
save_intent: Some(SaveIntent::Skip),
}
.boxed_clone(),
),
// quickfix / loclist (merged together for now)
"cl" | "cli" | "clis" | "clist" => (