Add keybind to close views

This commit is contained in:
Isaac Freund
2020-04-08 17:43:00 +02:00
parent dd480ca567
commit b2fbdf2d87
3 changed files with 16 additions and 0 deletions

View File

@ -111,3 +111,10 @@ pub fn spawn(server: *Server, arg: Arg) void {
const child = std.ChildProcess.init(&argv, std.heap.c_allocator) catch unreachable;
std.ChildProcess.spawn(child) catch unreachable;
}
/// Close the focused view, if any.
pub fn close(server: *Server, arg: Arg) void {
if (server.root.focused_view) |view| {
view.close();
}
}