mirror of https://github.com/helix-editor/helix
Merge `x` and `X`
parent
ffb54b4eac
commit
f41688d960
|
@ -69,9 +69,8 @@
|
||||||
| `;` | Collapse selection onto a single cursor |
|
| `;` | Collapse selection onto a single cursor |
|
||||||
| `Alt-;` | Flip selection cursor and anchor |
|
| `Alt-;` | Flip selection cursor and anchor |
|
||||||
| `%` | Select entire file |
|
| `%` | Select entire file |
|
||||||
| `x` | Select current line |
|
| `x` | Select current line, if already selected, extend to next line |
|
||||||
| `X` | Extend to next line |
|
| `` | Expand selection to parent syntax node TODO: pick a key |
|
||||||
| `[` | Expand selection to parent syntax node TODO: pick a key |
|
|
||||||
| `J` | join lines inside selection |
|
| `J` | join lines inside selection |
|
||||||
| `K` | keep selections matching the regex TODO: overlapped by hover help |
|
| `K` | keep selections matching the regex TODO: overlapped by hover help |
|
||||||
| `Space` | keep only the primary selection TODO: overlapped by space mode |
|
| `Space` | keep only the primary selection TODO: overlapped by space mode |
|
||||||
|
|
|
@ -888,21 +888,6 @@ fn search_selection(cx: &mut Context) {
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
fn select_line(cx: &mut Context) {
|
|
||||||
let count = cx.count();
|
|
||||||
let (view, doc) = current!(cx.editor);
|
|
||||||
|
|
||||||
let pos = doc.selection(view.id).primary();
|
|
||||||
let text = doc.text();
|
|
||||||
|
|
||||||
let line = text.char_to_line(pos.head);
|
|
||||||
let start = text.line_to_char(line);
|
|
||||||
let end = text
|
|
||||||
.line_to_char(std::cmp::min(doc.text().len_lines(), line + count))
|
|
||||||
.saturating_sub(1);
|
|
||||||
|
|
||||||
doc.set_selection(view.id, Selection::single(start, end));
|
|
||||||
}
|
|
||||||
fn extend_line(cx: &mut Context) {
|
fn extend_line(cx: &mut Context) {
|
||||||
let count = cx.count();
|
let count = cx.count();
|
||||||
let (view, doc) = current!(cx.editor);
|
let (view, doc) = current!(cx.editor);
|
||||||
|
|
|
@ -196,9 +196,7 @@ impl Default for Keymaps {
|
||||||
key!(';') => Command::collapse_selection,
|
key!(';') => Command::collapse_selection,
|
||||||
alt!(';') => Command::flip_selections,
|
alt!(';') => Command::flip_selections,
|
||||||
key!('%') => Command::select_all,
|
key!('%') => Command::select_all,
|
||||||
key!('x') => Command::select_line,
|
key!('x') => Command::extend_line,
|
||||||
key!('X') => Command::extend_line,
|
|
||||||
// or select mode X?
|
|
||||||
// extend_to_whole_line, crop_to_whole_line
|
// extend_to_whole_line, crop_to_whole_line
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue