@@ -2240,11 +2240,6 @@ pub fn hover(cx: &mut Context) {
2244−pub fn next_view(cx: &mut Context) {
2245− cx.editor.focus_next()
2248// comments
2243// comments
2249pub fn toggle_comments(cx: &mut Context) {
2244pub fn toggle_comments(cx: &mut Context) {
2250 let (view, doc) = cx.current();
2245 let (view, doc) = cx.current();
@@ -2308,16 +2303,38 @@ pub fn jump_backward(cx: &mut Context) {
2311−//
2306+pub fn window_mode(cx: &mut Context) {
2307+ cx.on_next_key(move |cx, event| {
2309+ code: KeyCode::Char(ch),
2314+ 'w' => rotate_view(cx),
2313−pub fn vsplit(cx: &mut Context) {
2324+pub fn rotate_view(cx: &mut Context) {
2325+ cx.editor.focus_next()
2328+// split helper, clear it later
2329+use helix_view::editor::Action;
2330+fn split(cx: &mut Context, action: Action) {
2314 use helix_view::editor::Action;
2331 use helix_view::editor::Action;
2315 let (view, doc) = cx.current();
2332 let (view, doc) = cx.current();
2316 let id = doc.id();
2333 let id = doc.id();
2317 let selection = doc.selection(view.id).clone();
2334 let selection = doc.selection(view.id).clone();
2318 let first_line = view.first_line;
2335 let first_line = view.first_line;
2320− cx.editor.switch(id, Action::VerticalSplit);
2337+ cx.editor.switch(id, action);
2322 // match the selection in the previous view
2339 // match the selection in the previous view
2323 let (view, doc) = cx.current();
2340 let (view, doc) = cx.current();
@@ -2325,6 +2342,20 @@ pub fn vsplit(cx: &mut Context) {
2325 doc.set_selection(view.id, selection);
2342 doc.set_selection(view.id, selection);
2345+pub fn hsplit(cx: &mut Context) {
2346+ split(cx, Action::HorizontalSplit);
2349+pub fn vsplit(cx: &mut Context) {
2350+ split(cx, Action::VerticalSplit);
2353+pub fn wclose(cx: &mut Context) {
2354+ let view_id = cx.view().id;
2355+ // close current split
2356+ cx.editor.close(view_id, /* close_buffer */ false);
2328pub fn space_mode(cx: &mut Context) {
2359pub fn space_mode(cx: &mut Context) {
2329 cx.on_next_key(move |cx, event| {
2360 cx.on_next_key(move |cx, event| {
2330 if let KeyEvent {
2361 if let KeyEvent {
@@ -2336,18 +2367,12 @@ pub fn space_mode(cx: &mut Context) {
2336 match ch {
2367 match ch {
2337 'f' => file_picker(cx),
2368 'f' => file_picker(cx),
2338 'b' => buffer_picker(cx),
2369 'b' => buffer_picker(cx),
2340 'w' => {
2370 'w' => {
2341 // save current buffer
2371 // save current buffer
2342 let (view, doc) = cx.current();
2372 let (view, doc) = cx.current();
2343 doc.format(view.id); // TODO: merge into save
2373 doc.format(view.id); // TODO: merge into save
2344 tokio::spawn(doc.save());
2374 tokio::spawn(doc.save());
2347− let view_id = cx.view().id;
2348− // close current split
2349− cx.editor.close(view_id, /* close_buffer */ false);
2351 // ' ' => toggle_alternate_buffer(cx),
2376 // ' ' => toggle_alternate_buffer(cx),
2352 // TODO: temporary since space mode took it's old key
2377 // TODO: temporary since space mode took it's old key
2353 ' ' => keep_primary_selection(cx),
2378 ' ' => keep_primary_selection(cx),