mirror of https://github.com/lapce/lapce.git
Added vims paste before (#1251)
This commit is contained in:
parent
c4505878ad
commit
d6f126695a
|
@ -383,6 +383,11 @@ key = "p"
|
||||||
command = "paste"
|
command = "paste"
|
||||||
mode = "nv"
|
mode = "nv"
|
||||||
|
|
||||||
|
[[keymaps]]
|
||||||
|
key = "shift+p"
|
||||||
|
command = "paste_before"
|
||||||
|
mode = "nv"
|
||||||
|
|
||||||
[[keymaps]]
|
[[keymaps]]
|
||||||
key = "shift+j"
|
key = "shift+j"
|
||||||
command = "join_lines"
|
command = "join_lines"
|
||||||
|
|
|
@ -67,6 +67,8 @@ pub enum EditCommand {
|
||||||
Yank,
|
Yank,
|
||||||
#[strum(serialize = "paste")]
|
#[strum(serialize = "paste")]
|
||||||
Paste,
|
Paste,
|
||||||
|
#[strum(serialize = "paste_before")]
|
||||||
|
PasteBefore,
|
||||||
|
|
||||||
#[strum(serialize = "normal_mode")]
|
#[strum(serialize = "normal_mode")]
|
||||||
NormalMode,
|
NormalMode,
|
||||||
|
|
|
@ -965,6 +965,16 @@ pub fn do_edit<T: Clipboard>(
|
||||||
let data = register.unnamed.clone();
|
let data = register.unnamed.clone();
|
||||||
Self::do_paste(cursor, buffer, &data)
|
Self::do_paste(cursor, buffer, &data)
|
||||||
}
|
}
|
||||||
|
PasteBefore => {
|
||||||
|
let offset = cursor.offset();
|
||||||
|
let line = buffer.line_of_offset(offset);
|
||||||
|
let line_offset = buffer.offset_of_line(line);
|
||||||
|
let data = register.unnamed.clone();
|
||||||
|
if offset > line_offset {
|
||||||
|
cursor.set_offset(offset - 1, false, false);
|
||||||
|
}
|
||||||
|
Self::do_paste(cursor, buffer, &data)
|
||||||
|
}
|
||||||
NewLineAbove => {
|
NewLineAbove => {
|
||||||
let offset = cursor.offset();
|
let offset = cursor.offset();
|
||||||
let line = buffer.line_of_offset(offset);
|
let line = buffer.line_of_offset(offset);
|
||||||
|
|
Loading…
Reference in New Issue