mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-08 07:35:01 +03:00
vim: Add shift-y (#3117)
Release Notes: - vim: Add `Y` to copy line-wise (this copies vim's behaviour, which differs from nvim's)
This commit is contained in:
commit
9004254fbf
@ -408,6 +408,7 @@
|
|||||||
"vim::PushOperator",
|
"vim::PushOperator",
|
||||||
"Yank"
|
"Yank"
|
||||||
],
|
],
|
||||||
|
"shift-y": "vim::YankLine",
|
||||||
"i": "vim::InsertBefore",
|
"i": "vim::InsertBefore",
|
||||||
"shift-i": "vim::InsertFirstNonWhitespace",
|
"shift-i": "vim::InsertFirstNonWhitespace",
|
||||||
"a": "vim::InsertAfter",
|
"a": "vim::InsertAfter",
|
||||||
|
@ -46,6 +46,7 @@ actions!(
|
|||||||
ChangeToEndOfLine,
|
ChangeToEndOfLine,
|
||||||
DeleteToEndOfLine,
|
DeleteToEndOfLine,
|
||||||
Yank,
|
Yank,
|
||||||
|
YankLine,
|
||||||
ChangeCase,
|
ChangeCase,
|
||||||
JoinLines,
|
JoinLines,
|
||||||
]
|
]
|
||||||
@ -66,6 +67,7 @@ pub fn init(cx: &mut AppContext) {
|
|||||||
cx.add_action(insert_line_above);
|
cx.add_action(insert_line_above);
|
||||||
cx.add_action(insert_line_below);
|
cx.add_action(insert_line_below);
|
||||||
cx.add_action(change_case);
|
cx.add_action(change_case);
|
||||||
|
cx.add_action(yank_line);
|
||||||
|
|
||||||
cx.add_action(|_: &mut Workspace, _: &DeleteLeft, cx| {
|
cx.add_action(|_: &mut Workspace, _: &DeleteLeft, cx| {
|
||||||
Vim::update(cx, |vim, cx| {
|
Vim::update(cx, |vim, cx| {
|
||||||
@ -308,6 +310,13 @@ fn insert_line_below(_: &mut Workspace, _: &InsertLineBelow, cx: &mut ViewContex
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn yank_line(_: &mut Workspace, _: &YankLine, cx: &mut ViewContext<Workspace>) {
|
||||||
|
Vim::update(cx, |vim, cx| {
|
||||||
|
let count = vim.take_count(cx);
|
||||||
|
yank_motion(vim, motion::Motion::CurrentLine, count, cx)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
pub(crate) fn normal_replace(text: Arc<str>, cx: &mut WindowContext) {
|
pub(crate) fn normal_replace(text: Arc<str>, cx: &mut WindowContext) {
|
||||||
Vim::update(cx, |vim, cx| {
|
Vim::update(cx, |vim, cx| {
|
||||||
vim.stop_recording();
|
vim.stop_recording();
|
||||||
|
Loading…
Reference in New Issue
Block a user