on master help sign in
swap yank command registers (#8708)
10b178eSkyler Hawthorne
book/src/usage.md+2−2
@@ -59,8 +59,8 @@ Some registers have special behavior when read from and written to.
59| `#` | Selection indices (first selection is `1`, second is `2`, etc.) | This register is not writable |
59| `#` | Selection indices (first selection is `1`, second is `2`, etc.) | This register is not writable |
60| `.` | Contents of the current selections | This register is not writable |
60| `.` | Contents of the current selections | This register is not writable |
61| `%` | Name of the current file | This register is not writable |
61| `%` | Name of the current file | This register is not writable |
62−| `*` | Reads from the system clipboard | Joins and yanks to the system clipboard |
62+| `+` | Reads from the system clipboard | Joins and yanks to the system clipboard |
63−| `+` | Reads from the primary clipboard | Joins and yanks to the primary clipboard |
63+| `*` | Reads from the primary clipboard | Joins and yanks to the primary clipboard |
64
64
65When yanking multiple selections to the clipboard registers, the selections
65When yanking multiple selections to the clipboard registers, the selections
66are joined with newlines. Pasting from these registers will paste multiple
66are joined with newlines. Pasting from these registers will paste multiple
helix-term/src/commands.rs+12−12
@@ -3897,12 +3897,12 @@ fn yank(cx: &mut Context) {
3897}
3897}
3898
3898
3899fn yank_to_clipboard(cx: &mut Context) {
3899fn yank_to_clipboard(cx: &mut Context) {
3900− yank_impl(cx.editor, '*');
3900+ yank_impl(cx.editor, '+');
3901 exit_select_mode(cx);
3901 exit_select_mode(cx);
3902}
3902}
3903
3903
3904fn yank_to_primary_clipboard(cx: &mut Context) {
3904fn yank_to_primary_clipboard(cx: &mut Context) {
3905− yank_impl(cx.editor, '+');
3905+ yank_impl(cx.editor, '*');
3906 exit_select_mode(cx);
3906 exit_select_mode(cx);
3907}
3907}
3908
3908
@@ -3959,13 +3959,13 @@ fn yank_joined(cx: &mut Context) {
3959
3959
3960fn yank_joined_to_clipboard(cx: &mut Context) {
3960fn yank_joined_to_clipboard(cx: &mut Context) {
3961 let line_ending = doc!(cx.editor).line_ending;
3961 let line_ending = doc!(cx.editor).line_ending;
3962− yank_joined_impl(cx.editor, line_ending.as_str(), '*');
3962+ yank_joined_impl(cx.editor, line_ending.as_str(), '+');
3963 exit_select_mode(cx);
3963 exit_select_mode(cx);
3964}
3964}
3965
3965
3966fn yank_joined_to_primary_clipboard(cx: &mut Context) {
3966fn yank_joined_to_primary_clipboard(cx: &mut Context) {
3967 let line_ending = doc!(cx.editor).line_ending;
3967 let line_ending = doc!(cx.editor).line_ending;
3968− yank_joined_impl(cx.editor, line_ending.as_str(), '+');
3968+ yank_joined_impl(cx.editor, line_ending.as_str(), '*');
3969 exit_select_mode(cx);
3969 exit_select_mode(cx);
3970}
3970}
3971
3971
@@ -3982,12 +3982,12 @@ fn yank_primary_selection_impl(editor: &mut Editor, register: char) {
3982}
3982}
3983
3983
3984fn yank_main_selection_to_clipboard(cx: &mut Context) {
3984fn yank_main_selection_to_clipboard(cx: &mut Context) {
3985− yank_primary_selection_impl(cx.editor, '*');
3985+ yank_primary_selection_impl(cx.editor, '+');
3986 exit_select_mode(cx);
3986 exit_select_mode(cx);
3987}
3987}
3988
3988
3989fn yank_main_selection_to_primary_clipboard(cx: &mut Context) {
3989fn yank_main_selection_to_primary_clipboard(cx: &mut Context) {
3990− yank_primary_selection_impl(cx.editor, '+');
3990+ yank_primary_selection_impl(cx.editor, '*');
3991 exit_select_mode(cx);
3991 exit_select_mode(cx);
3992}
3992}
3993
3993
@@ -4088,19 +4088,19 @@ pub(crate) fn paste_bracketed_value(cx: &mut Context, contents: String) {
4088}
4088}
4089
4089
4090fn paste_clipboard_after(cx: &mut Context) {
4090fn paste_clipboard_after(cx: &mut Context) {
4091− paste(cx.editor, '*', Paste::After, cx.count());
4091+ paste(cx.editor, '+', Paste::After, cx.count());
4092}
4092}
4093
4093
4094fn paste_clipboard_before(cx: &mut Context) {
4094fn paste_clipboard_before(cx: &mut Context) {
4095− paste(cx.editor, '*', Paste::Before, cx.count());
4095+ paste(cx.editor, '+', Paste::Before, cx.count());
4096}
4096}
4097
4097
4098fn paste_primary_clipboard_after(cx: &mut Context) {
4098fn paste_primary_clipboard_after(cx: &mut Context) {
4099− paste(cx.editor, '+', Paste::After, cx.count());
4099+ paste(cx.editor, '*', Paste::After, cx.count());
4100}
4100}
4101
4101
4102fn paste_primary_clipboard_before(cx: &mut Context) {
4102fn paste_primary_clipboard_before(cx: &mut Context) {
4103− paste(cx.editor, '+', Paste::Before, cx.count());
4103+ paste(cx.editor, '*', Paste::Before, cx.count());
4104}
4104}
4105
4105
4106fn replace_with_yanked(cx: &mut Context) {
4106fn replace_with_yanked(cx: &mut Context) {
@@ -4138,11 +4138,11 @@ fn replace_with_yanked_impl(editor: &mut Editor, register: char, count: usize) {
4138}
4138}
4139
4139
4140fn replace_selections_with_clipboard(cx: &mut Context) {
4140fn replace_selections_with_clipboard(cx: &mut Context) {
4141− replace_with_yanked_impl(cx.editor, '*', cx.count());
4141+ replace_with_yanked_impl(cx.editor, '+', cx.count());
4142}
4142}
4143
4143
4144fn replace_selections_with_primary_clipboard(cx: &mut Context) {
4144fn replace_selections_with_primary_clipboard(cx: &mut Context) {
4145− replace_with_yanked_impl(cx.editor, '+', cx.count());
4145+ replace_with_yanked_impl(cx.editor, '*', cx.count());
4146}
4146}
4147
4147
4148fn paste(editor: &mut Editor, register: char, pos: Paste, count: usize) {
4148fn paste(editor: &mut Editor, register: char, pos: Paste, count: usize) {
helix-term/src/commands/typed.rs+10−10
@@ -921,7 +921,7 @@ fn yank_main_selection_to_clipboard(
921 return Ok(());
921 return Ok(());
922 }
922 }
923
923
924− yank_primary_selection_impl(cx.editor, '*');
924+ yank_primary_selection_impl(cx.editor, '+');
925 Ok(())
925 Ok(())
926}
926}
927
927
@@ -956,7 +956,7 @@ fn yank_joined_to_clipboard(
956 let doc = doc!(cx.editor);
956 let doc = doc!(cx.editor);
957 let default_sep = Cow::Borrowed(doc.line_ending.as_str());
957 let default_sep = Cow::Borrowed(doc.line_ending.as_str());
958 let separator = args.first().unwrap_or(&default_sep);
958 let separator = args.first().unwrap_or(&default_sep);
959− yank_joined_impl(cx.editor, separator, '*');
959+ yank_joined_impl(cx.editor, separator, '+');
960 Ok(())
960 Ok(())
961}
961}
962
962
@@ -969,7 +969,7 @@ fn yank_main_selection_to_primary_clipboard(
969 return Ok(());
969 return Ok(());
970 }
970 }
971
971
972− yank_primary_selection_impl(cx.editor, '+');
972+ yank_primary_selection_impl(cx.editor, '*');
973 Ok(())
973 Ok(())
974}
974}
975
975
@@ -985,7 +985,7 @@ fn yank_joined_to_primary_clipboard(
985 let doc = doc!(cx.editor);
985 let doc = doc!(cx.editor);
986 let default_sep = Cow::Borrowed(doc.line_ending.as_str());
986 let default_sep = Cow::Borrowed(doc.line_ending.as_str());
987 let separator = args.first().unwrap_or(&default_sep);
987 let separator = args.first().unwrap_or(&default_sep);
988− yank_joined_impl(cx.editor, separator, '+');
988+ yank_joined_impl(cx.editor, separator, '*');
989 Ok(())
989 Ok(())
990}
990}
991
991
@@ -998,7 +998,7 @@ fn paste_clipboard_after(
998 return Ok(());
998 return Ok(());
999 }
999 }
1000
1000
1001− paste(cx.editor, '*', Paste::After, 1);
1001+ paste(cx.editor, '+', Paste::After, 1);
1002 Ok(())
1002 Ok(())
1003}
1003}
1004
1004
@@ -1011,7 +1011,7 @@ fn paste_clipboard_before(
1011 return Ok(());
1011 return Ok(());
1012 }
1012 }
1013
1013
1014− paste(cx.editor, '*', Paste::Before, 1);
1014+ paste(cx.editor, '+', Paste::Before, 1);
1015 Ok(())
1015 Ok(())
1016}
1016}
1017
1017
@@ -1024,7 +1024,7 @@ fn paste_primary_clipboard_after(
1024 return Ok(());
1024 return Ok(());
1025 }
1025 }
1026
1026
1027− paste(cx.editor, '+', Paste::After, 1);
1027+ paste(cx.editor, '*', Paste::After, 1);
1028 Ok(())
1028 Ok(())
1029}
1029}
1030
1030
@@ -1037,7 +1037,7 @@ fn paste_primary_clipboard_before(
1037 return Ok(());
1037 return Ok(());
1038 }
1038 }
1039
1039
1040− paste(cx.editor, '+', Paste::Before, 1);
1040+ paste(cx.editor, '*', Paste::Before, 1);
1041 Ok(())
1041 Ok(())
1042}
1042}
1043
1043
@@ -1050,7 +1050,7 @@ fn replace_selections_with_clipboard(
1050 return Ok(());
1050 return Ok(());
1051 }
1051 }
1052
1052
1053− replace_with_yanked_impl(cx.editor, '*', 1);
1053+ replace_with_yanked_impl(cx.editor, '+', 1);
1054 Ok(())
1054 Ok(())
1055}
1055}
1056
1056
@@ -1063,7 +1063,7 @@ fn replace_selections_with_primary_clipboard(
1063 return Ok(());
1063 return Ok(());
1064 }
1064 }
1065
1065
1066− replace_with_yanked_impl(cx.editor, '+', 1);
1066+ replace_with_yanked_impl(cx.editor, '*', 1);
1067 Ok(())
1067 Ok(())
1068}
1068}
1069
1069