Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying the following key mapping, but it only moves the cursor up one line at a time. I'd like it to move 10 lines at a time. It seems the "amount" paramater is ignored.

{ "keys": ["alt+down"], "command": "move", "args": {"by": "lines", "forward": true, "amount": 10.0} },
{ "keys": ["alt+up"], "command": "move", "args": {"by": "lines", "forward": false, "amount": 10.0} }
share|improve this question
add comment

2 Answers

up vote 4 down vote accepted

You can create a plugin that gets called from a key binding, this plugin can then collect the current line and move it down or up.

This post on the offical sublime forums has an example how to move back and forth 10 lines with a plugin.

share|improve this answer
    
Seems ridiculous that you'd need to create a plugin for this... –  jondavidjohn Feb 25 '13 at 17:47
    
sublimetext.com/forum I think you can submit idea's and features here jondavidjohn. I think the flexible plugin system is one of sublime's biggest strengths. –  Niels van Reijmersdal Mar 6 '13 at 15:34
add comment

I've also had success using the multiple commands command to achieve command concatenation in bindings.

You won't need a separate plugin for this, though you will need to repeat the same command a bit. Here's an example from my bind file.

{
    "keys": ["H"],
    "command": "run_multiple_commands",
    "args": {
        "commands": [
            {"command": "set_motion", "args": {
            "motion": "vi_move_by_characters_in_line",
            "motion_args": {"forward": false, "extend": true }}},
            {"command": "set_motion", "args": {
            "motion": "vi_move_by_characters_in_line",
            "motion_args": {"forward": false, "extend": true }}},
            {"command": "set_motion", "args": {
            "motion": "vi_move_by_characters_in_line",
            "motion_args": {"forward": false, "extend": true }}},
            {"command": "set_motion", "args": {
            "motion": "vi_move_by_characters_in_line",
            "motion_args": {"forward": false, "extend": true }}},
            {"command": "set_motion", "args": {
            "motion": "vi_move_by_characters_in_line",
            "motion_args": {"forward": false, "extend": true }}},
            {"command": "set_motion", "args": {
            "motion": "vi_move_by_characters_in_line",
            "motion_args": {"forward": false, "extend": true }}},
            {"command": "set_motion", "args": {
            "motion": "vi_move_by_characters_in_line",
            "motion_args": {"forward": false, "extend": true }}},
            {"command": "set_motion", "args": {
            "motion": "vi_move_by_characters_in_line",
            "motion_args": {"forward": false, "extend": true }}},
            {"command": "set_motion", "args": {
            "motion": "vi_move_by_characters_in_line",
            "motion_args": {"forward": false, "extend": true }}},
            {"command": "set_motion", "args": {
            "motion": "vi_move_by_characters_in_line",
            "motion_args": {"forward": false, "extend": true }}},
        ]
    },
    "context": [{"key": "setting.command_mode"}]
},

Looks awful, I know, but this is apparently the standard way to get your cursor moved back 10 lines.

If there was some way to find out what the command invocation is for whatever typing "10h" would do in vintage mode, that should be more elegant.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.