@@ -252,6 +252,9 @@ impl Command {
252252 // TODO: different description ?
253253 goto_line_end_newline, "Goto line end",
254254 goto_first_nonwhitespace, "Goto first non-blank in line",
255+ extend_to_line_start, "Extend to line start",
256+ extend_to_line_end, "Extend to line end",
257+ extend_to_line_end_newline, "Extend to line end",
255258 signature_help, "Show signature help",
256259 insert_tab, "Insert tab char",
257260 insert_newline, "Insert newline char",
@@ -407,7 +410,7 @@ fn extend_line_down(cx: &mut Context) {
407410 move_impl(cx, move_vertically, Direction::Forward, Movement::Extend)
408411}
409412
410−fn goto_line_end(cx: &mut Context) {
413+fn goto_line_end_impl(cx: &mut Context, movement: Movement) {
411414 let (view, doc) = current!(cx.editor);
412415 let text = doc.text().slice(..);
413416
@@ -418,12 +421,20 @@ fn goto_line_end(cx: &mut Context) {
418421 let pos = graphemes::prev_grapheme_boundary(text, line_end_char_index(&text, line))
419422 .max(line_start);
420423
421− range.put_cursor(text, pos, doc.mode == Mode::Select)
424+ range.put_cursor(text, pos, movement == Movement::Extend)
422425 });
423426 doc.set_selection(view.id, selection);
424427}
425428
426−fn goto_line_end_newline(cx: &mut Context) {
429+fn goto_line_end(cx: &mut Context) {
430+ goto_line_end_impl(cx, Movement::Move)
431+}
432+
433+fn extend_to_line_end(cx: &mut Context) {
434+ goto_line_end_impl(cx, Movement::Extend)
435+}
436+
437+fn goto_line_end_newline_impl(cx: &mut Context, movement: Movement) {
427438 let (view, doc) = current!(cx.editor);
428439 let text = doc.text().slice(..);
429440
@@ -431,12 +442,20 @@ fn goto_line_end_newline(cx: &mut Context) {
431442 let line = range.cursor_line(text);
432443 let pos = line_end_char_index(&text, line);
433444
434− range.put_cursor(text, pos, doc.mode == Mode::Select)
445+ range.put_cursor(text, pos, movement == Movement::Extend)
435446 });
436447 doc.set_selection(view.id, selection);
437448}
438449
439−fn goto_line_start(cx: &mut Context) {
450+fn goto_line_end_newline(cx: &mut Context) {
451+ goto_line_end_newline_impl(cx, Movement::Move)
452+}
453+
454+fn extend_to_line_end_newline(cx: &mut Context) {
455+ goto_line_end_newline_impl(cx, Movement::Extend)
456+}
457+
458+fn goto_line_start_impl(cx: &mut Context, movement: Movement) {
440459 let (view, doc) = current!(cx.editor);
441460 let text = doc.text().slice(..);
442461
@@ -445,11 +464,19 @@ fn goto_line_start(cx: &mut Context) {
445464
446465 // adjust to start of the line
447466 let pos = text.line_to_char(line);
448− range.put_cursor(text, pos, doc.mode == Mode::Select)
467+ range.put_cursor(text, pos, movement == Movement::Extend)
449468 });
450469 doc.set_selection(view.id, selection);
451470}
452471
472+fn goto_line_start(cx: &mut Context) {
473+ goto_line_start_impl(cx, Movement::Move)
474+}
475+
476+fn extend_to_line_start(cx: &mut Context) {
477+ goto_line_start_impl(cx, Movement::Extend)
478+}
479+
453480fn goto_first_nonwhitespace(cx: &mut Context) {
454481 let (view, doc) = current!(cx.editor);
455482 let text = doc.text().slice(..);