mirror of
https://github.com/ilyakooo0/helix.git
synced 2024-11-30 00:35:26 +03:00
Implement <n>g as goto line n.
This commit is contained in:
parent
626e49448c
commit
ea407ccdba
@ -1032,6 +1032,16 @@ pub fn normal_mode(cx: &mut Context) {
|
||||
}
|
||||
|
||||
pub fn goto_mode(cx: &mut Context) {
|
||||
let count = cx.count;
|
||||
if count > 1 {
|
||||
// TODO: can't go to line 1 since we can't distinguish between g and 1g, g gets converted
|
||||
// to 1g
|
||||
let doc = cx.doc();
|
||||
let pos = doc.text().line_to_char(count - 1);
|
||||
doc.set_selection(Selection::point(pos));
|
||||
return;
|
||||
}
|
||||
|
||||
cx.on_next_key(move |cx, event| {
|
||||
if let KeyEvent {
|
||||
code: KeyCode::Char(ch),
|
||||
|
Loading…
Reference in New Issue
Block a user