Skip to content

Instantly share code, notes, and snippets.

@fabd
Created November 28, 2016 21:12
Show Gist options
  • Save fabd/3645df542844a4b400548b45e5652576 to your computer and use it in GitHub Desktop.
Save fabd/3645df542844a4b400548b45e5652576 to your computer and use it in GitHub Desktop.
Piece-wise copying of the line above the current one (an incredibly useful VIM macro converted to Sublime Text)
[
{
"args":
{
"by": "lines",
"forward": false
},
"command": "move"
},
{
"args":
{
"commands":
[
[
"enter_visual_mode",
null
],
[
"vi_eval",
{
"action_args": null,
"action_command": null,
"motion_args":
{
"by": "stops",
"empty_line": true,
"extend": true,
"forward": true,
"punct_end": true,
"word_end": true
},
"motion_clip_to_line": true,
"motion_command": "move",
"motion_inclusive": true,
"motion_mode": 0
}
],
[
"vi_eval",
{
"action_args":
{
},
"action_command": "vi_copy",
"motion_args": null,
"motion_clip_to_line": false,
"motion_command": null,
"motion_inclusive": false,
"motion_mode": 0
}
]
]
},
"command": "sequence"
},
{
"args":
{
"action_args": null,
"action_command": null,
"motion_args":
{
"by": "lines",
"extend": true,
"forward": true
},
"motion_clip_to_line": false,
"motion_command": "move",
"motion_inclusive": false,
"motion_mode": 0
},
"command": "vi_eval"
},
{
"args":
{
},
"command": "vi_paste_right"
},
{
"args":
{
"register": "\"",
"to": "hardeol"
},
"command": "move_to"
}
]
@fabd
Copy link
Author

fabd commented Nov 28, 2016

This Sublime Text 3 macro emulates the following VIM macro

" Piece-wise copying of the line above the current one
:imap <C-L> @@@<ESC>hhkywjl?@@@<CR>P/@@@<CR>3s

PLEASE NOTE : THE MACRO WORKS ONLY WITH "VINTAGE" MODE ENABLED IN SETTINGS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment