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"
|
||||
mode = "nv"
|
||||
|
||||
[[keymaps]]
|
||||
key = "shift+p"
|
||||
command = "paste_before"
|
||||
mode = "nv"
|
||||
|
||||
[[keymaps]]
|
||||
key = "shift+j"
|
||||
command = "join_lines"
|
||||
|
|
|
@ -67,6 +67,8 @@ pub enum EditCommand {
|
|||
Yank,
|
||||
#[strum(serialize = "paste")]
|
||||
Paste,
|
||||
#[strum(serialize = "paste_before")]
|
||||
PasteBefore,
|
||||
|
||||
#[strum(serialize = "normal_mode")]
|
||||
NormalMode,
|
||||
|
|
|
@ -965,6 +965,16 @@ pub fn do_edit<T: Clipboard>(
|
|||
let data = register.unnamed.clone();
|
||||
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 => {
|
||||
let offset = cursor.offset();
|
||||
let line = buffer.line_of_offset(offset);
|
||||
|
|
Loading…
Reference in New Issue